OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/stream_parser_factory.h" | 5 #include "media/filters/stream_parser_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // |audio_codecs| has |codec_info|.tag added to its list if |codec_info| is an | 193 // |audio_codecs| has |codec_info|.tag added to its list if |codec_info| is an |
194 // audio codec. |audio_codecs| may be NULL, in which case it is not updated. | 194 // audio codec. |audio_codecs| may be NULL, in which case it is not updated. |
195 // |video_codecs| has |codec_info|.tag added to its list if |codec_info| is a | 195 // |video_codecs| has |codec_info|.tag added to its list if |codec_info| is a |
196 // video codec. |video_codecs| may be NULL, in which case it is not updated. | 196 // video codec. |video_codecs| may be NULL, in which case it is not updated. |
197 // | 197 // |
198 // Returns false otherwise, and |audio_codecs| and |video_codecs| not touched. | 198 // Returns false otherwise, and |audio_codecs| and |video_codecs| not touched. |
199 static bool VerifyCodec( | 199 static bool VerifyCodec( |
200 const CodecInfo* codec_info, | 200 const CodecInfo* codec_info, |
201 std::vector<CodecInfo::HistogramTag>* audio_codecs, | 201 std::vector<CodecInfo::HistogramTag>* audio_codecs, |
202 std::vector<CodecInfo::HistogramTag>* video_codecs) { | 202 std::vector<CodecInfo::HistogramTag>* video_codecs) { |
203 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | |
204 switch (codec_info->type) { | 203 switch (codec_info->type) { |
205 case CodecInfo::AUDIO: | 204 case CodecInfo::AUDIO: |
206 #if defined(ENABLE_EAC3_PLAYBACK) | 205 #if defined(ENABLE_EAC3_PLAYBACK) |
207 if (codec_info->tag == CodecInfo::HISTOGRAM_EAC3 && | 206 if (codec_info->tag == CodecInfo::HISTOGRAM_EAC3) { |
208 !cmd_line->HasSwitch(switches::kEnableEac3Playback)) { | 207 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
209 return false; | 208 if (!cmd_line->HasSwitch(switches::kEnableEac3Playback)) |
| 209 return false; |
210 } | 210 } |
211 #endif | 211 #endif |
212 if (audio_codecs) | 212 if (audio_codecs) |
213 audio_codecs->push_back(codec_info->tag); | 213 audio_codecs->push_back(codec_info->tag); |
214 return true; | 214 return true; |
215 case CodecInfo::VIDEO: | 215 case CodecInfo::VIDEO: |
216 // TODO(tomfinegan): Remove this check (or negate it, if we just | |
217 // negate the flag) when VP9 is enabled by default. | |
218 if (codec_info->tag == CodecInfo::HISTOGRAM_VP9 && | |
219 !cmd_line->HasSwitch(switches::kEnableVp9Playback)) { | |
220 return false; | |
221 } | |
222 if (video_codecs) | 216 if (video_codecs) |
223 video_codecs->push_back(codec_info->tag); | 217 video_codecs->push_back(codec_info->tag); |
224 return true; | 218 return true; |
225 default: | 219 default: |
226 // Not audio or video, so skip it. | 220 // Not audio or video, so skip it. |
227 DVLOG(1) << "CodecInfo type of " << codec_info->type | 221 DVLOG(1) << "CodecInfo type of " << codec_info->type |
228 << " should not be specified in a SupportedTypes list"; | 222 << " should not be specified in a SupportedTypes list"; |
229 return false; | 223 return false; |
230 } | 224 } |
231 } | 225 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 "Media.MSE.VideoCodec", video_codecs[i], CodecInfo::HISTOGRAM_MAX); | 323 "Media.MSE.VideoCodec", video_codecs[i], CodecInfo::HISTOGRAM_MAX); |
330 } | 324 } |
331 | 325 |
332 stream_parser.reset(factory_function(codecs, log_cb)); | 326 stream_parser.reset(factory_function(codecs, log_cb)); |
333 } | 327 } |
334 | 328 |
335 return stream_parser.Pass(); | 329 return stream_parser.Pass(); |
336 } | 330 } |
337 | 331 |
338 } // namespace media | 332 } // namespace media |
OLD | NEW |