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

Unified Diff: media/filters/ffmpeg_video_decoder.cc

Issue 1230593005: Reland: Change the video color space default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: big rebase Created 5 years, 5 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
« no previous file with comments | « media/filters/decrypting_demuxer_stream.cc ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_video_decoder.cc
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
index b3121d3140d6040ee34eaace62f048d88aa3b0bd..30b822c70d66ce84140f40709a6cc51cdb7df4aa 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -127,10 +127,14 @@ int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context,
scoped_refptr<VideoFrame> video_frame = frame_pool_.CreateFrame(
format, coded_size, gfx::Rect(size), natural_size, kNoTimestamp());
- if (codec_context->colorspace == AVCOL_SPC_BT709) {
- video_frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE,
- COLOR_SPACE_HD_REC709);
- }
+
+ // Prefer the color space from the codec context. If it's not specified (or is
+ // set to an unsupported value), fall back on the value from the config.
+ ColorSpace color_space = AVColorSpaceToColorSpace(codec_context->colorspace);
+ if (color_space == COLOR_SPACE_UNSPECIFIED)
+ color_space = config_.color_space();
+ video_frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE,
+ color_space);
for (int i = 0; i < 3; i++) {
frame->data[i] = video_frame->data(i);
« no previous file with comments | « media/filters/decrypting_demuxer_stream.cc ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698