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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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<SdpAudioFormat> GetSupportedFormats() override { |
133 static std::vector<SdpAudioFormat> formats = { | 133 FATAL() << "Not implemented yet!"; |
134 #ifdef WEBRTC_CODEC_OPUS | |
135 { "opus", 48000, 2, { | |
136 {"minptime", "10" }, | |
137 {"useinbandfec", "1" } | |
138 } | |
139 }, | |
140 #endif | |
141 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) | |
142 { "isac", 16000, 1 }, | |
143 #endif | |
144 #if (defined(WEBRTC_CODEC_ISAC)) | |
145 { "isac", 32000, 1 }, | |
146 #endif | |
147 #ifdef WEBRTC_CODEC_G722 | |
148 { "G722", 8000, 1 }, | |
149 #endif | |
150 #ifdef WEBRTC_CODEC_ILBC | |
151 { "iLBC", 8000, 1 }, | |
152 #endif | |
153 { "PCMU", 8000, 1 }, | |
154 { "PCMA", 8000, 1 } | |
155 }; | |
156 | |
157 return formats; | |
158 } | 134 } |
159 | 135 |
160 std::unique_ptr<AudioDecoder> MakeAudioDecoder( | 136 std::unique_ptr<AudioDecoder> MakeAudioDecoder( |
161 const SdpAudioFormat& format) override { | 137 const SdpAudioFormat& format) override { |
162 for (const auto& dc : decoder_constructors) { | 138 for (const auto& dc : decoder_constructors) { |
163 if (STR_CASE_CMP(format.name.c_str(), dc.name) == 0) { | 139 if (STR_CASE_CMP(format.name.c_str(), dc.name) == 0) { |
164 std::unique_ptr<AudioDecoder> dec = dc.constructor(format); | 140 std::unique_ptr<AudioDecoder> dec = dc.constructor(format); |
165 if (dec) { | 141 if (dec) { |
166 const int expected_sample_rate_hz = | 142 const int expected_sample_rate_hz = |
167 STR_CASE_CMP(format.name.c_str(), "g722") == 0 | 143 STR_CASE_CMP(format.name.c_str(), "g722") == 0 |
168 ? 2 * format.clockrate_hz | 144 ? 2 * format.clockrate_hz |
169 : format.clockrate_hz; | 145 : format.clockrate_hz; |
170 RTC_CHECK_EQ(expected_sample_rate_hz, dec->SampleRateHz()); | 146 RTC_CHECK_EQ(expected_sample_rate_hz, dec->SampleRateHz()); |
171 } | 147 } |
172 return dec; | 148 return dec; |
173 } | 149 } |
174 } | 150 } |
175 return nullptr; | 151 return nullptr; |
176 } | 152 } |
177 }; | 153 }; |
178 | 154 |
179 } // namespace | 155 } // namespace |
180 | 156 |
181 rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() { | 157 rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() { |
182 return rtc::scoped_refptr<AudioDecoderFactory>( | 158 return rtc::scoped_refptr<AudioDecoderFactory>( |
183 new rtc::RefCountedObject<BuiltinAudioDecoderFactory>); | 159 new rtc::RefCountedObject<BuiltinAudioDecoderFactory>); |
184 } | 160 } |
185 | 161 |
186 } // namespace webrtc | 162 } // namespace webrtc |
OLD | NEW |