Chromium Code Reviews| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 expand_factory_(std::move(deps.expand_factory)), | 88 expand_factory_(std::move(deps.expand_factory)), |
| 89 accelerate_factory_(std::move(deps.accelerate_factory)), | 89 accelerate_factory_(std::move(deps.accelerate_factory)), |
| 90 preemptive_expand_factory_(std::move(deps.preemptive_expand_factory)), | 90 preemptive_expand_factory_(std::move(deps.preemptive_expand_factory)), |
| 91 last_mode_(kModeNormal), | 91 last_mode_(kModeNormal), |
| 92 decoded_buffer_length_(kMaxFrameSize), | 92 decoded_buffer_length_(kMaxFrameSize), |
| 93 decoded_buffer_(new int16_t[decoded_buffer_length_]), | 93 decoded_buffer_(new int16_t[decoded_buffer_length_]), |
| 94 playout_timestamp_(0), | 94 playout_timestamp_(0), |
| 95 new_codec_(false), | 95 new_codec_(false), |
| 96 timestamp_(0), | 96 timestamp_(0), |
| 97 reset_decoder_(false), | 97 reset_decoder_(false), |
| 98 current_rtp_payload_type_(0xFF), // Invalid RTP payload type. | |
| 99 current_cng_rtp_payload_type_(0xFF), // Invalid RTP payload type. | |
| 100 ssrc_(0), | 98 ssrc_(0), |
| 101 first_packet_(true), | 99 first_packet_(true), |
| 102 error_code_(0), | 100 error_code_(0), |
| 103 decoder_error_code_(0), | 101 decoder_error_code_(0), |
| 104 background_noise_mode_(config.background_noise_mode), | 102 background_noise_mode_(config.background_noise_mode), |
| 105 playout_mode_(config.playout_mode), | 103 playout_mode_(config.playout_mode), |
| 106 enable_fast_accelerate_(config.enable_fast_accelerate), | 104 enable_fast_accelerate_(config.enable_fast_accelerate), |
| 107 nack_enabled_(false), | 105 nack_enabled_(false), |
| 108 enable_muted_state_(config.enable_muted_state) { | 106 enable_muted_state_(config.enable_muted_state) { |
| 109 LOG(LS_INFO) << "NetEq config: " << config.ToString(); | 107 LOG(LS_INFO) << "NetEq config: " << config.ToString(); |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 530 } | 528 } |
| 531 // Sanity checks for sync-packets. | 529 // Sanity checks for sync-packets. |
| 532 if (is_sync_packet) { | 530 if (is_sync_packet) { |
| 533 if (decoder_database_->IsDtmf(rtp_header.header.payloadType) || | 531 if (decoder_database_->IsDtmf(rtp_header.header.payloadType) || |
| 534 decoder_database_->IsRed(rtp_header.header.payloadType) || | 532 decoder_database_->IsRed(rtp_header.header.payloadType) || |
| 535 decoder_database_->IsComfortNoise(rtp_header.header.payloadType)) { | 533 decoder_database_->IsComfortNoise(rtp_header.header.payloadType)) { |
| 536 LOG_F(LS_ERROR) << "Sync-packet with an unacceptable payload type " | 534 LOG_F(LS_ERROR) << "Sync-packet with an unacceptable payload type " |
| 537 << static_cast<int>(rtp_header.header.payloadType); | 535 << static_cast<int>(rtp_header.header.payloadType); |
| 538 return kSyncPacketNotAccepted; | 536 return kSyncPacketNotAccepted; |
| 539 } | 537 } |
| 540 if (first_packet_ || | 538 if (first_packet_ || !current_rtp_payload_type_ || |
| 541 rtp_header.header.payloadType != current_rtp_payload_type_ || | 539 rtp_header.header.payloadType != *current_rtp_payload_type_ || |
| 542 rtp_header.header.ssrc != ssrc_) { | 540 rtp_header.header.ssrc != ssrc_) { |
| 543 // Even if |current_rtp_payload_type_| is 0xFF, sync-packet isn't | 541 // Even if |current_rtp_payload_type_| is empty, sync-packet isn't |
| 544 // accepted. | 542 // accepted. |
| 545 LOG_F(LS_ERROR) | 543 LOG_F(LS_ERROR) |
| 546 << "Changing codec, SSRC or first packet with sync-packet."; | 544 << "Changing codec, SSRC or first packet with sync-packet."; |
| 547 return kSyncPacketNotAccepted; | 545 return kSyncPacketNotAccepted; |
| 548 } | 546 } |
| 549 } | 547 } |
| 550 PacketList packet_list; | 548 PacketList packet_list; |
| 551 RTPHeader main_header; | 549 RTPHeader main_header; |
| 552 { | 550 { |
| 553 // Convert to Packet. | 551 // Convert to Packet. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 736 PacketBuffer::DeleteAllPackets(&packet_list); | 734 PacketBuffer::DeleteAllPackets(&packet_list); |
| 737 return kOtherError; | 735 return kOtherError; |
| 738 } | 736 } |
| 739 | 737 |
| 740 if (first_packet_) { | 738 if (first_packet_) { |
| 741 first_packet_ = false; | 739 first_packet_ = false; |
| 742 // Update the codec on the next GetAudio call. | 740 // Update the codec on the next GetAudio call. |
| 743 new_codec_ = true; | 741 new_codec_ = true; |
| 744 } | 742 } |
| 745 | 743 |
| 746 RTC_DCHECK(current_rtp_payload_type_ == 0xFF || | 744 RTC_DCHECK(!current_rtp_payload_type_ || |
| 747 decoder_database_->GetDecoderInfo(current_rtp_payload_type_)) | 745 decoder_database_->GetDecoderInfo(*current_rtp_payload_type_)) |
| 748 << "Payload type " << static_cast<int>(current_rtp_payload_type_) | 746 << "Payload type " << static_cast<int>(*current_rtp_payload_type_) |
| 749 << " is unknown where it shouldn't be"; | 747 << " is unknown where it shouldn't be"; |
|
kwiberg-webrtc
2016/08/30 10:29:32
If !current_rtp_payload_type_, you evaluate *curre
hlundin-webrtc
2016/08/30 10:53:16
Oh, that's not good. Changed. Done.
| |
| 750 | 748 |
| 751 if (update_sample_rate_and_channels && !packet_buffer_->Empty()) { | 749 if (update_sample_rate_and_channels && !packet_buffer_->Empty()) { |
| 752 // We do not use |current_rtp_payload_type_| to |set payload_type|, but | 750 // We do not use |current_rtp_payload_type_| to |set payload_type|, but |
| 753 // get the next RTP header from |packet_buffer_| to obtain the payload type. | 751 // get the next RTP header from |packet_buffer_| to obtain the payload type. |
| 754 // The reason for it is the following corner case. If NetEq receives a | 752 // The reason for it is the following corner case. If NetEq receives a |
| 755 // CNG packet with a sample rate different than the current CNG then it | 753 // CNG packet with a sample rate different than the current CNG then it |
| 756 // flushes its buffer, assuming send codec must have been changed. However, | 754 // flushes its buffer, assuming send codec must have been changed. However, |
| 757 // payload type of the hypothetically new send codec is not known. | 755 // payload type of the hypothetically new send codec is not known. |
| 758 const RTPHeader* rtp_header = packet_buffer_->NextRtpHeader(); | 756 const RTPHeader* rtp_header = packet_buffer_->NextRtpHeader(); |
| 759 assert(rtp_header); | 757 assert(rtp_header); |
| (...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2135 } | 2133 } |
| 2136 } | 2134 } |
| 2137 | 2135 |
| 2138 void NetEqImpl::CreateDecisionLogic() { | 2136 void NetEqImpl::CreateDecisionLogic() { |
| 2139 decision_logic_.reset(DecisionLogic::Create( | 2137 decision_logic_.reset(DecisionLogic::Create( |
| 2140 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), | 2138 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), |
| 2141 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), | 2139 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), |
| 2142 tick_timer_.get())); | 2140 tick_timer_.get())); |
| 2143 } | 2141 } |
| 2144 } // namespace webrtc | 2142 } // namespace webrtc |
| OLD | NEW |