Chromium Code Reviews| Index: webrtc/modules/audio_coding/neteq/neteq_impl.cc |
| diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc |
| index 786cb84aa3ed8beffb5d6d6bb9f7db8d74267afc..1dc6cb43b831d503a895ba034b6ff6381758349a 100644 |
| --- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc |
| +++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc |
| @@ -594,6 +594,20 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header, |
| return packet; |
| }()); |
| + 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
|
| + // Reset timestamp scaling. |
| + timestamp_scaler_->Reset(); |
| + } |
| + |
| + // Scale timestamp to internal domain (only for some codecs). |
| + timestamp_scaler_->ToInternal(&packet_list); |
| + |
| + // Store these for later use, since the first packet may very well disappear |
| + // before we need these values. |
| + const uint32_t main_timestamp = packet_list.front().timestamp; |
| + const uint8_t main_payload_type = packet_list.front().payload_type; |
| + const uint16_t main_sequence_number = packet_list.front().sequence_number; |
| + |
| bool update_sample_rate_and_channels = false; |
| // Reinitialize NetEq if it's needed (changed SSRC or first call). |
| if ((rtp_header.header.ssrc != ssrc_) || first_packet_) { |
| @@ -610,14 +624,10 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header, |
| ssrc_ = rtp_header.header.ssrc; |
| // Update audio buffer timestamp. |
| - sync_buffer_->IncreaseEndTimestamp(rtp_header.header.timestamp - |
| - timestamp_); |
| + sync_buffer_->IncreaseEndTimestamp(main_timestamp - timestamp_); |
| // Update codecs. |
| - timestamp_ = rtp_header.header.timestamp; |
| - |
| - // Reset timestamp scaling. |
| - timestamp_scaler_->Reset(); |
| + timestamp_ = main_timestamp; |
| // Trigger an update of sampling rate and the number of channels. |
| update_sample_rate_and_channels = true; |
| @@ -652,14 +662,6 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header, |
| } |
| RTC_DCHECK(!packet_list.empty()); |
| - // Store these for later use, since the first packet may very well disappear |
| - // before we need these values. |
| - const uint32_t main_timestamp = packet_list.front().timestamp; |
| - const uint8_t main_payload_type = packet_list.front().payload_type; |
| - const uint16_t main_sequence_number = packet_list.front().sequence_number; |
| - |
| - // Scale timestamp to internal domain (only for some codecs). |
| - timestamp_scaler_->ToInternal(&packet_list); |
| // Process DTMF payloads. Cycle through the list of packets, and pick out any |
| // DTMF payloads found. |