Index: media/gpu/dxva_video_decode_accelerator_win.cc |
diff --git a/media/gpu/dxva_video_decode_accelerator_win.cc b/media/gpu/dxva_video_decode_accelerator_win.cc |
index 5f730e80d3eb6b5b3283a39b97254d6afdef1398..db29461c604af67d2f4bdcead0228c835b418793 100644 |
--- a/media/gpu/dxva_video_decode_accelerator_win.cc |
+++ b/media/gpu/dxva_video_decode_accelerator_win.cc |
@@ -458,6 +458,19 @@ bool H264ConfigChangeDetector::DetectConfig(const uint8_t* stream, |
return true; |
} |
+gfx::ColorSpace H264ConfigChangeDetector::current_color_space() const { |
+ // TODO(hubbe): Is using last_sps_id_ correct here? |
+ const H264SPS* sps = parser_->GetSPS(last_sps_id_); |
+ if (sps) { |
+ return gfx::ColorSpace( |
+ static_cast<gfx::ColorSpace::PrimaryID>(sps->primary_idc), |
+ static_cast<gfx::ColorSpace::TransferID>(sps->transfer_idc), |
+ static_cast<gfx::ColorSpace::MatrixID>(sps->matrix_idc), |
+ sps->full_range ? gfx::ColorSpace::RangeID::FULL |
+ : gfx::ColorSpace::RangeID::LIMITED); |
+ } |
+ return gfx::ColorSpace(); |
+} |
DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo( |
int32_t buffer_id, |
@@ -1893,9 +1906,17 @@ void DXVAVideoDecodeAccelerator::NotifyPictureReady(int picture_buffer_id, |
DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
// This task could execute after the decoder has been torn down. |
if (GetState() != kUninitialized && client_) { |
+ gfx::ColorSpace color_space; |
+ if (share_nv12_textures_ || copy_nv12_textures_) { |
+ // Color space information is only valid for NV12 textures. |
+ // If the texture has been converted to RGB, we don't actually know what |
+ // Color space the output is in. |
+ color_space = config_change_detector_->current_color_space(); |
+ } |
// TODO(henryhsu): Use correct visible size instead of (0, 0). We can't use |
// coded size here so use (0, 0) intentionally to have the client choose. |
- Picture picture(picture_buffer_id, input_buffer_id, gfx::Rect(0, 0), false); |
+ Picture picture(picture_buffer_id, input_buffer_id, gfx::Rect(0, 0), |
+ color_space, false); |
client_->PictureReady(picture); |
} |
} |