| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/renderer/media/recorder/media_recorder_handler.h" | 5 #include "content/renderer/media/recorder/media_recorder_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // vp8, vp9, h264 and avc1 or opus; |type| = "audio", supports only opus. | 91 // vp8, vp9, h264 and avc1 or opus; |type| = "audio", supports only opus. |
| 92 // http://www.webmproject.org/docs/container Sec:"HTML5 Video Type Parameters" | 92 // http://www.webmproject.org/docs/container Sec:"HTML5 Video Type Parameters" |
| 93 static const char* const kVideoCodecs[] = {"vp8", "vp9", "h264", "avc1", | 93 static const char* const kVideoCodecs[] = {"vp8", "vp9", "h264", "avc1", |
| 94 "opus"}; | 94 "opus"}; |
| 95 static const char* const kAudioCodecs[] = { "opus" }; | 95 static const char* const kAudioCodecs[] = { "opus" }; |
| 96 const char* const* codecs = video ? &kVideoCodecs[0] : &kAudioCodecs[0]; | 96 const char* const* codecs = video ? &kVideoCodecs[0] : &kAudioCodecs[0]; |
| 97 const int codecs_count = | 97 const int codecs_count = |
| 98 video ? arraysize(kVideoCodecs) : arraysize(kAudioCodecs); | 98 video ? arraysize(kVideoCodecs) : arraysize(kAudioCodecs); |
| 99 | 99 |
| 100 std::vector<std::string> codecs_list; | 100 std::vector<std::string> codecs_list; |
| 101 media::ParseCodecString(web_codecs.utf8(), &codecs_list, true /* strip */); | 101 media::SplitCodecsToVector(web_codecs.utf8(), &codecs_list, true /* strip */); |
| 102 for (const auto& codec : codecs_list) { | 102 for (const auto& codec : codecs_list) { |
| 103 auto* const* found = std::find_if( | 103 auto* const* found = std::find_if( |
| 104 &codecs[0], &codecs[codecs_count], [&codec](const char* name) { | 104 &codecs[0], &codecs[codecs_count], [&codec](const char* name) { |
| 105 return base::EqualsCaseInsensitiveASCII(codec, name); | 105 return base::EqualsCaseInsensitiveASCII(codec, name); |
| 106 }); | 106 }); |
| 107 if (found == &codecs[codecs_count]) | 107 if (found == &codecs[codecs_count]) |
| 108 return false; | 108 return false; |
| 109 } | 109 } |
| 110 return true; | 110 return true; |
| 111 } | 111 } |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 recorder->OnData(audio_bus, timestamp); | 373 recorder->OnData(audio_bus, timestamp); |
| 374 } | 374 } |
| 375 | 375 |
| 376 void MediaRecorderHandler::SetAudioFormatForTesting( | 376 void MediaRecorderHandler::SetAudioFormatForTesting( |
| 377 const media::AudioParameters& params) { | 377 const media::AudioParameters& params) { |
| 378 for (const auto& recorder : audio_recorders_) | 378 for (const auto& recorder : audio_recorders_) |
| 379 recorder->OnSetFormat(params); | 379 recorder->OnSetFormat(params); |
| 380 } | 380 } |
| 381 | 381 |
| 382 } // namespace content | 382 } // namespace content |
| OLD | NEW |