Commit 3f6687dc authored by Fredrik Hubinette's avatar Fredrik Hubinette Committed by Commit Bot

Propagate H264 color spaces to video frames on chromeos

Also makes some preparations for doing the same for VP9.

Bug: 647725, 847573
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Id263a35b9f53be062ebae54d05c603a3efb270e8
Reviewed-on: https://chromium-review.googlesource.com/1153840
Commit-Queue: Fredrik Hubinette <hubbe@chromium.org>
Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586324}
parent f2367049
......@@ -307,7 +307,8 @@ bool VaapiH264Accelerator::OutputPicture(
const VaapiH264Picture* vaapi_pic = pic->AsVaapiH264Picture();
vaapi_dec_->VASurfaceReady(vaapi_pic->va_surface(), vaapi_pic->bitstream_id(),
vaapi_pic->visible_rect());
vaapi_pic->visible_rect(),
vaapi_pic->get_colorspace());
return true;
}
......
......@@ -198,7 +198,8 @@ bool VaapiVideoDecodeAccelerator::Initialize(const Config& config,
if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) {
decoder_.reset(new H264Decoder(
std::make_unique<VaapiH264Accelerator>(this, vaapi_wrapper_)));
std::make_unique<VaapiH264Accelerator>(this, vaapi_wrapper_),
config.container_color_space));
} else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) {
decoder_.reset(new VP8Decoder(
std::make_unique<VaapiVP8Accelerator>(this, vaapi_wrapper_)));
......@@ -222,7 +223,8 @@ bool VaapiVideoDecodeAccelerator::Initialize(const Config& config,
void VaapiVideoDecodeAccelerator::OutputPicture(
const scoped_refptr<VASurface>& va_surface,
int32_t input_id,
gfx::Rect visible_rect) {
gfx::Rect visible_rect,
const VideoColorSpace& picture_color_space) {
DCHECK(task_runner_->BelongsToCurrentThread());
const VASurfaceID va_surface_id = va_surface->id();
......@@ -265,9 +267,9 @@ void VaapiVideoDecodeAccelerator::OutputPicture(
<< input_id
<< " is ready. visible rect: " << visible_rect.ToString();
if (client_) {
// TODO(hubbe): Use the correct color space. http://crbug.com/647725
client_->PictureReady(Picture(output_id, input_id, visible_rect,
gfx::ColorSpace(), picture->AllowOverlay()));
picture_color_space.ToGfxColorSpace(),
picture->AllowOverlay()));
}
}
......@@ -916,12 +918,13 @@ bool VaapiVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread(
void VaapiVideoDecodeAccelerator::VASurfaceReady(
const scoped_refptr<VASurface>& va_surface,
int32_t bitstream_id,
const gfx::Rect& visible_rect) {
const gfx::Rect& visible_rect,
const VideoColorSpace& color_space) {
if (!task_runner_->BelongsToCurrentThread()) {
task_runner_->PostTask(
FROM_HERE,
base::Bind(&VaapiVideoDecodeAccelerator::VASurfaceReady, weak_this_,
va_surface, bitstream_id, visible_rect));
va_surface, bitstream_id, visible_rect, color_space));
return;
}
......@@ -936,7 +939,7 @@ void VaapiVideoDecodeAccelerator::VASurfaceReady(
pending_output_cbs_.push(
base::Bind(&VaapiVideoDecodeAccelerator::OutputPicture, weak_this_,
va_surface, bitstream_id, visible_rect));
va_surface, bitstream_id, visible_rect, color_space));
TryOutputPicture();
}
......
......@@ -94,7 +94,8 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeAccelerator
// in order, and run each command only if its dependencies are ready.
void VASurfaceReady(const scoped_refptr<VASurface>& va_surface,
int32_t bitstream_id,
const gfx::Rect& visible_rect);
const gfx::Rect& visible_rect,
const VideoColorSpace& color_space);
// Returns a new VASurface for decoding into, or nullptr if not available.
scoped_refptr<VASurface> CreateVASurface();
......@@ -165,7 +166,8 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeAccelerator
// the resulting picture to |client_| along with |visible_rect|.
void OutputPicture(const scoped_refptr<VASurface>& va_surface,
int32_t input_id,
gfx::Rect visible_rect);
gfx::Rect visible_rect,
const VideoColorSpace& picture_color_space);
// Try to OutputPicture() if we have both a ready surface and picture.
void TryOutputPicture();
......
......@@ -230,7 +230,8 @@ bool VaapiVP8Accelerator::OutputPicture(const scoped_refptr<VP8Picture>& pic) {
const VaapiVP8Picture* vaapi_pic = pic->AsVaapiVP8Picture();
vaapi_dec_->VASurfaceReady(vaapi_pic->va_surface(), vaapi_pic->bitstream_id(),
vaapi_pic->visible_rect());
vaapi_pic->visible_rect(),
vaapi_pic->get_colorspace());
return true;
}
......
......@@ -167,7 +167,8 @@ bool VaapiVP9Accelerator::OutputPicture(const scoped_refptr<VP9Picture>& pic) {
const VaapiVP9Picture* vaapi_pic = pic->AsVaapiVP9Picture();
vaapi_dec_->VASurfaceReady(vaapi_pic->va_surface(), vaapi_pic->bitstream_id(),
vaapi_pic->visible_rect());
vaapi_pic->visible_rect(),
vaapi_pic->get_colorspace());
return true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment