OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 return format.clockrate_hz == 48000 && format.num_channels == 2 && | 122 return format.clockrate_hz == 48000 && format.num_channels == 2 && |
123 num_channels | 123 num_channels |
124 ? Unique(new AudioDecoderOpus(*num_channels)) | 124 ? Unique(new AudioDecoderOpus(*num_channels)) |
125 : nullptr; | 125 : nullptr; |
126 }}, | 126 }}, |
127 #endif | 127 #endif |
128 }; | 128 }; |
129 | 129 |
130 class BuiltinAudioDecoderFactory : public AudioDecoderFactory { | 130 class BuiltinAudioDecoderFactory : public AudioDecoderFactory { |
131 public: | 131 public: |
132 std::vector<SdpAudioFormat> GetSupportedFormats() override { | 132 std::vector<AudioCodecSpec> GetSupportedDecoders() override { |
133 static std::vector<SdpAudioFormat> formats = { | 133 static std::vector<AudioCodecSpec> specs = { |
134 #ifdef WEBRTC_CODEC_OPUS | 134 #ifdef WEBRTC_CODEC_OPUS |
135 { "opus", 48000, 2, { | 135 { { "opus", 48000, 2, { |
136 {"minptime", "10" }, | 136 {"minptime", "10" }, |
137 {"useinbandfec", "1" } | 137 {"useinbandfec", "1" } |
138 } | 138 } |
| 139 }, false |
139 }, | 140 }, |
140 #endif | 141 #endif |
141 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) | 142 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) |
142 { "isac", 16000, 1 }, | 143 { { "isac", 16000, 1 }, true }, |
143 #endif | 144 #endif |
144 #if (defined(WEBRTC_CODEC_ISAC)) | 145 #if (defined(WEBRTC_CODEC_ISAC)) |
145 { "isac", 32000, 1 }, | 146 { { "isac", 32000, 1 }, true }, |
146 #endif | 147 #endif |
147 #ifdef WEBRTC_CODEC_G722 | 148 #ifdef WEBRTC_CODEC_G722 |
148 { "G722", 8000, 1 }, | 149 { { "G722", 8000, 1 }, true }, |
149 #endif | 150 #endif |
150 #ifdef WEBRTC_CODEC_ILBC | 151 #ifdef WEBRTC_CODEC_ILBC |
151 { "iLBC", 8000, 1 }, | 152 { { "iLBC", 8000, 1 }, true }, |
152 #endif | 153 #endif |
153 { "PCMU", 8000, 1 }, | 154 { { "PCMU", 8000, 1 }, true }, |
154 { "PCMA", 8000, 1 } | 155 { { "PCMA", 8000, 1 }, true } |
155 }; | 156 }; |
156 | 157 |
157 return formats; | 158 return specs; |
158 } | 159 } |
159 | 160 |
160 std::unique_ptr<AudioDecoder> MakeAudioDecoder( | 161 std::unique_ptr<AudioDecoder> MakeAudioDecoder( |
161 const SdpAudioFormat& format) override { | 162 const SdpAudioFormat& format) override { |
162 for (const auto& dc : decoder_constructors) { | 163 for (const auto& dc : decoder_constructors) { |
163 if (STR_CASE_CMP(format.name.c_str(), dc.name) == 0) { | 164 if (STR_CASE_CMP(format.name.c_str(), dc.name) == 0) { |
164 std::unique_ptr<AudioDecoder> dec = dc.constructor(format); | 165 std::unique_ptr<AudioDecoder> dec = dc.constructor(format); |
165 if (dec) { | 166 if (dec) { |
166 const int expected_sample_rate_hz = | 167 const int expected_sample_rate_hz = |
167 STR_CASE_CMP(format.name.c_str(), "g722") == 0 | 168 STR_CASE_CMP(format.name.c_str(), "g722") == 0 |
168 ? 2 * format.clockrate_hz | 169 ? 2 * format.clockrate_hz |
169 : format.clockrate_hz; | 170 : format.clockrate_hz; |
170 RTC_CHECK_EQ(expected_sample_rate_hz, dec->SampleRateHz()); | 171 RTC_CHECK_EQ(expected_sample_rate_hz, dec->SampleRateHz()); |
171 } | 172 } |
172 return dec; | 173 return dec; |
173 } | 174 } |
174 } | 175 } |
175 return nullptr; | 176 return nullptr; |
176 } | 177 } |
177 }; | 178 }; |
178 | 179 |
179 } // namespace | 180 } // namespace |
180 | 181 |
181 rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() { | 182 rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() { |
182 return rtc::scoped_refptr<AudioDecoderFactory>( | 183 return rtc::scoped_refptr<AudioDecoderFactory>( |
183 new rtc::RefCountedObject<BuiltinAudioDecoderFactory>); | 184 new rtc::RefCountedObject<BuiltinAudioDecoderFactory>); |
184 } | 185 } |
185 | 186 |
186 } // namespace webrtc | 187 } // namespace webrtc |
OLD | NEW |