Chromium Code Reviews| Index: webrtc/voice_engine/channel.cc |
| diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc |
| index 582bde5f26216f645340ef2102d87e485ff2fafb..094cbfd74895f5734ca2f17eeefbe0d11db0ad40 100644 |
| --- a/webrtc/voice_engine/channel.cc |
| +++ b/webrtc/voice_engine/channel.cc |
| @@ -674,7 +674,7 @@ MixerParticipant::AudioFrameInfo Channel::GetAudioFrameWithMuted( |
| rtp_ts_wraparound_handler_->Unwrap(audioFrame->timestamp_); |
| audioFrame->elapsed_time_ms_ = |
| (unwrap_timestamp - capture_start_rtp_time_stamp_) / |
| - (GetPlayoutFrequency() / 1000); |
| + (GetRtpTimestampRateHz() / 1000); |
| { |
| rtc::CritScope lock(&ts_stats_lock_); |
| @@ -3080,7 +3080,7 @@ void Channel::UpdatePlayoutTimestamp(bool rtcp) { |
| uint32_t playout_timestamp = *jitter_buffer_playout_timestamp_; |
| // Remove the playout delay. |
| - playout_timestamp -= (delay_ms * (GetPlayoutFrequency() / 1000)); |
| + playout_timestamp -= (delay_ms * (GetRtpTimestampRateHz() / 1000)); |
| WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), |
| "Channel::UpdatePlayoutTimestamp() => playoutTimestamp = %lu", |
| @@ -3140,25 +3140,11 @@ int Channel::SetSendRtpHeaderExtension(bool enable, |
| return error; |
| } |
| -int32_t Channel::GetPlayoutFrequency() const { |
| - int32_t playout_frequency = audio_coding_->PlayoutFrequency(); |
| - CodecInst current_recive_codec; |
| - if (audio_coding_->ReceiveCodec(¤t_recive_codec) == 0) { |
| - if (STR_CASE_CMP("G722", current_recive_codec.plname) == 0) { |
| - // Even though the actual sampling rate for G.722 audio is |
| - // 16,000 Hz, the RTP clock rate for the G722 payload format is |
| - // 8,000 Hz because that value was erroneously assigned in |
| - // RFC 1890 and must remain unchanged for backward compatibility. |
| - playout_frequency = 8000; |
| - } else if (STR_CASE_CMP("opus", current_recive_codec.plname) == 0) { |
| - // We are resampling Opus internally to 32,000 Hz until all our |
| - // DSP routines can operate at 48,000 Hz, but the RTP clock |
| - // rate for the Opus payload format is standardized to 48,000 Hz, |
| - // because that is the maximum supported decoding sampling rate. |
| - playout_frequency = 48000; |
| - } |
| - } |
| - return playout_frequency; |
| +int Channel::GetRtpTimestampRateHz() const { |
| + const auto format = audio_coding_->ReceiveFormat(); |
| + // Default to the playout frequency if we've not gottten any packets yet. |
| + return format ? format->clockrate_hz |
| + : audio_coding_->PlayoutFrequency(); |
|
kwiberg-webrtc
2016/10/07 12:05:23
Nice simplification! You always take the clockrate
ossu
2016/10/07 12:21:59
Yes, I believe the result is the same. If we weren
|
| } |
| int64_t Channel::GetRTT(bool allow_associate_channel) const { |