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 if (current_rtp_payload_type_ != 0xFF) { |
ivoc
2016/08/24 15:18:01
I was wondering if it makes sense to turn this who
hlundin-webrtc
2016/08/24 15:35:24
Good idea. Done.
| |
748 const DecoderDatabase::DecoderInfo* dec_info = | 747 const DecoderDatabase::DecoderInfo* dec_info = |
749 decoder_database_->GetDecoderInfo(current_rtp_payload_type_); | 748 decoder_database_->GetDecoderInfo(current_rtp_payload_type_); |
750 if (!dec_info) { | 749 RTC_DCHECK(dec_info) << "Payload type " |
751 assert(false); // Already checked that the payload type is known. | 750 << static_cast<int>(current_rtp_payload_type_) |
752 } | 751 << " is unknown where it shouldn't be"; |
753 } | 752 } |
754 | 753 |
755 if (update_sample_rate_and_channels && !packet_buffer_->Empty()) { | 754 if (update_sample_rate_and_channels && !packet_buffer_->Empty()) { |
756 // We do not use |current_rtp_payload_type_| to |set payload_type|, but | 755 // 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. | 756 // 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 | 757 // 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 | 758 // 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, | 759 // flushes its buffer, assuming send codec must have been changed. However, |
761 // payload type of the hypothetically new send codec is not known. | 760 // payload type of the hypothetically new send codec is not known. |
762 const RTPHeader* rtp_header = packet_buffer_->NextRtpHeader(); | 761 const RTPHeader* rtp_header = packet_buffer_->NextRtpHeader(); |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2139 } | 2138 } |
2140 } | 2139 } |
2141 | 2140 |
2142 void NetEqImpl::CreateDecisionLogic() { | 2141 void NetEqImpl::CreateDecisionLogic() { |
2143 decision_logic_.reset(DecisionLogic::Create( | 2142 decision_logic_.reset(DecisionLogic::Create( |
2144 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), | 2143 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), |
2145 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), | 2144 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), |
2146 tick_timer_.get())); | 2145 tick_timer_.get())); |
2147 } | 2146 } |
2148 } // namespace webrtc | 2147 } // namespace webrtc |
OLD | NEW |