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

Unified Diff: media/filters/ffmpeg_video_decoder.cc

Issue 1221903003: Change the video color space default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 fdf8dc5841a8085c4831026dd693b6fe3e994acf..2c604f8226b9570428e950a8d9643de18f78ed96 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -127,10 +127,15 @@ 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,
- VideoFrame::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.
+ VideoFrame::ColorSpace color_space =
+ AVColorSpaceToVideoFrameColorSpace(codec_context->colorspace);
+ if (color_space == VideoFrame::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