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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 dtmf_buffer_->Flush(); | 591 dtmf_buffer_->Flush(); |
592 | 592 |
593 // Store new SSRC. | 593 // Store new SSRC. |
594 ssrc_ = main_header.ssrc; | 594 ssrc_ = main_header.ssrc; |
595 | 595 |
596 // Update audio buffer timestamp. | 596 // Update audio buffer timestamp. |
597 sync_buffer_->IncreaseEndTimestamp(main_header.timestamp - timestamp_); | 597 sync_buffer_->IncreaseEndTimestamp(main_header.timestamp - timestamp_); |
598 | 598 |
599 // Update codecs. | 599 // Update codecs. |
600 timestamp_ = main_header.timestamp; | 600 timestamp_ = main_header.timestamp; |
601 current_rtp_payload_type_ = main_header.payloadType; | |
602 | 601 |
603 // Reset timestamp scaling. | 602 // Reset timestamp scaling. |
604 timestamp_scaler_->Reset(); | 603 timestamp_scaler_->Reset(); |
605 | 604 |
606 // Trigger an update of sampling rate and the number of channels. | 605 // Trigger an update of sampling rate and the number of channels. |
607 update_sample_rate_and_channels = true; | 606 update_sample_rate_and_channels = true; |
608 } | 607 } |
609 | 608 |
610 // Update RTCP statistics, only for regular packets. | 609 // Update RTCP statistics, only for regular packets. |
611 if (!is_sync_packet) | 610 if (!is_sync_packet) |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 PacketBuffer::DeleteAllPackets(&packet_list); | 736 PacketBuffer::DeleteAllPackets(&packet_list); |
738 return kOtherError; | 737 return kOtherError; |
739 } | 738 } |
740 | 739 |
741 if (first_packet_) { | 740 if (first_packet_) { |
742 first_packet_ = false; | 741 first_packet_ = false; |
743 // Update the codec on the next GetAudio call. | 742 // Update the codec on the next GetAudio call. |
744 new_codec_ = true; | 743 new_codec_ = true; |
745 } | 744 } |
746 | 745 |
747 if (current_rtp_payload_type_ != 0xFF) { | 746 RTC_DCHECK(current_rtp_payload_type_ == 0xFF || |
748 const DecoderDatabase::DecoderInfo* dec_info = | 747 decoder_database_->GetDecoderInfo(current_rtp_payload_type_)) |
749 decoder_database_->GetDecoderInfo(current_rtp_payload_type_); | 748 << "Payload type " << static_cast<int>(current_rtp_payload_type_) |
750 if (!dec_info) { | 749 << " is unknown where it shouldn't be"; |
751 assert(false); // Already checked that the payload type is known. | |
752 } | |
753 } | |
754 | 750 |
755 if (update_sample_rate_and_channels && !packet_buffer_->Empty()) { | 751 if (update_sample_rate_and_channels && !packet_buffer_->Empty()) { |
756 // We do not use |current_rtp_payload_type_| to |set payload_type|, but | 752 // We do not use |current_rtp_payload_type_| to |set payload_type|, but |
757 // get the next RTP header from |packet_buffer_| to obtain the payload type. | 753 // get the next RTP header from |packet_buffer_| to obtain the payload type. |
758 // The reason for it is the following corner case. If NetEq receives a | 754 // The reason for it is the following corner case. If NetEq receives a |
759 // CNG packet with a sample rate different than the current CNG then it | 755 // CNG packet with a sample rate different than the current CNG then it |
760 // flushes its buffer, assuming send codec must have been changed. However, | 756 // flushes its buffer, assuming send codec must have been changed. However, |
761 // payload type of the hypothetically new send codec is not known. | 757 // payload type of the hypothetically new send codec is not known. |
762 const RTPHeader* rtp_header = packet_buffer_->NextRtpHeader(); | 758 const RTPHeader* rtp_header = packet_buffer_->NextRtpHeader(); |
763 assert(rtp_header); | 759 assert(rtp_header); |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 } | 2135 } |
2140 } | 2136 } |
2141 | 2137 |
2142 void NetEqImpl::CreateDecisionLogic() { | 2138 void NetEqImpl::CreateDecisionLogic() { |
2143 decision_logic_.reset(DecisionLogic::Create( | 2139 decision_logic_.reset(DecisionLogic::Create( |
2144 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), | 2140 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), |
2145 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), | 2141 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), |
2146 tick_timer_.get())); | 2142 tick_timer_.get())); |
2147 } | 2143 } |
2148 } // namespace webrtc | 2144 } // namespace webrtc |
OLD | NEW |