Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: media/gpu/dxva_video_decode_accelerator_win.cc

Issue 2345123002: Attach color space information to hardware decoded NV12 video frames. (Closed)
Patch Set: comments addressed + compile fixes Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e4da60cd648d674ad8b3502ce655f26eda1e9169 100644
--- a/media/gpu/dxva_video_decode_accelerator_win.cc
+++ b/media/gpu/dxva_video_decode_accelerator_win.cc
@@ -458,6 +458,13 @@ 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?
sandersd (OOO until July 31) 2016/09/16 21:54:13 There could be a gap between the ID changing and t
hubbe 2016/09/21 22:04:26 Updated the code to handle this (more) correctly.
+ const H264SPS* sps = parser_->GetSPS(last_sps_id_);
+ if (sps)
+ return sps->GetColorSpace();
+ return gfx::ColorSpace();
+}
DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo(
int32_t buffer_id,
@@ -1893,9 +1900,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);
}
}

Powered by Google App Engine
This is Rietveld 408576698