Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_impl.cc

Issue 2743063005: Fixed problems in neteq when RTP and decoder timestamps increment with (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 Packet packet; 587 Packet packet;
588 packet.payload_type = rtp_header.header.payloadType; 588 packet.payload_type = rtp_header.header.payloadType;
589 packet.sequence_number = rtp_header.header.sequenceNumber; 589 packet.sequence_number = rtp_header.header.sequenceNumber;
590 packet.timestamp = rtp_header.header.timestamp; 590 packet.timestamp = rtp_header.header.timestamp;
591 packet.payload.SetData(payload.data(), payload.size()); 591 packet.payload.SetData(payload.data(), payload.size());
592 // Waiting time will be set upon inserting the packet in the buffer. 592 // Waiting time will be set upon inserting the packet in the buffer.
593 RTC_DCHECK(!packet.waiting_time); 593 RTC_DCHECK(!packet.waiting_time);
594 return packet; 594 return packet;
595 }()); 595 }());
596 596
597 if ((rtp_header.header.ssrc != ssrc_) || first_packet_) {
ossu 2017/03/13 15:03:17 It seems to me that update_sample_rate_and_channel
598 // Reset timestamp scaling.
599 timestamp_scaler_->Reset();
600 }
601
602 // Scale timestamp to internal domain (only for some codecs).
603 timestamp_scaler_->ToInternal(&packet_list);
604
605 // Store these for later use, since the first packet may very well disappear
606 // before we need these values.
607 const uint32_t main_timestamp = packet_list.front().timestamp;
608 const uint8_t main_payload_type = packet_list.front().payload_type;
609 const uint16_t main_sequence_number = packet_list.front().sequence_number;
610
597 bool update_sample_rate_and_channels = false; 611 bool update_sample_rate_and_channels = false;
598 // Reinitialize NetEq if it's needed (changed SSRC or first call). 612 // Reinitialize NetEq if it's needed (changed SSRC or first call).
599 if ((rtp_header.header.ssrc != ssrc_) || first_packet_) { 613 if ((rtp_header.header.ssrc != ssrc_) || first_packet_) {
600 // Note: |first_packet_| will be cleared further down in this method, once 614 // Note: |first_packet_| will be cleared further down in this method, once
601 // the packet has been successfully inserted into the packet buffer. 615 // the packet has been successfully inserted into the packet buffer.
602 616
603 rtcp_.Init(rtp_header.header.sequenceNumber); 617 rtcp_.Init(rtp_header.header.sequenceNumber);
604 618
605 // Flush the packet buffer and DTMF buffer. 619 // Flush the packet buffer and DTMF buffer.
606 packet_buffer_->Flush(); 620 packet_buffer_->Flush();
607 dtmf_buffer_->Flush(); 621 dtmf_buffer_->Flush();
608 622
609 // Store new SSRC. 623 // Store new SSRC.
610 ssrc_ = rtp_header.header.ssrc; 624 ssrc_ = rtp_header.header.ssrc;
611 625
612 // Update audio buffer timestamp. 626 // Update audio buffer timestamp.
613 sync_buffer_->IncreaseEndTimestamp(rtp_header.header.timestamp - 627 sync_buffer_->IncreaseEndTimestamp(main_timestamp - timestamp_);
614 timestamp_);
615 628
616 // Update codecs. 629 // Update codecs.
617 timestamp_ = rtp_header.header.timestamp; 630 timestamp_ = main_timestamp;
618
619 // Reset timestamp scaling.
620 timestamp_scaler_->Reset();
621 631
622 // Trigger an update of sampling rate and the number of channels. 632 // Trigger an update of sampling rate and the number of channels.
623 update_sample_rate_and_channels = true; 633 update_sample_rate_and_channels = true;
624 } 634 }
625 635
626 // Update RTCP statistics, only for regular packets. 636 // Update RTCP statistics, only for regular packets.
627 rtcp_.Update(rtp_header.header, receive_timestamp); 637 rtcp_.Update(rtp_header.header, receive_timestamp);
628 638
629 if (nack_enabled_) { 639 if (nack_enabled_) {
630 RTC_DCHECK(nack_); 640 RTC_DCHECK(nack_);
(...skipping 14 matching lines...) Expand all
645 red_payload_splitter_->CheckRedPayloads(&packet_list, *decoder_database_); 655 red_payload_splitter_->CheckRedPayloads(&packet_list, *decoder_database_);
646 } 656 }
647 657
648 // Check payload types. 658 // Check payload types.
649 if (decoder_database_->CheckPayloadTypes(packet_list) == 659 if (decoder_database_->CheckPayloadTypes(packet_list) ==
650 DecoderDatabase::kDecoderNotFound) { 660 DecoderDatabase::kDecoderNotFound) {
651 return kUnknownRtpPayloadType; 661 return kUnknownRtpPayloadType;
652 } 662 }
653 663
654 RTC_DCHECK(!packet_list.empty()); 664 RTC_DCHECK(!packet_list.empty());
655 // Store these for later use, since the first packet may very well disappear
656 // before we need these values.
657 const uint32_t main_timestamp = packet_list.front().timestamp;
658 const uint8_t main_payload_type = packet_list.front().payload_type;
659 const uint16_t main_sequence_number = packet_list.front().sequence_number;
660
661 // Scale timestamp to internal domain (only for some codecs).
662 timestamp_scaler_->ToInternal(&packet_list);
663 665
664 // Process DTMF payloads. Cycle through the list of packets, and pick out any 666 // Process DTMF payloads. Cycle through the list of packets, and pick out any
665 // DTMF payloads found. 667 // DTMF payloads found.
666 PacketList::iterator it = packet_list.begin(); 668 PacketList::iterator it = packet_list.begin();
667 while (it != packet_list.end()) { 669 while (it != packet_list.end()) {
668 const Packet& current_packet = (*it); 670 const Packet& current_packet = (*it);
669 RTC_DCHECK(!current_packet.payload.empty()); 671 RTC_DCHECK(!current_packet.payload.empty());
670 if (decoder_database_->IsDtmf(current_packet.payload_type)) { 672 if (decoder_database_->IsDtmf(current_packet.payload_type)) {
671 DtmfEvent event; 673 DtmfEvent event;
672 int ret = DtmfBuffer::ParseEvent(current_packet.timestamp, 674 int ret = DtmfBuffer::ParseEvent(current_packet.timestamp,
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 } 2130 }
2129 } 2131 }
2130 2132
2131 void NetEqImpl::CreateDecisionLogic() { 2133 void NetEqImpl::CreateDecisionLogic() {
2132 decision_logic_.reset(DecisionLogic::Create( 2134 decision_logic_.reset(DecisionLogic::Create(
2133 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), 2135 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(),
2134 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), 2136 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(),
2135 tick_timer_.get())); 2137 tick_timer_.get()));
2136 } 2138 }
2137 } // namespace webrtc 2139 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698