OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 | 114 |
115 // Initialize receiver, resets codec database etc. | 115 // Initialize receiver, resets codec database etc. |
116 int InitializeReceiver() override; | 116 int InitializeReceiver() override; |
117 | 117 |
118 // Get current receive frequency. | 118 // Get current receive frequency. |
119 int ReceiveFrequency() const override; | 119 int ReceiveFrequency() const override; |
120 | 120 |
121 // Get current playout frequency. | 121 // Get current playout frequency. |
122 int PlayoutFrequency() const override; | 122 int PlayoutFrequency() const override; |
123 | 123 |
124 bool RegisterReceiveCodec(int rtp_payload_type, | |
125 const SdpAudioFormat& audio_format) override; | |
126 | |
124 int RegisterReceiveCodec(const CodecInst& receive_codec) override; | 127 int RegisterReceiveCodec(const CodecInst& receive_codec) override; |
125 int RegisterReceiveCodec( | 128 int RegisterReceiveCodec( |
126 const CodecInst& receive_codec, | 129 const CodecInst& receive_codec, |
127 rtc::FunctionView<std::unique_ptr<AudioDecoder>()> isac_factory) override; | 130 rtc::FunctionView<std::unique_ptr<AudioDecoder>()> isac_factory) override; |
128 | 131 |
129 int RegisterExternalReceiveCodec(int rtp_payload_type, | 132 int RegisterExternalReceiveCodec(int rtp_payload_type, |
130 AudioDecoder* external_decoder, | 133 AudioDecoder* external_decoder, |
131 int sample_rate_hz, | 134 int sample_rate_hz, |
132 int num_channels, | 135 int num_channels, |
133 const std::string& name) override; | 136 const std::string& name) override; |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
980 : receiver_.last_output_sample_rate_hz(); | 983 : receiver_.last_output_sample_rate_hz(); |
981 } | 984 } |
982 | 985 |
983 // Get current playout frequency. | 986 // Get current playout frequency. |
984 int AudioCodingModuleImpl::PlayoutFrequency() const { | 987 int AudioCodingModuleImpl::PlayoutFrequency() const { |
985 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_, | 988 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_, |
986 "PlayoutFrequency()"); | 989 "PlayoutFrequency()"); |
987 return receiver_.last_output_sample_rate_hz(); | 990 return receiver_.last_output_sample_rate_hz(); |
988 } | 991 } |
989 | 992 |
993 bool AudioCodingModuleImpl::RegisterReceiveCodec( | |
hlundin-webrtc
2016/10/05 13:39:14
Why do you not have to handle the "iSAC case" like
kwiberg-webrtc
2016/10/06 09:20:46
In principle: Because the user has previously inje
| |
994 int rtp_payload_type, | |
995 const SdpAudioFormat& audio_format) { | |
996 rtc::CritScope lock(&acm_crit_sect_); | |
997 RTC_DCHECK(receiver_initialized_); | |
998 | |
999 if (!acm2::RentACodec::IsPayloadTypeValid(rtp_payload_type)) { | |
1000 LOG_F(LS_ERROR) << "Invalid payload-type " << rtp_payload_type | |
1001 << " for decoder."; | |
1002 return false; | |
1003 } | |
1004 | |
1005 return receiver_.AddCodec(rtp_payload_type, audio_format); | |
1006 } | |
1007 | |
990 int AudioCodingModuleImpl::RegisterReceiveCodec(const CodecInst& codec) { | 1008 int AudioCodingModuleImpl::RegisterReceiveCodec(const CodecInst& codec) { |
991 rtc::CritScope lock(&acm_crit_sect_); | 1009 rtc::CritScope lock(&acm_crit_sect_); |
992 auto* ef = encoder_factory_.get(); | 1010 auto* ef = encoder_factory_.get(); |
993 return RegisterReceiveCodecUnlocked( | 1011 return RegisterReceiveCodecUnlocked( |
994 codec, [&] { return ef->rent_a_codec.RentIsacDecoder(codec.plfreq); }); | 1012 codec, [&] { return ef->rent_a_codec.RentIsacDecoder(codec.plfreq); }); |
995 } | 1013 } |
996 | 1014 |
997 int AudioCodingModuleImpl::RegisterReceiveCodec( | 1015 int AudioCodingModuleImpl::RegisterReceiveCodec( |
998 const CodecInst& codec, | 1016 const CodecInst& codec, |
999 rtc::FunctionView<std::unique_ptr<AudioDecoder>()> isac_factory) { | 1017 rtc::FunctionView<std::unique_ptr<AudioDecoder>()> isac_factory) { |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1356 // Checks the validity of the parameters of the given codec | 1374 // Checks the validity of the parameters of the given codec |
1357 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { | 1375 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { |
1358 bool valid = acm2::RentACodec::IsCodecValid(codec); | 1376 bool valid = acm2::RentACodec::IsCodecValid(codec); |
1359 if (!valid) | 1377 if (!valid) |
1360 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, | 1378 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, |
1361 "Invalid codec setting"); | 1379 "Invalid codec setting"); |
1362 return valid; | 1380 return valid; |
1363 } | 1381 } |
1364 | 1382 |
1365 } // namespace webrtc | 1383 } // namespace webrtc |
OLD | NEW |