| Index: media/gpu/vaapi_video_decode_accelerator.cc
|
| diff --git a/media/gpu/vaapi_video_decode_accelerator.cc b/media/gpu/vaapi_video_decode_accelerator.cc
|
| index 9c6897fa15abd9ac8c453bfb94953f9328bed059..ed197f4f64f1e63f303f9f14c7edbc46039c2f76 100644
|
| --- a/media/gpu/vaapi_video_decode_accelerator.cc
|
| +++ b/media/gpu/vaapi_video_decode_accelerator.cc
|
| @@ -67,6 +67,11 @@ class VaapiVideoDecodeAccelerator::VaapiDecodeSurface
|
|
|
| int32_t bitstream_id() const { return bitstream_id_; }
|
| scoped_refptr<VASurface> va_surface() { return va_surface_; }
|
| + gfx::Rect visible_rect() const { return visible_rect_; }
|
| +
|
| + void SetVisibleRect(const gfx::Rect& visible_rect) {
|
| + visible_rect_ = visible_rect;
|
| + }
|
|
|
| private:
|
| friend class base::RefCountedThreadSafe<VaapiDecodeSurface>;
|
| @@ -74,6 +79,7 @@ class VaapiVideoDecodeAccelerator::VaapiDecodeSurface
|
|
|
| int32_t bitstream_id_;
|
| scoped_refptr<VASurface> va_surface_;
|
| + gfx::Rect visible_rect_;
|
| };
|
|
|
| VaapiVideoDecodeAccelerator::VaapiDecodeSurface::VaapiDecodeSurface(
|
| @@ -136,7 +142,8 @@ class VaapiVideoDecodeAccelerator::VaapiH264Accelerator
|
| size_t size) override;
|
|
|
| bool SubmitDecode(const scoped_refptr<H264Picture>& pic) override;
|
| - bool OutputPicture(const scoped_refptr<H264Picture>& pic) override;
|
| + bool OutputPicture(const scoped_refptr<H264Picture>& pic,
|
| + const gfx::Rect& visible_rect) override;
|
|
|
| void Reset() override;
|
|
|
| @@ -197,7 +204,8 @@ class VaapiVideoDecodeAccelerator::VaapiVP8Accelerator
|
| const scoped_refptr<VP8Picture>& golden_frame,
|
| const scoped_refptr<VP8Picture>& alt_frame) override;
|
|
|
| - bool OutputPicture(const scoped_refptr<VP8Picture>& pic) override;
|
| + bool OutputPicture(const scoped_refptr<VP8Picture>& pic,
|
| + const gfx::Rect& visible_rect) override;
|
|
|
| private:
|
| scoped_refptr<VaapiDecodeSurface> VP8PictureToVaapiDecodeSurface(
|
| @@ -251,7 +259,8 @@ class VaapiVideoDecodeAccelerator::VaapiVP9Accelerator
|
| const std::vector<scoped_refptr<VP9Picture>>& ref_pictures,
|
| const base::Closure& done_cb) override;
|
|
|
| - bool OutputPicture(const scoped_refptr<VP9Picture>& pic) override;
|
| + bool OutputPicture(const scoped_refptr<VP9Picture>& pic,
|
| + const gfx::Rect& visible_rect) override;
|
|
|
| bool IsFrameContextRequired() const override { return false; }
|
|
|
| @@ -409,6 +418,7 @@ bool VaapiVideoDecodeAccelerator::Initialize(const Config& config,
|
| void VaapiVideoDecodeAccelerator::OutputPicture(
|
| const scoped_refptr<VASurface>& va_surface,
|
| int32_t input_id,
|
| + gfx::Rect visible_rect,
|
| VaapiPicture* picture) {
|
| DCHECK(task_runner_->BelongsToCurrentThread());
|
|
|
| @@ -427,14 +437,12 @@ void VaapiVideoDecodeAccelerator::OutputPicture(
|
| // Notify the client a picture is ready to be displayed.
|
| ++num_frames_at_client_;
|
| 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). Passing (0, 0) results in the client using the
|
| - // visible size extracted from the container instead.
|
| + DVLOG(4) << "Notifying output picture id " << output_id << " for input "
|
| + << input_id
|
| + << " is ready. visible rect: " << visible_rect.ToString();
|
| // TODO(hubbe): Use the correct color space. http://crbug.com/647725
|
| if (client_)
|
| - client_->PictureReady(Picture(output_id, input_id, gfx::Rect(0, 0),
|
| + client_->PictureReady(Picture(output_id, input_id, visible_rect,
|
| gfx::ColorSpace(), picture->AllowOverlay()));
|
| }
|
|
|
| @@ -1143,7 +1151,8 @@ void VaapiVideoDecodeAccelerator::SurfaceReady(
|
|
|
| pending_output_cbs_.push(
|
| base::Bind(&VaapiVideoDecodeAccelerator::OutputPicture, weak_this_,
|
| - dec_surface->va_surface(), dec_surface->bitstream_id()));
|
| + dec_surface->va_surface(), dec_surface->bitstream_id(),
|
| + dec_surface->visible_rect()));
|
|
|
| TryOutputSurface();
|
| }
|
| @@ -1423,10 +1432,11 @@ bool VaapiVideoDecodeAccelerator::VaapiH264Accelerator::SubmitDecode(
|
| }
|
|
|
| bool VaapiVideoDecodeAccelerator::VaapiH264Accelerator::OutputPicture(
|
| - const scoped_refptr<H264Picture>& pic) {
|
| + const scoped_refptr<H264Picture>& pic,
|
| + const gfx::Rect& visible_rect) {
|
| scoped_refptr<VaapiDecodeSurface> dec_surface =
|
| H264PictureToVaapiDecodeSurface(pic);
|
| -
|
| + dec_surface->SetVisibleRect(visible_rect);
|
| vaapi_dec_->SurfaceReady(dec_surface);
|
|
|
| return true;
|
| @@ -1710,10 +1720,11 @@ bool VaapiVideoDecodeAccelerator::VaapiVP8Accelerator::SubmitDecode(
|
| }
|
|
|
| bool VaapiVideoDecodeAccelerator::VaapiVP8Accelerator::OutputPicture(
|
| - const scoped_refptr<VP8Picture>& pic) {
|
| + const scoped_refptr<VP8Picture>& pic,
|
| + const gfx::Rect& visible_rect) {
|
| scoped_refptr<VaapiDecodeSurface> dec_surface =
|
| VP8PictureToVaapiDecodeSurface(pic);
|
| -
|
| + dec_surface->SetVisibleRect(visible_rect);
|
| vaapi_dec_->SurfaceReady(dec_surface);
|
| return true;
|
| }
|
| @@ -1874,10 +1885,11 @@ bool VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::SubmitDecode(
|
| }
|
|
|
| bool VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::OutputPicture(
|
| - const scoped_refptr<VP9Picture>& pic) {
|
| + const scoped_refptr<VP9Picture>& pic,
|
| + const gfx::Rect& visible_rect) {
|
| scoped_refptr<VaapiDecodeSurface> dec_surface =
|
| VP9PictureToVaapiDecodeSurface(pic);
|
| -
|
| + dec_surface->SetVisibleRect(visible_rect);
|
| vaapi_dec_->SurfaceReady(dec_surface);
|
| return true;
|
| }
|
|
|