Chromium Code Reviews| Index: media/filters/ffmpeg_video_decoder.cc |
| diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc |
| index b2915a0308a17e15451b409fea91194314e89928..0eca8e875c9a1a1cc299935ea5fc2a779bfa6d00 100644 |
| --- a/media/filters/ffmpeg_video_decoder.cc |
| +++ b/media/filters/ffmpeg_video_decoder.cc |
| @@ -141,6 +141,18 @@ int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context, |
| video_frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE, |
| color_space); |
| + if (codec_context->color_primaries != AVCOL_PRI_UNSPECIFIED || |
| + codec_context->color_trc != AVCOL_TRC_UNSPECIFIED || |
| + codec_context->colorspace != AVCOL_SPC_UNSPECIFIED) { |
| + video_frame->set_color_space(gfx::ColorSpace( |
| + static_cast<gfx::ColorSpace::PrimaryID>(codec_context->color_primaries), |
|
DaleCurtis
2016/08/16 18:58:03
Hmm, are you static_assert'ing that these values a
hubbe
2016/08/16 19:24:57
Added a test for it.
The are standardized in h264
|
| + static_cast<gfx::ColorSpace::TransferID>(codec_context->color_trc), |
| + static_cast<gfx::ColorSpace::MatrixID>(codec_context->colorspace), |
| + codec_context->color_range != AVCOL_RANGE_MPEG |
| + ? gfx::ColorSpace::RangeID::FULL |
| + : gfx::ColorSpace::RangeID::LIMITED)); |
| + } |
| + |
| for (size_t i = 0; i < VideoFrame::NumPlanes(video_frame->format()); i++) { |
| frame->data[i] = video_frame->data(i); |
| frame->linesize[i] = video_frame->stride(i); |