OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 NamedEncoderFactory::ForEncoder<AudioEncoderPcmA>(), | 80 NamedEncoderFactory::ForEncoder<AudioEncoderPcmA>(), |
81 NamedEncoderFactory::ForEncoder<AudioEncoderPcmU>(), | 81 NamedEncoderFactory::ForEncoder<AudioEncoderPcmU>(), |
82 }; | 82 }; |
83 } // namespace | 83 } // namespace |
84 | 84 |
85 class BuiltinAudioEncoderFactory : public AudioEncoderFactory { | 85 class BuiltinAudioEncoderFactory : public AudioEncoderFactory { |
86 public: | 86 public: |
87 std::vector<AudioCodecSpec> GetSupportedEncoders() override { | 87 std::vector<AudioCodecSpec> GetSupportedEncoders() override { |
88 static const SdpAudioFormat desired_encoders[] = { | 88 static const SdpAudioFormat desired_encoders[] = { |
89 {"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}}, | 89 {"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}}, |
90 {"isac", 16000, 1}, | 90 {"ISAC", 16000, 1}, |
91 {"isac", 32000, 1}, | 91 {"ISAC", 32000, 1}, |
92 {"G722", 8000, 1}, | 92 {"G722", 8000, 1}, |
93 {"iLBC", 8000, 1}, | 93 {"ILBC", 8000, 1}, |
94 {"PCMU", 8000, 1}, | 94 {"PCMU", 8000, 1}, |
95 {"PCMA", 8000, 1}, | 95 {"PCMA", 8000, 1}, |
96 }; | 96 }; |
97 | 97 |
98 // Initialize thread-safely, once, on first use. | 98 // Initialize thread-safely, once, on first use. |
99 static const std::vector<AudioCodecSpec> specs = [] { | 99 static const std::vector<AudioCodecSpec> specs = [] { |
100 std::vector<AudioCodecSpec> specs; | 100 std::vector<AudioCodecSpec> specs; |
101 for (const auto& format : desired_encoders) { | 101 for (const auto& format : desired_encoders) { |
102 for (const auto& ef : encoder_factories) { | 102 for (const auto& ef : encoder_factories) { |
103 if (STR_CASE_CMP(format.name.c_str(), ef.name) == 0) { | 103 if (STR_CASE_CMP(format.name.c_str(), ef.name) == 0) { |
(...skipping 30 matching lines...) Expand all Loading... |
134 return nullptr; | 134 return nullptr; |
135 } | 135 } |
136 }; | 136 }; |
137 | 137 |
138 rtc::scoped_refptr<AudioEncoderFactory> CreateBuiltinAudioEncoderFactory() { | 138 rtc::scoped_refptr<AudioEncoderFactory> CreateBuiltinAudioEncoderFactory() { |
139 return rtc::scoped_refptr<AudioEncoderFactory>( | 139 return rtc::scoped_refptr<AudioEncoderFactory>( |
140 new rtc::RefCountedObject<BuiltinAudioEncoderFactory>()); | 140 new rtc::RefCountedObject<BuiltinAudioEncoderFactory>()); |
141 } | 141 } |
142 | 142 |
143 } // namespace webrtc | 143 } // namespace webrtc |
OLD | NEW |