summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--content/common/gpu/client/gpu_video_decode_accelerator_host.cc6
-rw-r--r--content/common/gpu/client/gpu_video_decode_accelerator_host.h4
-rw-r--r--content/common/gpu/gpu_messages.h7
-rw-r--r--content/common/gpu/media/android_video_decode_accelerator.cc7
-rw-r--r--content/common/gpu/media/dxva_video_decode_accelerator.cc3
-rw-r--r--content/common/gpu/media/gpu_video_decode_accelerator.cc3
-rw-r--r--content/common/gpu/media/v4l2_video_decode_accelerator.cc4
-rw-r--r--content/common/gpu/media/vaapi_video_decode_accelerator.cc5
-rw-r--r--content/common/gpu/media/vt_video_decode_accelerator.cc3
-rw-r--r--content/renderer/media/rtc_video_decoder.cc44
-rw-r--r--content/renderer/media/rtc_video_decoder.h15
-rw-r--r--content/renderer/pepper/pepper_video_decoder_host.cc2
-rw-r--r--content/renderer/pepper/ppb_video_decoder_impl.cc2
-rw-r--r--content/renderer/pepper/video_decoder_shim.cc27
-rw-r--r--media/filters/gpu_video_decoder.cc14
-rw-r--r--media/video/picture.cc7
-rw-r--r--media/video/picture.h11
17 files changed, 100 insertions, 64 deletions
diff --git a/content/common/gpu/client/gpu_video_decode_accelerator_host.cc b/content/common/gpu/client/gpu_video_decode_accelerator_host.cc
index 8b714b9..a784467 100644
--- a/content/common/gpu/client/gpu_video_decode_accelerator_host.cc
+++ b/content/common/gpu/client/gpu_video_decode_accelerator_host.cc
@@ -231,11 +231,13 @@ void GpuVideoDecodeAcceleratorHost::OnDismissPictureBuffer(
}
void GpuVideoDecodeAcceleratorHost::OnPictureReady(
- int32 picture_buffer_id, int32 bitstream_buffer_id) {
+ int32 picture_buffer_id,
+ int32 bitstream_buffer_id,
+ const gfx::Rect& visible_rect) {
DCHECK(CalledOnValidThread());
if (!client_)
return;
- media::Picture picture(picture_buffer_id, bitstream_buffer_id);
+ media::Picture picture(picture_buffer_id, bitstream_buffer_id, visible_rect);
client_->PictureReady(picture);
}
diff --git a/content/common/gpu/client/gpu_video_decode_accelerator_host.h b/content/common/gpu/client/gpu_video_decode_accelerator_host.h
index 571bd0c..e333f6b 100644
--- a/content/common/gpu/client/gpu_video_decode_accelerator_host.h
+++ b/content/common/gpu/client/gpu_video_decode_accelerator_host.h
@@ -64,7 +64,9 @@ class GpuVideoDecodeAcceleratorHost
const gfx::Size& dimensions,
uint32 texture_target);
void OnDismissPictureBuffer(int32 picture_buffer_id);
- void OnPictureReady(int32 picture_buffer_id, int32 bitstream_buffer_id);
+ void OnPictureReady(int32 picture_buffer_id,
+ int32 bitstream_buffer_id,
+ const gfx::Rect& visible_rect);
void OnFlushDone();
void OnResetDone();
void OnNotifyError(uint32 error);
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h
index 164052e..a91bd1f 100644
--- a/content/common/gpu/gpu_messages.h
+++ b/content/common/gpu/gpu_messages.h
@@ -696,9 +696,10 @@ IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer,
int32) /* Picture buffer ID */
// Decoder reports that a picture is ready.
-IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderHostMsg_PictureReady,
- int32, /* Picture buffer ID */
- int32) /* Bitstream buffer ID */
+IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderHostMsg_PictureReady,
+ int32, /* Picture buffer ID */
+ int32, /* Bitstream buffer ID */
+ gfx::Rect) /* Visible rectangle */
// Confirm decoder has been flushed.
IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone)
diff --git a/content/common/gpu/media/android_video_decode_accelerator.cc b/content/common/gpu/media/android_video_decode_accelerator.cc
index b1de5b1..0eee641 100644
--- a/content/common/gpu/media/android_video_decode_accelerator.cc
+++ b/content/common/gpu/media/android_video_decode_accelerator.cc
@@ -377,9 +377,10 @@ void AndroidVideoDecodeAccelerator::SendCurrentSurfaceToClient(
base::MessageLoop::current()->PostTask(
FROM_HERE,
- base::Bind(&AndroidVideoDecodeAccelerator::NotifyPictureReady,
- weak_this_factory_.GetWeakPtr(),
- media::Picture(picture_buffer_id, bitstream_id)));
+ base::Bind(
+ &AndroidVideoDecodeAccelerator::NotifyPictureReady,
+ weak_this_factory_.GetWeakPtr(),
+ media::Picture(picture_buffer_id, bitstream_id, gfx::Rect(size_))));
}
void AndroidVideoDecodeAccelerator::Decode(
diff --git a/content/common/gpu/media/dxva_video_decode_accelerator.cc b/content/common/gpu/media/dxva_video_decode_accelerator.cc
index 2e667d0..1c9f6f3 100644
--- a/content/common/gpu/media/dxva_video_decode_accelerator.cc
+++ b/content/common/gpu/media/dxva_video_decode_accelerator.cc
@@ -943,7 +943,8 @@ void DXVAVideoDecodeAccelerator::ProcessPendingSamples() {
PLATFORM_FAILURE, );
media::Picture output_picture(index->second->id(),
- sample_info.input_buffer_id);
+ sample_info.input_buffer_id,
+ gfx::Rect(index->second->size()));
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&DXVAVideoDecodeAccelerator::NotifyPictureReady,
diff --git a/content/common/gpu/media/gpu_video_decode_accelerator.cc b/content/common/gpu/media/gpu_video_decode_accelerator.cc
index 6ce9330..c1cd553 100644
--- a/content/common/gpu/media/gpu_video_decode_accelerator.cc
+++ b/content/common/gpu/media/gpu_video_decode_accelerator.cc
@@ -212,7 +212,8 @@ void GpuVideoDecodeAccelerator::PictureReady(
if (!Send(new AcceleratedVideoDecoderHostMsg_PictureReady(
host_route_id_,
picture.picture_buffer_id(),
- picture.bitstream_buffer_id()))) {
+ picture.bitstream_buffer_id(),
+ picture.visible_rect()))) {
DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_PictureReady) failed";
}
}
diff --git a/content/common/gpu/media/v4l2_video_decode_accelerator.cc b/content/common/gpu/media/v4l2_video_decode_accelerator.cc
index 315b2f5..c570918 100644
--- a/content/common/gpu/media/v4l2_video_decode_accelerator.cc
+++ b/content/common/gpu/media/v4l2_video_decode_accelerator.cc
@@ -1091,8 +1091,8 @@ void V4L2VideoDecodeAccelerator::Dequeue() {
output_record.at_client = true;
DVLOG(3) << "Dequeue(): returning input_id=" << dqbuf.timestamp.tv_sec
<< " as picture_id=" << output_record.picture_id;
- const media::Picture& picture =
- media::Picture(output_record.picture_id, dqbuf.timestamp.tv_sec);
+ const media::Picture& picture = media::Picture(
+ output_record.picture_id, dqbuf.timestamp.tv_sec, frame_buffer_size_);
pending_picture_ready_.push(
PictureRecord(output_record.cleared, picture));
SendPictureReady();
diff --git a/content/common/gpu/media/vaapi_video_decode_accelerator.cc b/content/common/gpu/media/vaapi_video_decode_accelerator.cc
index afcfc8a..0b30012 100644
--- a/content/common/gpu/media/vaapi_video_decode_accelerator.cc
+++ b/content/common/gpu/media/vaapi_video_decode_accelerator.cc
@@ -371,8 +371,11 @@ void VaapiVideoDecodeAccelerator::OutputPicture(
TRACE_COUNTER1("Video Decoder", "Textures at client", num_frames_at_client_);
DVLOG(4) << "Notifying output picture id " << output_id
<< " for input "<< input_id << " is ready";
+ // TODO(posciak): Use visible size from decoder here instead
+ // (crbug.com/402760).
if (client_)
- client_->PictureReady(media::Picture(output_id, input_id));
+ client_->PictureReady(
+ media::Picture(output_id, input_id, gfx::Rect(tfp_picture->size())));
}
void VaapiVideoDecodeAccelerator::TryOutputSurface() {
diff --git a/content/common/gpu/media/vt_video_decode_accelerator.cc b/content/common/gpu/media/vt_video_decode_accelerator.cc
index 5b91650..8e4c408 100644
--- a/content/common/gpu/media/vt_video_decode_accelerator.cc
+++ b/content/common/gpu/media/vt_video_decode_accelerator.cc
@@ -376,7 +376,8 @@ void VTVideoDecodeAccelerator::SendPictures() {
0)); // plane
picture_bindings_[picture_id] = frame.image_buffer;
- client_->PictureReady(media::Picture(picture_id, frame.bitstream_id));
+ client_->PictureReady(media::Picture(
+ picture_id, frame.bitstream_id, gfx::Rect(texture_size_)));
client_->NotifyEndOfBitstreamBuffer(frame.bitstream_id);
}
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);
diff --git a/content/renderer/pepper/pepper_video_decoder_host.cc b/content/renderer/pepper/pepper_video_decoder_host.cc
index fdb5cc3..3f39c94 100644
--- a/content/renderer/pepper/pepper_video_decoder_host.cc
+++ b/content/renderer/pepper/pepper_video_decoder_host.cc
@@ -313,6 +313,8 @@ void PepperVideoDecoderHost::ProvidePictureBuffers(
}
void PepperVideoDecoderHost::PictureReady(const media::Picture& picture) {
+ // So far picture.visible_rect is not used. If used, visible_rect should
+ // be validated since it comes from GPU process and may not be trustworthy.
host()->SendUnsolicitedReply(
pp_resource(),
PpapiPluginMsg_VideoDecoder_PictureReady(picture.bitstream_buffer_id(),
diff --git a/content/renderer/pepper/ppb_video_decoder_impl.cc b/content/renderer/pepper/ppb_video_decoder_impl.cc
index f52d423..53b2ef9 100644
--- a/content/renderer/pepper/ppb_video_decoder_impl.cc
+++ b/content/renderer/pepper/ppb_video_decoder_impl.cc
@@ -246,6 +246,8 @@ void PPB_VideoDecoder_Impl::ProvidePictureBuffers(
}
void PPB_VideoDecoder_Impl::PictureReady(const media::Picture& picture) {
+ // So far picture.visible_rect is not used. If used, visible_rect should
+ // be validated since it comes from GPU process and may not be trustworthy.
DCHECK(RenderThreadImpl::current());
if (!ppp_videodecoder_)
return;
diff --git a/content/renderer/pepper/video_decoder_shim.cc b/content/renderer/pepper/video_decoder_shim.cc
index c52c285..d213ac9 100644
--- a/content/renderer/pepper/video_decoder_shim.cc
+++ b/content/renderer/pepper/video_decoder_shim.cc
@@ -47,11 +47,14 @@ VideoDecoderShim::PendingDecode::~PendingDecode() {
struct VideoDecoderShim::PendingFrame {
explicit PendingFrame(uint32_t decode_id);
- PendingFrame(uint32_t decode_id, const gfx::Size& size);
+ PendingFrame(uint32_t decode_id,
+ const gfx::Size& coded_size,
+ const gfx::Rect& visible_rect);
~PendingFrame();
const uint32_t decode_id;
- const gfx::Size size;
+ const gfx::Size coded_size;
+ const gfx::Rect visible_rect;
std::vector<uint8_t> argb_pixels;
private:
@@ -64,10 +67,12 @@ VideoDecoderShim::PendingFrame::PendingFrame(uint32_t decode_id)
}
VideoDecoderShim::PendingFrame::PendingFrame(uint32_t decode_id,
- const gfx::Size& size)
+ const gfx::Size& coded_size,
+ const gfx::Rect& visible_rect)
: decode_id(decode_id),
- size(size),
- argb_pixels(size.width() * size.height() * 4) {
+ coded_size(coded_size),
+ visible_rect(visible_rect),
+ argb_pixels(coded_size.width() * coded_size.height() * 4) {
}
VideoDecoderShim::PendingFrame::~PendingFrame() {
@@ -258,7 +263,8 @@ void VideoDecoderShim::DecoderImpl::OnOutputComplete(
const scoped_refptr<media::VideoFrame>& frame) {
scoped_ptr<PendingFrame> pending_frame;
if (!frame->end_of_stream()) {
- pending_frame.reset(new PendingFrame(decode_id_, frame->coded_size()));
+ pending_frame.reset(new PendingFrame(
+ decode_id_, frame->coded_size(), frame->visible_rect()));
// Convert the VideoFrame pixels to ABGR to match VideoDecodeAccelerator.
libyuv::I420ToABGR(frame->data(media::VideoFrame::kYPlane),
frame->stride(media::VideoFrame::kYPlane),
@@ -470,7 +476,7 @@ void VideoDecoderShim::OnOutputComplete(scoped_ptr<PendingFrame> frame) {
DCHECK(host_);
if (!frame->argb_pixels.empty()) {
- if (texture_size_ != frame->size) {
+ if (texture_size_ != frame->coded_size) {
// If the size has changed, all current textures must be dismissed. Add
// all textures to |textures_to_dismiss_| and dismiss any that aren't in
// use by the plugin. We will dismiss the rest as they are recycled.
@@ -492,10 +498,10 @@ void VideoDecoderShim::OnOutputComplete(scoped_ptr<PendingFrame> frame) {
pending_texture_mailboxes_.push_back(gpu::Mailbox::Generate());
host_->RequestTextures(texture_pool_size_,
- frame->size,
+ frame->coded_size,
GL_TEXTURE_2D,
pending_texture_mailboxes_);
- texture_size_ = frame->size;
+ texture_size_ = frame->coded_size;
}
pending_frames_.push(linked_ptr<PendingFrame>(frame.release()));
@@ -527,7 +533,8 @@ void VideoDecoderShim::SendPictures() {
GL_UNSIGNED_BYTE,
&frame->argb_pixels.front());
- host_->PictureReady(media::Picture(texture_id, frame->decode_id));
+ host_->PictureReady(
+ media::Picture(texture_id, frame->decode_id, frame->visible_rect));
pending_frames_.pop();
}
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc
index 16a33ea..3954e09 100644
--- a/media/filters/gpu_video_decoder.cc
+++ b/media/filters/gpu_video_decoder.cc
@@ -422,8 +422,22 @@ void GpuVideoDecoder::PictureReady(const media::Picture& picture) {
}
const PictureBuffer& pb = it->second;
+ // Validate picture rectangle from GPU. This is for sanity/security check
+ // even the rectangle is not used in this class.
+ 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;
+ }
+
// Update frame's timestamp.
base::TimeDelta timestamp;
+ // Some of the VDAs don't support and thus don't provide us with visible
+ // size in picture.size, passing coded size instead, so always drop it and
+ // use config information instead.
gfx::Rect visible_rect;
gfx::Size natural_size;
GetBufferData(picture.bitstream_buffer_id(), &timestamp, &visible_rect,
diff --git a/media/video/picture.cc b/media/video/picture.cc
index 7b32563..f051013 100644
--- a/media/video/picture.cc
+++ b/media/video/picture.cc
@@ -22,9 +22,12 @@ PictureBuffer::PictureBuffer(int32 id,
texture_mailbox_(texture_mailbox) {
}
-Picture::Picture(int32 picture_buffer_id, int32 bitstream_buffer_id)
+Picture::Picture(int32 picture_buffer_id,
+ int32 bitstream_buffer_id,
+ const gfx::Rect& visible_rect)
: picture_buffer_id_(picture_buffer_id),
- bitstream_buffer_id_(bitstream_buffer_id) {
+ bitstream_buffer_id_(bitstream_buffer_id),
+ visible_rect_(visible_rect) {
}
} // namespace media
diff --git a/media/video/picture.h b/media/video/picture.h
index d5be227..844e629 100644
--- a/media/video/picture.h
+++ b/media/video/picture.h
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "media/base/media_export.h"
+#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/size.h"
namespace media {
@@ -54,7 +55,9 @@ class MEDIA_EXPORT PictureBuffer {
// This is the media-namespace equivalent of PP_Picture_Dev.
class MEDIA_EXPORT Picture {
public:
- Picture(int32 picture_buffer_id, int32 bitstream_buffer_id);
+ Picture(int32 picture_buffer_id,
+ int32 bitstream_buffer_id,
+ const gfx::Rect& visible_rect);
// Returns the id of the picture buffer where this picture is contained.
int32 picture_buffer_id() const {
@@ -70,9 +73,15 @@ class MEDIA_EXPORT Picture {
bitstream_buffer_id_ = bitstream_buffer_id;
}
+ // Returns the visible rectangle of the picture. Its size may be smaller
+ // than the size of the PictureBuffer, as it is the only visible part of the
+ // Picture contained in the PictureBuffer.
+ gfx::Rect visible_rect() const { return visible_rect_; }
+
private:
int32 picture_buffer_id_;
int32 bitstream_buffer_id_;
+ gfx::Rect visible_rect_;
};
} // namespace media