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); |