summaryrefslogtreecommitdiffstats
path: root/content/renderer/media
diff options
context:
space:
mode:
authorkcwu@chromium.org <kcwu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-21 21:18:57 +0000
committerkcwu@chromium.org <kcwu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-21 21:22:12 +0000
commit72de2f772735c0ffbe7b30c9887b6796ab50bb89 (patch)
tree5f3f464d2091375a2a60a1035ef2a22151ae8b98 /content/renderer/media
parentbd866841e4c6a5d05300c0b67b1927020c485e9b (diff)
downloadchromium_src-72de2f772735c0ffbe7b30c9887b6796ab50bb89.zip
chromium_src-72de2f772735c0ffbe7b30c9887b6796ab50bb89.tar.gz
chromium_src-72de2f772735c0ffbe7b30c9887b6796ab50bb89.tar.bz2
Pass decoded picture size from VDA to client
Some of the VDAs, like DXVA and AVDA, don't distinguish between visible size and coded size. And given GVD is always been used with container, we should keep using size from config in GVD. BUG=390048 TEST=Manually tested: flash player using youtube. html5 player with resolution 1280x720 and 1216x684, h264 and vp8. apprtc with resolution 640x480 and 636x476. All tests are performed on both daisy and link. R=hshi@chromium.org, posciak@chromium.org Review URL: https://codereview.chromium.org/426873004 Cr-Commit-Position: refs/heads/master@{#291187} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291187 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/media')
-rw-r--r--content/renderer/media/rtc_video_decoder.cc44
-rw-r--r--content/renderer/media/rtc_video_decoder.h15
2 files changed, 23 insertions, 36 deletions
diff --git a/content/renderer/media/rtc_video_decoder.cc b/content/renderer/media/rtc_video_decoder.cc
index 1658970..c55ebbd 100644
--- a/content/renderer/media/rtc_video_decoder.cc
+++ b/content/renderer/media/rtc_video_decoder.cc
@@ -61,13 +61,9 @@ RTCVideoDecoder::SHMBuffer::~SHMBuffer() { shm->Close(); }
RTCVideoDecoder::BufferData::BufferData(int32 bitstream_buffer_id,
uint32_t timestamp,
- int width,
- int height,
size_t size)
: bitstream_buffer_id(bitstream_buffer_id),
timestamp(timestamp),
- width(width),
- height(height),
size(size) {}
RTCVideoDecoder::BufferData::BufferData() {}
@@ -227,8 +223,6 @@ int32_t RTCVideoDecoder::Decode(
// Create buffer metadata.
BufferData buffer_data(next_bitstream_buffer_id_,
inputImage._timeStamp,
- frame_size_.width(),
- frame_size_.height(),
inputImage._length);
// Mask against 30 bits, to avoid (undefined) wraparound on signed integer.
next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & ID_LAST;
@@ -364,13 +358,21 @@ void RTCVideoDecoder::PictureReady(const media::Picture& picture) {
}
const media::PictureBuffer& pb = it->second;
+ // Validate picture rectangle from GPU.
+ if (picture.visible_rect().IsEmpty() ||
+ !gfx::Rect(pb.size()).Contains(picture.visible_rect())) {
+ NOTREACHED() << "Invalid picture size from VDA: "
+ << picture.visible_rect().ToString() << " should fit in "
+ << pb.size().ToString();
+ NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
+ return;
+ }
+
// Create a media::VideoFrame.
- uint32_t timestamp = 0, width = 0, height = 0;
- size_t size = 0;
- GetBufferData(
- picture.bitstream_buffer_id(), &timestamp, &width, &height, &size);
+ uint32_t timestamp = 0;
+ GetBufferData(picture.bitstream_buffer_id(), &timestamp);
scoped_refptr<media::VideoFrame> frame =
- CreateVideoFrame(picture, pb, timestamp, width, height, size);
+ CreateVideoFrame(picture, pb, timestamp);
bool inserted =
picture_buffers_at_display_.insert(std::make_pair(
picture.picture_buffer_id(),
@@ -380,7 +382,11 @@ void RTCVideoDecoder::PictureReady(const media::Picture& picture) {
// Create a WebRTC video frame.
webrtc::RefCountImpl<NativeHandleImpl>* handle =
new webrtc::RefCountImpl<NativeHandleImpl>(frame);
- webrtc::TextureVideoFrame decoded_image(handle, width, height, timestamp, 0);
+ webrtc::TextureVideoFrame decoded_image(handle,
+ picture.visible_rect().width(),
+ picture.visible_rect().height(),
+ timestamp,
+ 0);
// Invoke decode callback. WebRTC expects no callback after Reset or Release.
{
@@ -423,11 +429,8 @@ static void ReadPixelsSync(
scoped_refptr<media::VideoFrame> RTCVideoDecoder::CreateVideoFrame(
const media::Picture& picture,
const media::PictureBuffer& pb,
- uint32_t timestamp,
- uint32_t width,
- uint32_t height,
- size_t size) {
- gfx::Rect visible_rect(width, height);
+ uint32_t timestamp) {
+ gfx::Rect visible_rect(picture.visible_rect());
DCHECK(decoder_texture_target_);
// Convert timestamp from 90KHz to ms.
base::TimeDelta timestamp_ms = base::TimeDelta::FromInternalValue(
@@ -777,18 +780,13 @@ void RTCVideoDecoder::RecordBufferData(const BufferData& buffer_data) {
}
void RTCVideoDecoder::GetBufferData(int32 bitstream_buffer_id,
- uint32_t* timestamp,
- uint32_t* width,
- uint32_t* height,
- size_t* size) {
+ uint32_t* timestamp) {
for (std::list<BufferData>::iterator it = input_buffer_data_.begin();
it != input_buffer_data_.end();
++it) {
if (it->bitstream_buffer_id != bitstream_buffer_id)
continue;
*timestamp = it->timestamp;
- *width = it->width;
- *height = it->height;
return;
}
NOTREACHED() << "Missing bitstream buffer id: " << bitstream_buffer_id;
diff --git a/content/renderer/media/rtc_video_decoder.h b/content/renderer/media/rtc_video_decoder.h
index 0c8e45b..c1a8b88 100644
--- a/content/renderer/media/rtc_video_decoder.h
+++ b/content/renderer/media/rtc_video_decoder.h
@@ -91,15 +91,11 @@ class CONTENT_EXPORT RTCVideoDecoder
struct BufferData {
BufferData(int32 bitstream_buffer_id,
uint32_t timestamp,
- int width,
- int height,
size_t size);
BufferData();
~BufferData();
int32 bitstream_buffer_id;
uint32_t timestamp; // in 90KHz
- uint32_t width;
- uint32_t height;
size_t size; // buffer size
};
@@ -138,10 +134,7 @@ class CONTENT_EXPORT RTCVideoDecoder
scoped_refptr<media::VideoFrame> CreateVideoFrame(
const media::Picture& picture,
const media::PictureBuffer& pb,
- uint32_t timestamp,
- uint32_t width,
- uint32_t height,
- size_t size);
+ uint32_t timestamp);
// Resets VDA.
void ResetInternal();
@@ -176,11 +169,7 @@ class CONTENT_EXPORT RTCVideoDecoder
// Stores the buffer metadata to |input_buffer_data_|.
void RecordBufferData(const BufferData& buffer_data);
// Gets the buffer metadata from |input_buffer_data_|.
- void GetBufferData(int32 bitstream_buffer_id,
- uint32_t* timestamp,
- uint32_t* width,
- uint32_t* height,
- size_t* size);
+ void GetBufferData(int32 bitstream_buffer_id, uint32_t* timestamp);
// Records the result of InitDecode to UMA and returns |status|.
int32_t RecordInitDecodeUMA(int32_t status);