| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 [](const SdpAudioFormat& format) { | 67 [](const SdpAudioFormat& format) { |
| 68 return format.clockrate_hz == 8000 && format.num_channels == 1 | 68 return format.clockrate_hz == 8000 && format.num_channels == 1 |
| 69 ? Unique(new AudioDecoderIlbc) | 69 ? Unique(new AudioDecoderIlbc) |
| 70 : nullptr; | 70 : nullptr; |
| 71 }}, | 71 }}, |
| 72 #endif | 72 #endif |
| 73 #if defined(WEBRTC_CODEC_ISACFX) | 73 #if defined(WEBRTC_CODEC_ISACFX) |
| 74 {"isac", | 74 {"isac", |
| 75 [](const SdpAudioFormat& format) { | 75 [](const SdpAudioFormat& format) { |
| 76 return format.clockrate_hz == 16000 && format.num_channels == 1 | 76 return format.clockrate_hz == 16000 && format.num_channels == 1 |
| 77 ? Unique(new AudioDecoderIsacFix) | 77 ? Unique(new AudioDecoderIsacFix(format.clockrate_hz)) |
| 78 : nullptr; | 78 : nullptr; |
| 79 }}, | 79 }}, |
| 80 #elif defined(WEBRTC_CODEC_ISAC) | 80 #elif defined(WEBRTC_CODEC_ISAC) |
| 81 {"isac", | 81 {"isac", |
| 82 [](const SdpAudioFormat& format) { | 82 [](const SdpAudioFormat& format) { |
| 83 return (format.clockrate_hz == 16000 || format.clockrate_hz == 32000) && | 83 return (format.clockrate_hz == 16000 || format.clockrate_hz == 32000) && |
| 84 format.num_channels == 1 | 84 format.num_channels == 1 |
| 85 ? Unique(new AudioDecoderIsac) | 85 ? Unique(new AudioDecoderIsac(format.clockrate_hz)) |
| 86 : nullptr; | 86 : nullptr; |
| 87 }}, | 87 }}, |
| 88 #endif | 88 #endif |
| 89 {"l16", | 89 {"l16", |
| 90 [](const SdpAudioFormat& format) { | 90 [](const SdpAudioFormat& format) { |
| 91 return format.num_channels >= 1 | 91 return format.num_channels >= 1 |
| 92 ? Unique(new AudioDecoderPcm16B(format.num_channels)) | 92 ? Unique(new AudioDecoderPcm16B(format.clockrate_hz, |
| 93 format.num_channels)) |
| 93 : nullptr; | 94 : nullptr; |
| 94 }}, | 95 }}, |
| 95 #ifdef WEBRTC_CODEC_G722 | 96 #ifdef WEBRTC_CODEC_G722 |
| 96 {"g722", | 97 {"g722", |
| 97 [](const SdpAudioFormat& format) { | 98 [](const SdpAudioFormat& format) { |
| 98 if (format.clockrate_hz == 8000) { | 99 if (format.clockrate_hz == 8000) { |
| 99 if (format.num_channels == 1) | 100 if (format.num_channels == 1) |
| 100 return Unique(new AudioDecoderG722); | 101 return Unique(new AudioDecoderG722); |
| 101 if (format.num_channels == 2) | 102 if (format.num_channels == 2) |
| 102 return Unique(new AudioDecoderG722Stereo); | 103 return Unique(new AudioDecoderG722Stereo); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 129 class BuiltinAudioDecoderFactory : public AudioDecoderFactory { | 130 class BuiltinAudioDecoderFactory : public AudioDecoderFactory { |
| 130 public: | 131 public: |
| 131 std::vector<SdpAudioFormat> GetSupportedFormats() override { | 132 std::vector<SdpAudioFormat> GetSupportedFormats() override { |
| 132 FATAL() << "Not implemented yet!"; | 133 FATAL() << "Not implemented yet!"; |
| 133 } | 134 } |
| 134 | 135 |
| 135 std::unique_ptr<AudioDecoder> MakeAudioDecoder( | 136 std::unique_ptr<AudioDecoder> MakeAudioDecoder( |
| 136 const SdpAudioFormat& format) override { | 137 const SdpAudioFormat& format) override { |
| 137 for (const auto& dc : decoder_constructors) { | 138 for (const auto& dc : decoder_constructors) { |
| 138 if (STR_CASE_CMP(format.name.c_str(), dc.name) == 0) { | 139 if (STR_CASE_CMP(format.name.c_str(), dc.name) == 0) { |
| 139 return std::unique_ptr<AudioDecoder>(dc.constructor(format)); | 140 std::unique_ptr<AudioDecoder> dec = dc.constructor(format); |
| 141 if (dec) { |
| 142 const int expected_sample_rate_hz = |
| 143 STR_CASE_CMP(format.name.c_str(), "g722") == 0 |
| 144 ? 2 * format.clockrate_hz |
| 145 : format.clockrate_hz; |
| 146 RTC_CHECK_EQ(expected_sample_rate_hz, dec->SampleRateHz()); |
| 147 } |
| 148 return dec; |
| 140 } | 149 } |
| 141 } | 150 } |
| 142 return nullptr; | 151 return nullptr; |
| 143 } | 152 } |
| 144 }; | 153 }; |
| 145 | 154 |
| 146 } // namespace | 155 } // namespace |
| 147 | 156 |
| 148 rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() { | 157 rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() { |
| 149 return rtc::scoped_refptr<AudioDecoderFactory>( | 158 return rtc::scoped_refptr<AudioDecoderFactory>( |
| 150 new rtc::RefCountedObject<BuiltinAudioDecoderFactory>); | 159 new rtc::RefCountedObject<BuiltinAudioDecoderFactory>); |
| 151 } | 160 } |
| 152 | 161 |
| 153 } // namespace webrtc | 162 } // namespace webrtc |
| OLD | NEW |