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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 rtc::checked_cast<int>(*samples_per_channel * 100); | 165 rtc::checked_cast<int>(*samples_per_channel * 100); |
166 RTC_DCHECK(last_output_sample_rate_hz_ == 8000 || | 166 RTC_DCHECK(last_output_sample_rate_hz_ == 8000 || |
167 last_output_sample_rate_hz_ == 16000 || | 167 last_output_sample_rate_hz_ == 16000 || |
168 last_output_sample_rate_hz_ == 32000 || | 168 last_output_sample_rate_hz_ == 32000 || |
169 last_output_sample_rate_hz_ == 48000) | 169 last_output_sample_rate_hz_ == 48000) |
170 << "Unexpected sample rate " << last_output_sample_rate_hz_; | 170 << "Unexpected sample rate " << last_output_sample_rate_hz_; |
171 return kOK; | 171 return kOK; |
172 } | 172 } |
173 | 173 |
174 int NetEqImpl::RegisterPayloadType(NetEqDecoder codec, | 174 int NetEqImpl::RegisterPayloadType(NetEqDecoder codec, |
| 175 const std::string& name, |
175 uint8_t rtp_payload_type) { | 176 uint8_t rtp_payload_type) { |
176 CriticalSectionScoped lock(crit_sect_.get()); | 177 CriticalSectionScoped lock(crit_sect_.get()); |
177 LOG(LS_VERBOSE) << "RegisterPayloadType " | 178 LOG(LS_VERBOSE) << "RegisterPayloadType " |
178 << static_cast<int>(rtp_payload_type) << " " | 179 << static_cast<int>(rtp_payload_type) << " " |
179 << static_cast<int>(codec); | 180 << static_cast<int>(codec); |
180 int ret = decoder_database_->RegisterPayload(rtp_payload_type, codec); | 181 int ret = decoder_database_->RegisterPayload(rtp_payload_type, codec, name); |
181 if (ret != DecoderDatabase::kOK) { | 182 if (ret != DecoderDatabase::kOK) { |
182 switch (ret) { | 183 switch (ret) { |
183 case DecoderDatabase::kInvalidRtpPayloadType: | 184 case DecoderDatabase::kInvalidRtpPayloadType: |
184 error_code_ = kInvalidRtpPayloadType; | 185 error_code_ = kInvalidRtpPayloadType; |
185 break; | 186 break; |
186 case DecoderDatabase::kCodecNotSupported: | 187 case DecoderDatabase::kCodecNotSupported: |
187 error_code_ = kCodecNotSupported; | 188 error_code_ = kCodecNotSupported; |
188 break; | 189 break; |
189 case DecoderDatabase::kDecoderExists: | 190 case DecoderDatabase::kDecoderExists: |
190 error_code_ = kDecoderExists; | 191 error_code_ = kDecoderExists; |
191 break; | 192 break; |
192 default: | 193 default: |
193 error_code_ = kOtherError; | 194 error_code_ = kOtherError; |
194 } | 195 } |
195 return kFail; | 196 return kFail; |
196 } | 197 } |
197 return kOK; | 198 return kOK; |
198 } | 199 } |
199 | 200 |
200 int NetEqImpl::RegisterExternalDecoder(AudioDecoder* decoder, | 201 int NetEqImpl::RegisterExternalDecoder(AudioDecoder* decoder, |
201 NetEqDecoder codec, | 202 NetEqDecoder codec, |
| 203 const std::string& codec_name, |
202 uint8_t rtp_payload_type, | 204 uint8_t rtp_payload_type, |
203 int sample_rate_hz) { | 205 int sample_rate_hz) { |
204 CriticalSectionScoped lock(crit_sect_.get()); | 206 CriticalSectionScoped lock(crit_sect_.get()); |
205 LOG(LS_VERBOSE) << "RegisterExternalDecoder " | 207 LOG(LS_VERBOSE) << "RegisterExternalDecoder " |
206 << static_cast<int>(rtp_payload_type) << " " | 208 << static_cast<int>(rtp_payload_type) << " " |
207 << static_cast<int>(codec); | 209 << static_cast<int>(codec); |
208 if (!decoder) { | 210 if (!decoder) { |
209 LOG(LS_ERROR) << "Cannot register external decoder with NULL pointer"; | 211 LOG(LS_ERROR) << "Cannot register external decoder with NULL pointer"; |
210 assert(false); | 212 assert(false); |
211 return kFail; | 213 return kFail; |
212 } | 214 } |
213 int ret = decoder_database_->InsertExternal(rtp_payload_type, codec, | 215 int ret = decoder_database_->InsertExternal( |
214 sample_rate_hz, decoder); | 216 rtp_payload_type, codec, codec_name, sample_rate_hz, decoder); |
215 if (ret != DecoderDatabase::kOK) { | 217 if (ret != DecoderDatabase::kOK) { |
216 switch (ret) { | 218 switch (ret) { |
217 case DecoderDatabase::kInvalidRtpPayloadType: | 219 case DecoderDatabase::kInvalidRtpPayloadType: |
218 error_code_ = kInvalidRtpPayloadType; | 220 error_code_ = kInvalidRtpPayloadType; |
219 break; | 221 break; |
220 case DecoderDatabase::kCodecNotSupported: | 222 case DecoderDatabase::kCodecNotSupported: |
221 error_code_ = kCodecNotSupported; | 223 error_code_ = kCodecNotSupported; |
222 break; | 224 break; |
223 case DecoderDatabase::kDecoderExists: | 225 case DecoderDatabase::kDecoderExists: |
224 error_code_ = kDecoderExists; | 226 error_code_ = kDecoderExists; |
(...skipping 1815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2040 | 2042 |
2041 void NetEqImpl::CreateDecisionLogic() { | 2043 void NetEqImpl::CreateDecisionLogic() { |
2042 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, | 2044 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, |
2043 playout_mode_, | 2045 playout_mode_, |
2044 decoder_database_.get(), | 2046 decoder_database_.get(), |
2045 *packet_buffer_.get(), | 2047 *packet_buffer_.get(), |
2046 delay_manager_.get(), | 2048 delay_manager_.get(), |
2047 buffer_level_filter_.get())); | 2049 buffer_level_filter_.get())); |
2048 } | 2050 } |
2049 } // namespace webrtc | 2051 } // namespace webrtc |
OLD | NEW |