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