| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/filters/ffmpeg_video_decoder.h" | 5 #include "media/filters/ffmpeg_video_decoder.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 RoundUp(std::max(size.width(), codec_context->coded_width), 2), | 120 RoundUp(std::max(size.width(), codec_context->coded_width), 2), |
| 121 RoundUp(std::max(size.height(), codec_context->coded_height), 2)); | 121 RoundUp(std::max(size.height(), codec_context->coded_height), 2)); |
| 122 | 122 |
| 123 if (!VideoFrame::IsValidConfig(format, VideoFrame::STORAGE_UNKNOWN, | 123 if (!VideoFrame::IsValidConfig(format, VideoFrame::STORAGE_UNKNOWN, |
| 124 coded_size, gfx::Rect(size), natural_size)) { | 124 coded_size, gfx::Rect(size), natural_size)) { |
| 125 return AVERROR(EINVAL); | 125 return AVERROR(EINVAL); |
| 126 } | 126 } |
| 127 | 127 |
| 128 scoped_refptr<VideoFrame> video_frame = frame_pool_.CreateFrame( | 128 scoped_refptr<VideoFrame> video_frame = frame_pool_.CreateFrame( |
| 129 format, coded_size, gfx::Rect(size), natural_size, kNoTimestamp()); | 129 format, coded_size, gfx::Rect(size), natural_size, kNoTimestamp()); |
| 130 #if defined(MEMORY_SANITIZER) |
| 131 MSAN_UNPOISON(video_frame->data(0), |
| 132 VideoFrame::AllocationSize(format, coded_size)); |
| 133 #endif |
| 130 | 134 |
| 131 // Prefer the color space from the codec context. If it's not specified (or is | 135 // Prefer the color space from the codec context. If it's not specified (or is |
| 132 // set to an unsupported value), fall back on the value from the config. | 136 // set to an unsupported value), fall back on the value from the config. |
| 133 ColorSpace color_space = AVColorSpaceToColorSpace(codec_context->colorspace); | 137 ColorSpace color_space = AVColorSpaceToColorSpace(codec_context->colorspace); |
| 134 if (color_space == COLOR_SPACE_UNSPECIFIED) | 138 if (color_space == COLOR_SPACE_UNSPECIFIED) |
| 135 color_space = config_.color_space(); | 139 color_space = config_.color_space(); |
| 136 video_frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE, | 140 video_frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE, |
| 137 color_space); | 141 color_space); |
| 138 | 142 |
| 139 for (int i = 0; i < 3; i++) { | 143 for (int i = 0; i < 3; i++) { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { | 361 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { |
| 358 ReleaseFFmpegResources(); | 362 ReleaseFFmpegResources(); |
| 359 return false; | 363 return false; |
| 360 } | 364 } |
| 361 | 365 |
| 362 av_frame_.reset(av_frame_alloc()); | 366 av_frame_.reset(av_frame_alloc()); |
| 363 return true; | 367 return true; |
| 364 } | 368 } |
| 365 | 369 |
| 366 } // namespace media | 370 } // namespace media |
| OLD | NEW |