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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 | 1143 |
1144 channel_state_.SetPlaying(false); | 1144 channel_state_.SetPlaying(false); |
1145 _outputAudioLevel.Clear(); | 1145 _outputAudioLevel.Clear(); |
1146 | 1146 |
1147 return 0; | 1147 return 0; |
1148 } | 1148 } |
1149 | 1149 |
1150 int32_t Channel::StartSend() { | 1150 int32_t Channel::StartSend() { |
1151 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 1151 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
1152 "Channel::StartSend()"); | 1152 "Channel::StartSend()"); |
1153 // Resume the previous sequence number which was reset by StopSend(). | |
1154 // This needs to be done before |sending| is set to true. | |
1155 if (send_sequence_number_) | |
1156 SetInitSequenceNumber(send_sequence_number_); | |
1157 | |
1158 if (channel_state_.Get().sending) { | 1153 if (channel_state_.Get().sending) { |
1159 return 0; | 1154 return 0; |
1160 } | 1155 } |
1161 channel_state_.SetSending(true); | 1156 channel_state_.SetSending(true); |
1162 | 1157 |
| 1158 // Resume the previous sequence number which was reset by StopSend(). This |
| 1159 // needs to be done before |sending| is set to true on the RTP/RTCP module. |
| 1160 if (send_sequence_number_) { |
| 1161 _rtpRtcpModule->SetSequenceNumber(send_sequence_number_); |
| 1162 } |
1163 _rtpRtcpModule->SetSendingMediaStatus(true); | 1163 _rtpRtcpModule->SetSendingMediaStatus(true); |
1164 if (_rtpRtcpModule->SetSendingStatus(true) != 0) { | 1164 if (_rtpRtcpModule->SetSendingStatus(true) != 0) { |
1165 _engineStatisticsPtr->SetLastError( | 1165 _engineStatisticsPtr->SetLastError( |
1166 VE_RTP_RTCP_MODULE_ERROR, kTraceError, | 1166 VE_RTP_RTCP_MODULE_ERROR, kTraceError, |
1167 "StartSend() RTP/RTCP failed to start sending"); | 1167 "StartSend() RTP/RTCP failed to start sending"); |
1168 _rtpRtcpModule->SetSendingMediaStatus(false); | 1168 _rtpRtcpModule->SetSendingMediaStatus(false); |
1169 rtc::CritScope cs(&_callbackCritSect); | 1169 rtc::CritScope cs(&_callbackCritSect); |
1170 channel_state_.SetSending(false); | 1170 channel_state_.SetSending(false); |
1171 return -1; | 1171 return -1; |
1172 } | 1172 } |
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 } | 2733 } |
2734 | 2734 |
2735 int Channel::GetNetworkStatistics(NetworkStatistics& stats) { | 2735 int Channel::GetNetworkStatistics(NetworkStatistics& stats) { |
2736 return audio_coding_->GetNetworkStatistics(&stats); | 2736 return audio_coding_->GetNetworkStatistics(&stats); |
2737 } | 2737 } |
2738 | 2738 |
2739 void Channel::GetDecodingCallStatistics(AudioDecodingCallStats* stats) const { | 2739 void Channel::GetDecodingCallStatistics(AudioDecodingCallStats* stats) const { |
2740 audio_coding_->GetDecodingCallStatistics(stats); | 2740 audio_coding_->GetDecodingCallStatistics(stats); |
2741 } | 2741 } |
2742 | 2742 |
2743 bool Channel::GetDelayEstimate(int* jitter_buffer_delay_ms, | 2743 uint32_t Channel::GetDelayEstimate() const { |
2744 int* playout_buffer_delay_ms) const { | |
2745 rtc::CritScope lock(&video_sync_lock_); | 2744 rtc::CritScope lock(&video_sync_lock_); |
2746 *jitter_buffer_delay_ms = audio_coding_->FilteredCurrentDelayMs(); | 2745 return audio_coding_->FilteredCurrentDelayMs() + playout_delay_ms_; |
2747 *playout_buffer_delay_ms = playout_delay_ms_; | |
2748 return true; | |
2749 } | |
2750 | |
2751 uint32_t Channel::GetDelayEstimate() const { | |
2752 int jitter_buffer_delay_ms = 0; | |
2753 int playout_buffer_delay_ms = 0; | |
2754 GetDelayEstimate(&jitter_buffer_delay_ms, &playout_buffer_delay_ms); | |
2755 return jitter_buffer_delay_ms + playout_buffer_delay_ms; | |
2756 } | |
2757 | |
2758 int Channel::LeastRequiredDelayMs() const { | |
2759 return audio_coding_->LeastRequiredDelayMs(); | |
2760 } | 2746 } |
2761 | 2747 |
2762 int Channel::SetMinimumPlayoutDelay(int delayMs) { | 2748 int Channel::SetMinimumPlayoutDelay(int delayMs) { |
2763 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 2749 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
2764 "Channel::SetMinimumPlayoutDelay()"); | 2750 "Channel::SetMinimumPlayoutDelay()"); |
2765 if ((delayMs < kVoiceEngineMinMinPlayoutDelayMs) || | 2751 if ((delayMs < kVoiceEngineMinMinPlayoutDelayMs) || |
2766 (delayMs > kVoiceEngineMaxMinPlayoutDelayMs)) { | 2752 (delayMs > kVoiceEngineMaxMinPlayoutDelayMs)) { |
2767 _engineStatisticsPtr->SetLastError( | 2753 _engineStatisticsPtr->SetLastError( |
2768 VE_INVALID_ARGUMENT, kTraceError, | 2754 VE_INVALID_ARGUMENT, kTraceError, |
2769 "SetMinimumPlayoutDelay() invalid min delay"); | 2755 "SetMinimumPlayoutDelay() invalid min delay"); |
(...skipping 17 matching lines...) Expand all Loading... |
2787 if (playout_timestamp_rtp == 0) { | 2773 if (playout_timestamp_rtp == 0) { |
2788 _engineStatisticsPtr->SetLastError( | 2774 _engineStatisticsPtr->SetLastError( |
2789 VE_CANNOT_RETRIEVE_VALUE, kTraceStateInfo, | 2775 VE_CANNOT_RETRIEVE_VALUE, kTraceStateInfo, |
2790 "GetPlayoutTimestamp() failed to retrieve timestamp"); | 2776 "GetPlayoutTimestamp() failed to retrieve timestamp"); |
2791 return -1; | 2777 return -1; |
2792 } | 2778 } |
2793 timestamp = playout_timestamp_rtp; | 2779 timestamp = playout_timestamp_rtp; |
2794 return 0; | 2780 return 0; |
2795 } | 2781 } |
2796 | 2782 |
2797 int Channel::SetInitTimestamp(unsigned int timestamp) { | |
2798 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | |
2799 "Channel::SetInitTimestamp()"); | |
2800 if (channel_state_.Get().sending) { | |
2801 _engineStatisticsPtr->SetLastError(VE_SENDING, kTraceError, | |
2802 "SetInitTimestamp() already sending"); | |
2803 return -1; | |
2804 } | |
2805 _rtpRtcpModule->SetStartTimestamp(timestamp); | |
2806 return 0; | |
2807 } | |
2808 | |
2809 int Channel::SetInitSequenceNumber(short sequenceNumber) { | |
2810 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | |
2811 "Channel::SetInitSequenceNumber()"); | |
2812 if (channel_state_.Get().sending) { | |
2813 _engineStatisticsPtr->SetLastError( | |
2814 VE_SENDING, kTraceError, "SetInitSequenceNumber() already sending"); | |
2815 return -1; | |
2816 } | |
2817 _rtpRtcpModule->SetSequenceNumber(sequenceNumber); | |
2818 return 0; | |
2819 } | |
2820 | |
2821 int Channel::GetRtpRtcp(RtpRtcp** rtpRtcpModule, | 2783 int Channel::GetRtpRtcp(RtpRtcp** rtpRtcpModule, |
2822 RtpReceiver** rtp_receiver) const { | 2784 RtpReceiver** rtp_receiver) const { |
2823 *rtpRtcpModule = _rtpRtcpModule.get(); | 2785 *rtpRtcpModule = _rtpRtcpModule.get(); |
2824 *rtp_receiver = rtp_receiver_.get(); | 2786 *rtp_receiver = rtp_receiver_.get(); |
2825 return 0; | 2787 return 0; |
2826 } | 2788 } |
2827 | 2789 |
2828 // TODO(andrew): refactor Mix functions here and in transmit_mixer.cc to use | 2790 // TODO(andrew): refactor Mix functions here and in transmit_mixer.cc to use |
2829 // a shared helper. | 2791 // a shared helper. |
2830 int32_t Channel::MixOrReplaceAudioWithFile(int mixingFrequency) { | 2792 int32_t Channel::MixOrReplaceAudioWithFile(int mixingFrequency) { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3049 int64_t min_rtt = 0; | 3011 int64_t min_rtt = 0; |
3050 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3012 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
3051 0) { | 3013 0) { |
3052 return 0; | 3014 return 0; |
3053 } | 3015 } |
3054 return rtt; | 3016 return rtt; |
3055 } | 3017 } |
3056 | 3018 |
3057 } // namespace voe | 3019 } // namespace voe |
3058 } // namespace webrtc | 3020 } // namespace webrtc |
OLD | NEW |