Chromium Code Reviews| 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(); | |
|
jrummell
2013/06/12 22:05:53
This is also needed for EAC3 playback, if configur
Tom Finegan
2013/06/12 23:17:48
Fixed, though slightly reworked the checks because
| |
| 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 !cmd_line->HasSwitch(switches::kEnableEac3Playback)) { |
| 209 return false; | 208 return false; |
| 210 } | 209 } |
| 211 #endif | 210 #endif |
| 212 if (audio_codecs) | 211 if (audio_codecs) |
| 213 audio_codecs->push_back(codec_info->tag); | 212 audio_codecs->push_back(codec_info->tag); |
| 214 return true; | 213 return true; |
| 215 case CodecInfo::VIDEO: | 214 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) | 215 if (video_codecs) |
| 223 video_codecs->push_back(codec_info->tag); | 216 video_codecs->push_back(codec_info->tag); |
| 224 return true; | 217 return true; |
| 225 default: | 218 default: |
| 226 // Not audio or video, so skip it. | 219 // Not audio or video, so skip it. |
| 227 DVLOG(1) << "CodecInfo type of " << codec_info->type | 220 DVLOG(1) << "CodecInfo type of " << codec_info->type |
| 228 << " should not be specified in a SupportedTypes list"; | 221 << " should not be specified in a SupportedTypes list"; |
| 229 return false; | 222 return false; |
| 230 } | 223 } |
| 231 } | 224 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 "Media.MSE.VideoCodec", video_codecs[i], CodecInfo::HISTOGRAM_MAX); | 322 "Media.MSE.VideoCodec", video_codecs[i], CodecInfo::HISTOGRAM_MAX); |
| 330 } | 323 } |
| 331 | 324 |
| 332 stream_parser.reset(factory_function(codecs, log_cb)); | 325 stream_parser.reset(factory_function(codecs, log_cb)); |
| 333 } | 326 } |
| 334 | 327 |
| 335 return stream_parser.Pass(); | 328 return stream_parser.Pass(); |
| 336 } | 329 } |
| 337 | 330 |
| 338 } // namespace media | 331 } // namespace media |
| OLD | NEW |