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

Side by Side Diff: media/filters/ffmpeg_video_decoder.cc

Issue 2158923004: Convert media constants to constexpr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 std::max(size.height(), codec_context->coded_height)); 123 std::max(size.height(), codec_context->coded_height));
124 124
125 if (!VideoFrame::IsValidConfig(format, VideoFrame::STORAGE_UNKNOWN, 125 if (!VideoFrame::IsValidConfig(format, VideoFrame::STORAGE_UNKNOWN,
126 coded_size, gfx::Rect(size), natural_size)) { 126 coded_size, gfx::Rect(size), natural_size)) {
127 return AVERROR(EINVAL); 127 return AVERROR(EINVAL);
128 } 128 }
129 129
130 // FFmpeg expects the initialize allocation to be zero-initialized. Failure 130 // FFmpeg expects the initialize allocation to be zero-initialized. Failure
131 // to do so can lead to unitialized value usage. See http://crbug.com/390941 131 // to do so can lead to unitialized value usage. See http://crbug.com/390941
132 scoped_refptr<VideoFrame> video_frame = frame_pool_.CreateFrame( 132 scoped_refptr<VideoFrame> video_frame = frame_pool_.CreateFrame(
133 format, coded_size, gfx::Rect(size), natural_size, kNoTimestamp()); 133 format, coded_size, gfx::Rect(size), natural_size, kNoTimestamp);
134 134
135 // 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
136 // 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.
137 ColorSpace color_space = AVColorSpaceToColorSpace(codec_context->colorspace, 137 ColorSpace color_space = AVColorSpaceToColorSpace(codec_context->colorspace,
138 codec_context->color_range); 138 codec_context->color_range);
139 if (color_space == COLOR_SPACE_UNSPECIFIED) 139 if (color_space == COLOR_SPACE_UNSPECIFIED)
140 color_space = config_.color_space(); 140 color_space = config_.color_space();
141 video_frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE, 141 video_frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE,
142 color_space); 142 color_space);
143 143
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { 374 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
375 ReleaseFFmpegResources(); 375 ReleaseFFmpegResources();
376 return false; 376 return false;
377 } 377 }
378 378
379 av_frame_.reset(av_frame_alloc()); 379 av_frame_.reset(av_frame_alloc());
380 return true; 380 return true;
381 } 381 }
382 382
383 } // namespace media 383 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698