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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 error_code_ = kInvalidPointer; | 272 error_code_ = kInvalidPointer; |
273 break; | 273 break; |
274 default: | 274 default: |
275 error_code_ = kOtherError; | 275 error_code_ = kOtherError; |
276 } | 276 } |
277 return kFail; | 277 return kFail; |
278 } | 278 } |
279 return kOK; | 279 return kOK; |
280 } | 280 } |
281 | 281 |
| 282 bool NetEqImpl::RegisterPayloadType(int rtp_payload_type, |
| 283 const SdpAudioFormat& audio_format) { |
| 284 LOG(LS_VERBOSE) << "NetEqImpl::RegisterPayloadType: payload type " |
| 285 << rtp_payload_type << ", codec " << audio_format; |
| 286 rtc::CritScope lock(&crit_sect_); |
| 287 switch (decoder_database_->RegisterPayload(rtp_payload_type, audio_format)) { |
| 288 case DecoderDatabase::kOK: |
| 289 return true; |
| 290 case DecoderDatabase::kInvalidRtpPayloadType: |
| 291 error_code_ = kInvalidRtpPayloadType; |
| 292 return false; |
| 293 case DecoderDatabase::kCodecNotSupported: |
| 294 error_code_ = kCodecNotSupported; |
| 295 return false; |
| 296 case DecoderDatabase::kDecoderExists: |
| 297 error_code_ = kDecoderExists; |
| 298 return false; |
| 299 case DecoderDatabase::kInvalidSampleRate: |
| 300 error_code_ = kInvalidSampleRate; |
| 301 return false; |
| 302 case DecoderDatabase::kInvalidPointer: |
| 303 error_code_ = kInvalidPointer; |
| 304 return false; |
| 305 default: |
| 306 error_code_ = kOtherError; |
| 307 return false; |
| 308 } |
| 309 } |
| 310 |
282 int NetEqImpl::RemovePayloadType(uint8_t rtp_payload_type) { | 311 int NetEqImpl::RemovePayloadType(uint8_t rtp_payload_type) { |
283 rtc::CritScope lock(&crit_sect_); | 312 rtc::CritScope lock(&crit_sect_); |
284 int ret = decoder_database_->Remove(rtp_payload_type); | 313 int ret = decoder_database_->Remove(rtp_payload_type); |
285 if (ret == DecoderDatabase::kOK) { | 314 if (ret == DecoderDatabase::kOK) { |
286 packet_buffer_->DiscardPacketsWithPayloadType(rtp_payload_type); | 315 packet_buffer_->DiscardPacketsWithPayloadType(rtp_payload_type); |
287 return kOK; | 316 return kOK; |
288 } else if (ret == DecoderDatabase::kDecoderNotFound) { | 317 } else if (ret == DecoderDatabase::kDecoderNotFound) { |
289 error_code_ = kDecoderNotFound; | 318 error_code_ = kDecoderNotFound; |
290 } else { | 319 } else { |
291 error_code_ = kOtherError; | 320 error_code_ = kOtherError; |
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2109 } | 2138 } |
2110 } | 2139 } |
2111 | 2140 |
2112 void NetEqImpl::CreateDecisionLogic() { | 2141 void NetEqImpl::CreateDecisionLogic() { |
2113 decision_logic_.reset(DecisionLogic::Create( | 2142 decision_logic_.reset(DecisionLogic::Create( |
2114 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), | 2143 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), |
2115 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), | 2144 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), |
2116 tick_timer_.get())); | 2145 tick_timer_.get())); |
2117 } | 2146 } |
2118 } // namespace webrtc | 2147 } // namespace webrtc |
OLD | NEW |