 Chromium Code Reviews
 Chromium Code Reviews Issue 2072753002:
  WebRtcVoiceEngine: Use AudioDecoderFactory to generate recv codecs.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc.git@master
    
  
    Issue 2072753002:
  WebRtcVoiceEngine: Use AudioDecoderFactory to generate recv codecs.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc.git@master| 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 #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)) | |
| 
ossu
2016/07/12 15:49:49
This is why the tests failed on android: we preten
 | |
| 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; | |
| 134 } | 158 } | 
| 135 | 159 | 
| 136 std::unique_ptr<AudioDecoder> MakeAudioDecoder( | 160 std::unique_ptr<AudioDecoder> MakeAudioDecoder( | 
| 137 const SdpAudioFormat& format) override { | 161 const SdpAudioFormat& format) override { | 
| 138 for (const auto& dc : decoder_constructors) { | 162 for (const auto& dc : decoder_constructors) { | 
| 139 if (STR_CASE_CMP(format.name.c_str(), dc.name) == 0) { | 163 if (STR_CASE_CMP(format.name.c_str(), dc.name) == 0) { | 
| 140 std::unique_ptr<AudioDecoder> dec = dc.constructor(format); | 164 std::unique_ptr<AudioDecoder> dec = dc.constructor(format); | 
| 141 if (dec) { | 165 if (dec) { | 
| 142 const int expected_sample_rate_hz = | 166 const int expected_sample_rate_hz = | 
| 143 STR_CASE_CMP(format.name.c_str(), "g722") == 0 | 167 STR_CASE_CMP(format.name.c_str(), "g722") == 0 | 
| 144 ? 2 * format.clockrate_hz | 168 ? 2 * format.clockrate_hz | 
| 145 : format.clockrate_hz; | 169 : format.clockrate_hz; | 
| 146 RTC_CHECK_EQ(expected_sample_rate_hz, dec->SampleRateHz()); | 170 RTC_CHECK_EQ(expected_sample_rate_hz, dec->SampleRateHz()); | 
| 147 } | 171 } | 
| 148 return dec; | 172 return dec; | 
| 149 } | 173 } | 
| 150 } | 174 } | 
| 151 return nullptr; | 175 return nullptr; | 
| 152 } | 176 } | 
| 153 }; | 177 }; | 
| 154 | 178 | 
| 155 } // namespace | 179 } // namespace | 
| 156 | 180 | 
| 157 rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() { | 181 rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() { | 
| 158 return rtc::scoped_refptr<AudioDecoderFactory>( | 182 return rtc::scoped_refptr<AudioDecoderFactory>( | 
| 159 new rtc::RefCountedObject<BuiltinAudioDecoderFactory>); | 183 new rtc::RefCountedObject<BuiltinAudioDecoderFactory>); | 
| 160 } | 184 } | 
| 161 | 185 | 
| 162 } // namespace webrtc | 186 } // namespace webrtc | 
| OLD | NEW |