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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 return new WebMStreamParser(); | 98 return new WebMStreamParser(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 #if defined(USE_PROPRIETARY_CODECS) | 101 #if defined(USE_PROPRIETARY_CODECS) |
| 102 // AAC Object Type IDs that Chrome supports. | 102 // AAC Object Type IDs that Chrome supports. |
| 103 static const int kAACLCObjectType = 2; | 103 static const int kAACLCObjectType = 2; |
| 104 static const int kAACSBRObjectType = 5; | 104 static const int kAACSBRObjectType = 5; |
| 105 | 105 |
| 106 static int GetMP4AudioObjectType(const std::string& codec_id, | 106 static int GetMP4AudioObjectType(const std::string& codec_id, |
| 107 const LogCB& log_cb) { | 107 const LogCB& log_cb) { |
| 108 int audio_object_type; | |
| 109 std::vector<std::string> tokens; | 108 std::vector<std::string> tokens; |
| 110 if (Tokenize(codec_id, ".", &tokens) != 3 || | 109 if (Tokenize(codec_id, ".", &tokens) == 3 && |
| 111 tokens[0] != "mp4a" || tokens[1] != "40" || | 110 tokens[0] != "mp4a" || tokens[1] == "40") { |
|
DaleCurtis
2014/07/26 01:06:38
== mp4a?
Will Harris
2014/07/26 01:15:54
Done.
| |
| 112 !base::HexStringToInt(tokens[2], &audio_object_type)) { | 111 int audio_object_type; |
|
Peter Kasting
2014/07/26 01:01:36
This works too, but I was suggesting leaving this
Will Harris
2014/07/26 01:15:53
Wow MSVC is crazy - it didn't like it when I made
| |
| 113 MEDIA_LOG(log_cb) << "Malformed mimetype codec '" << codec_id << "'"; | 112 if (base::HexStringToInt(tokens[2], &audio_object_type)) { |
|
Peter Kasting
2014/07/26 01:01:36
Nit: No {}
Will Harris
2014/07/26 01:15:54
Done.
| |
| 114 return -1; | 113 return audio_object_type; |
| 114 } | |
| 115 } | 115 } |
| 116 | 116 |
| 117 | 117 MEDIA_LOG(log_cb) << "Malformed mimetype codec '" << codec_id << "'"; |
| 118 return audio_object_type; | 118 return -1; |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool ValidateMP4ACodecID(const std::string& codec_id, const LogCB& log_cb) { | 121 bool ValidateMP4ACodecID(const std::string& codec_id, const LogCB& log_cb) { |
| 122 int audio_object_type = GetMP4AudioObjectType(codec_id, log_cb); | 122 int audio_object_type = GetMP4AudioObjectType(codec_id, log_cb); |
| 123 if (audio_object_type == kAACLCObjectType || | 123 if (audio_object_type == kAACLCObjectType || |
| 124 audio_object_type == kAACSBRObjectType) { | 124 audio_object_type == kAACSBRObjectType) { |
| 125 return true; | 125 return true; |
| 126 } | 126 } |
| 127 | 127 |
| 128 MEDIA_LOG(log_cb) << "Unsupported audio object type " | 128 MEDIA_LOG(log_cb) << "Unsupported audio object type " |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 CodecInfo::HISTOGRAM_MAX + 1); | 406 CodecInfo::HISTOGRAM_MAX + 1); |
| 407 } | 407 } |
| 408 | 408 |
| 409 stream_parser.reset(factory_function(codecs, log_cb)); | 409 stream_parser.reset(factory_function(codecs, log_cb)); |
| 410 } | 410 } |
| 411 | 411 |
| 412 return stream_parser.Pass(); | 412 return stream_parser.Pass(); |
| 413 } | 413 } |
| 414 | 414 |
| 415 } // namespace media | 415 } // namespace media |
| OLD | NEW |