| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } | 456 } |
| 457 | 457 |
| 458 bool StreamParserFactory::IsTypeSupported( | 458 bool StreamParserFactory::IsTypeSupported( |
| 459 const std::string& type, const std::vector<std::string>& codecs) { | 459 const std::string& type, const std::vector<std::string>& codecs) { |
| 460 return CheckTypeAndCodecs(type, codecs, new MediaLog(), NULL, NULL, NULL); | 460 return CheckTypeAndCodecs(type, codecs, new MediaLog(), NULL, NULL, NULL); |
| 461 } | 461 } |
| 462 | 462 |
| 463 std::unique_ptr<StreamParser> StreamParserFactory::Create( | 463 std::unique_ptr<StreamParser> StreamParserFactory::Create( |
| 464 const std::string& type, | 464 const std::string& type, |
| 465 const std::vector<std::string>& codecs, | 465 const std::vector<std::string>& codecs, |
| 466 const scoped_refptr<MediaLog>& media_log, | 466 const scoped_refptr<MediaLog>& media_log) { |
| 467 bool* has_audio, | |
| 468 bool* has_video) { | |
| 469 std::unique_ptr<StreamParser> stream_parser; | 467 std::unique_ptr<StreamParser> stream_parser; |
| 470 ParserFactoryFunction factory_function; | 468 ParserFactoryFunction factory_function; |
| 471 std::vector<CodecInfo::HistogramTag> audio_codecs; | 469 std::vector<CodecInfo::HistogramTag> audio_codecs; |
| 472 std::vector<CodecInfo::HistogramTag> video_codecs; | 470 std::vector<CodecInfo::HistogramTag> video_codecs; |
| 473 *has_audio = false; | |
| 474 *has_video = false; | |
| 475 | 471 |
| 476 if (CheckTypeAndCodecs(type, codecs, media_log, &factory_function, | 472 if (CheckTypeAndCodecs(type, codecs, media_log, &factory_function, |
| 477 &audio_codecs, &video_codecs)) { | 473 &audio_codecs, &video_codecs)) { |
| 478 *has_audio = !audio_codecs.empty(); | |
| 479 *has_video = !video_codecs.empty(); | |
| 480 | |
| 481 // Log the number of codecs specified, as well as the details on each one. | 474 // Log the number of codecs specified, as well as the details on each one. |
| 482 UMA_HISTOGRAM_COUNTS_100("Media.MSE.NumberOfTracks", codecs.size()); | 475 UMA_HISTOGRAM_COUNTS_100("Media.MSE.NumberOfTracks", codecs.size()); |
| 483 for (size_t i = 0; i < audio_codecs.size(); ++i) { | 476 for (size_t i = 0; i < audio_codecs.size(); ++i) { |
| 484 UMA_HISTOGRAM_ENUMERATION("Media.MSE.AudioCodec", | 477 UMA_HISTOGRAM_ENUMERATION("Media.MSE.AudioCodec", |
| 485 audio_codecs[i], | 478 audio_codecs[i], |
| 486 CodecInfo::HISTOGRAM_MAX + 1); | 479 CodecInfo::HISTOGRAM_MAX + 1); |
| 487 } | 480 } |
| 488 for (size_t i = 0; i < video_codecs.size(); ++i) { | 481 for (size_t i = 0; i < video_codecs.size(); ++i) { |
| 489 UMA_HISTOGRAM_ENUMERATION("Media.MSE.VideoCodec", | 482 UMA_HISTOGRAM_ENUMERATION("Media.MSE.VideoCodec", |
| 490 video_codecs[i], | 483 video_codecs[i], |
| 491 CodecInfo::HISTOGRAM_MAX + 1); | 484 CodecInfo::HISTOGRAM_MAX + 1); |
| 492 } | 485 } |
| 493 | 486 |
| 494 stream_parser.reset(factory_function(codecs, media_log)); | 487 stream_parser.reset(factory_function(codecs, media_log)); |
| 495 } | 488 } |
| 496 | 489 |
| 497 return stream_parser; | 490 return stream_parser; |
| 498 } | 491 } |
| 499 | 492 |
| 500 } // namespace media | 493 } // namespace media |
| OLD | NEW |