OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/video_decoder_config.h" | 5 #include "media/base/video_decoder_config.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "media/base/limits.h" |
10 | 11 |
11 namespace media { | 12 namespace media { |
12 | 13 |
13 VideoDecoderConfig::VideoDecoderConfig() | 14 VideoDecoderConfig::VideoDecoderConfig() |
14 : codec_(kUnknownVideoCodec), | 15 : codec_(kUnknownVideoCodec), |
15 format_(VideoFrame::INVALID), | 16 format_(VideoFrame::INVALID), |
16 frame_rate_numerator_(0), | 17 frame_rate_numerator_(0), |
17 frame_rate_denominator_(0), | 18 frame_rate_denominator_(0), |
18 aspect_ratio_numerator_(0), | 19 aspect_ratio_numerator_(0), |
19 aspect_ratio_denominator_(0), | 20 aspect_ratio_denominator_(0), |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // expected by WebKit layout tests. | 84 // expected by WebKit layout tests. |
84 natural_size_.SetSize(width & ~1, height); | 85 natural_size_.SetSize(width & ~1, height); |
85 } | 86 } |
86 | 87 |
87 bool VideoDecoderConfig::IsValidConfig() const { | 88 bool VideoDecoderConfig::IsValidConfig() const { |
88 return codec_ != kUnknownVideoCodec && | 89 return codec_ != kUnknownVideoCodec && |
89 format_ != VideoFrame::INVALID && | 90 format_ != VideoFrame::INVALID && |
90 frame_rate_numerator_ > 0 && | 91 frame_rate_numerator_ > 0 && |
91 frame_rate_denominator_ > 0 && | 92 frame_rate_denominator_ > 0 && |
92 aspect_ratio_numerator_ > 0 && | 93 aspect_ratio_numerator_ > 0 && |
93 aspect_ratio_denominator_ > 0; | 94 aspect_ratio_denominator_ > 0 && |
| 95 natural_size_.width() <= Limits::kMaxDimension && |
| 96 natural_size_.height() <= Limits::kMaxDimension && |
| 97 natural_size_.GetArea() <= Limits::kMaxCanvas; |
94 } | 98 } |
95 | 99 |
96 VideoCodec VideoDecoderConfig::codec() const { | 100 VideoCodec VideoDecoderConfig::codec() const { |
97 return codec_; | 101 return codec_; |
98 } | 102 } |
99 | 103 |
100 VideoFrame::Format VideoDecoderConfig::format() const { | 104 VideoFrame::Format VideoDecoderConfig::format() const { |
101 return format_; | 105 return format_; |
102 } | 106 } |
103 | 107 |
(...skipping 27 matching lines...) Expand all Loading... |
131 | 135 |
132 uint8* VideoDecoderConfig::extra_data() const { | 136 uint8* VideoDecoderConfig::extra_data() const { |
133 return extra_data_.get(); | 137 return extra_data_.get(); |
134 } | 138 } |
135 | 139 |
136 size_t VideoDecoderConfig::extra_data_size() const { | 140 size_t VideoDecoderConfig::extra_data_size() const { |
137 return extra_data_size_; | 141 return extra_data_size_; |
138 } | 142 } |
139 | 143 |
140 } // namespace media | 144 } // namespace media |
OLD | NEW |