Chromium Code Reviews| 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 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1220 | 1220 |
| 1221 channel_state_.SetPlaying(false); | 1221 channel_state_.SetPlaying(false); |
| 1222 _outputAudioLevel.Clear(); | 1222 _outputAudioLevel.Clear(); |
| 1223 | 1223 |
| 1224 return 0; | 1224 return 0; |
| 1225 } | 1225 } |
| 1226 | 1226 |
| 1227 int32_t Channel::StartSend() { | 1227 int32_t Channel::StartSend() { |
| 1228 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 1228 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
| 1229 "Channel::StartSend()"); | 1229 "Channel::StartSend()"); |
| 1230 // Resume the previous sequence number which was reset by StopSend(). | |
| 1231 // This needs to be done before |sending| is set to true. | |
| 1232 if (send_sequence_number_) | |
| 1233 SetInitSequenceNumber(send_sequence_number_); | |
| 1234 | |
| 1235 if (channel_state_.Get().sending) { | 1230 if (channel_state_.Get().sending) { |
| 1236 return 0; | 1231 return 0; |
| 1237 } | 1232 } |
| 1238 channel_state_.SetSending(true); | 1233 channel_state_.SetSending(true); |
| 1239 | 1234 |
| 1235 // Resume the previous sequence number which was reset by StopSend(). | |
| 1236 // This needs to be done before |sending| is set to true. | |
|
kwiberg-webrtc
2017/02/09 10:16:40
Is this comment still good? It looks like you're d
the sun
2017/02/11 12:05:51
Updated the comment to be more clear. AFAICT it st
kwiberg-webrtc
2017/02/11 21:25:25
Oh, OK, it was referring to the _rtpRtcpModule->Se
| |
| 1237 if (send_sequence_number_) { | |
| 1238 _rtpRtcpModule->SetSequenceNumber(send_sequence_number_); | |
| 1239 } | |
| 1240 _rtpRtcpModule->SetSendingMediaStatus(true); | 1240 _rtpRtcpModule->SetSendingMediaStatus(true); |
| 1241 if (_rtpRtcpModule->SetSendingStatus(true) != 0) { | 1241 if (_rtpRtcpModule->SetSendingStatus(true) != 0) { |
| 1242 _engineStatisticsPtr->SetLastError( | 1242 _engineStatisticsPtr->SetLastError( |
| 1243 VE_RTP_RTCP_MODULE_ERROR, kTraceError, | 1243 VE_RTP_RTCP_MODULE_ERROR, kTraceError, |
| 1244 "StartSend() RTP/RTCP failed to start sending"); | 1244 "StartSend() RTP/RTCP failed to start sending"); |
| 1245 _rtpRtcpModule->SetSendingMediaStatus(false); | 1245 _rtpRtcpModule->SetSendingMediaStatus(false); |
| 1246 rtc::CritScope cs(&_callbackCritSect); | 1246 rtc::CritScope cs(&_callbackCritSect); |
| 1247 channel_state_.SetSending(false); | 1247 channel_state_.SetSending(false); |
| 1248 return -1; | 1248 return -1; |
| 1249 } | 1249 } |
| (...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3006 } | 3006 } |
| 3007 | 3007 |
| 3008 int Channel::GetNetworkStatistics(NetworkStatistics& stats) { | 3008 int Channel::GetNetworkStatistics(NetworkStatistics& stats) { |
| 3009 return audio_coding_->GetNetworkStatistics(&stats); | 3009 return audio_coding_->GetNetworkStatistics(&stats); |
| 3010 } | 3010 } |
| 3011 | 3011 |
| 3012 void Channel::GetDecodingCallStatistics(AudioDecodingCallStats* stats) const { | 3012 void Channel::GetDecodingCallStatistics(AudioDecodingCallStats* stats) const { |
| 3013 audio_coding_->GetDecodingCallStatistics(stats); | 3013 audio_coding_->GetDecodingCallStatistics(stats); |
| 3014 } | 3014 } |
| 3015 | 3015 |
| 3016 bool Channel::GetDelayEstimate(int* jitter_buffer_delay_ms, | 3016 uint32_t Channel::GetDelayEstimate() const { |
| 3017 int* playout_buffer_delay_ms) const { | |
| 3018 rtc::CritScope lock(&video_sync_lock_); | 3017 rtc::CritScope lock(&video_sync_lock_); |
| 3019 *jitter_buffer_delay_ms = audio_coding_->FilteredCurrentDelayMs(); | 3018 return audio_coding_->FilteredCurrentDelayMs() + playout_delay_ms_; |
| 3020 *playout_buffer_delay_ms = playout_delay_ms_; | |
| 3021 return true; | |
| 3022 } | |
| 3023 | |
| 3024 uint32_t Channel::GetDelayEstimate() const { | |
| 3025 int jitter_buffer_delay_ms = 0; | |
| 3026 int playout_buffer_delay_ms = 0; | |
| 3027 GetDelayEstimate(&jitter_buffer_delay_ms, &playout_buffer_delay_ms); | |
| 3028 return jitter_buffer_delay_ms + playout_buffer_delay_ms; | |
| 3029 } | |
| 3030 | |
| 3031 int Channel::LeastRequiredDelayMs() const { | |
| 3032 return audio_coding_->LeastRequiredDelayMs(); | |
| 3033 } | 3019 } |
| 3034 | 3020 |
| 3035 int Channel::SetMinimumPlayoutDelay(int delayMs) { | 3021 int Channel::SetMinimumPlayoutDelay(int delayMs) { |
| 3036 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 3022 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
| 3037 "Channel::SetMinimumPlayoutDelay()"); | 3023 "Channel::SetMinimumPlayoutDelay()"); |
| 3038 if ((delayMs < kVoiceEngineMinMinPlayoutDelayMs) || | 3024 if ((delayMs < kVoiceEngineMinMinPlayoutDelayMs) || |
| 3039 (delayMs > kVoiceEngineMaxMinPlayoutDelayMs)) { | 3025 (delayMs > kVoiceEngineMaxMinPlayoutDelayMs)) { |
| 3040 _engineStatisticsPtr->SetLastError( | 3026 _engineStatisticsPtr->SetLastError( |
| 3041 VE_INVALID_ARGUMENT, kTraceError, | 3027 VE_INVALID_ARGUMENT, kTraceError, |
| 3042 "SetMinimumPlayoutDelay() invalid min delay"); | 3028 "SetMinimumPlayoutDelay() invalid min delay"); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 3060 if (playout_timestamp_rtp == 0) { | 3046 if (playout_timestamp_rtp == 0) { |
| 3061 _engineStatisticsPtr->SetLastError( | 3047 _engineStatisticsPtr->SetLastError( |
| 3062 VE_CANNOT_RETRIEVE_VALUE, kTraceStateInfo, | 3048 VE_CANNOT_RETRIEVE_VALUE, kTraceStateInfo, |
| 3063 "GetPlayoutTimestamp() failed to retrieve timestamp"); | 3049 "GetPlayoutTimestamp() failed to retrieve timestamp"); |
| 3064 return -1; | 3050 return -1; |
| 3065 } | 3051 } |
| 3066 timestamp = playout_timestamp_rtp; | 3052 timestamp = playout_timestamp_rtp; |
| 3067 return 0; | 3053 return 0; |
| 3068 } | 3054 } |
| 3069 | 3055 |
| 3070 int Channel::SetInitTimestamp(unsigned int timestamp) { | |
| 3071 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | |
| 3072 "Channel::SetInitTimestamp()"); | |
| 3073 if (channel_state_.Get().sending) { | |
| 3074 _engineStatisticsPtr->SetLastError(VE_SENDING, kTraceError, | |
| 3075 "SetInitTimestamp() already sending"); | |
| 3076 return -1; | |
| 3077 } | |
| 3078 _rtpRtcpModule->SetStartTimestamp(timestamp); | |
| 3079 return 0; | |
| 3080 } | |
| 3081 | |
| 3082 int Channel::SetInitSequenceNumber(short sequenceNumber) { | |
| 3083 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | |
| 3084 "Channel::SetInitSequenceNumber()"); | |
| 3085 if (channel_state_.Get().sending) { | |
| 3086 _engineStatisticsPtr->SetLastError( | |
| 3087 VE_SENDING, kTraceError, "SetInitSequenceNumber() already sending"); | |
| 3088 return -1; | |
| 3089 } | |
| 3090 _rtpRtcpModule->SetSequenceNumber(sequenceNumber); | |
| 3091 return 0; | |
| 3092 } | |
| 3093 | |
| 3094 int Channel::GetRtpRtcp(RtpRtcp** rtpRtcpModule, | 3056 int Channel::GetRtpRtcp(RtpRtcp** rtpRtcpModule, |
| 3095 RtpReceiver** rtp_receiver) const { | 3057 RtpReceiver** rtp_receiver) const { |
| 3096 *rtpRtcpModule = _rtpRtcpModule.get(); | 3058 *rtpRtcpModule = _rtpRtcpModule.get(); |
| 3097 *rtp_receiver = rtp_receiver_.get(); | 3059 *rtp_receiver = rtp_receiver_.get(); |
| 3098 return 0; | 3060 return 0; |
| 3099 } | 3061 } |
| 3100 | 3062 |
| 3101 // TODO(andrew): refactor Mix functions here and in transmit_mixer.cc to use | 3063 // TODO(andrew): refactor Mix functions here and in transmit_mixer.cc to use |
| 3102 // a shared helper. | 3064 // a shared helper. |
| 3103 int32_t Channel::MixOrReplaceAudioWithFile(int mixingFrequency) { | 3065 int32_t Channel::MixOrReplaceAudioWithFile(int mixingFrequency) { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3324 int64_t min_rtt = 0; | 3286 int64_t min_rtt = 0; |
| 3325 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3287 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
| 3326 0) { | 3288 0) { |
| 3327 return 0; | 3289 return 0; |
| 3328 } | 3290 } |
| 3329 return rtt; | 3291 return rtt; |
| 3330 } | 3292 } |
| 3331 | 3293 |
| 3332 } // namespace voe | 3294 } // namespace voe |
| 3333 } // namespace webrtc | 3295 } // namespace webrtc |
| OLD | NEW |