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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 rtc::CritScope lock(&crit_); | 143 rtc::CritScope lock(&crit_); |
144 event_log_ = event_log; | 144 event_log_ = event_log; |
145 } | 145 } |
146 | 146 |
147 private: | 147 private: |
148 rtc::CriticalSection crit_; | 148 rtc::CriticalSection crit_; |
149 RtcEventLog* event_log_ GUARDED_BY(crit_); | 149 RtcEventLog* event_log_ GUARDED_BY(crit_); |
150 RTC_DISALLOW_COPY_AND_ASSIGN(RtcEventLogProxy); | 150 RTC_DISALLOW_COPY_AND_ASSIGN(RtcEventLogProxy); |
151 }; | 151 }; |
152 | 152 |
153 class RtcpRttStatsProxy final : public RtcpRttStats { | |
154 public: | |
155 RtcpRttStatsProxy() : rtcp_rtt_stats_(nullptr) {} | |
156 | |
157 void OnRttUpdate(int64_t rtt) override { | |
158 rtc::CritScope lock(&crit_); | |
159 if (rtcp_rtt_stats_) | |
160 rtcp_rtt_stats_->OnRttUpdate(rtt); | |
161 } | |
162 | |
163 int64_t LastProcessedRtt() const override { | |
164 rtc::CritScope lock(&crit_); | |
165 if (rtcp_rtt_stats_ == nullptr) | |
the sun
2016/11/28 13:20:58
nit: !rtcp_rtt_stats_
michaelt
2016/11/28 13:47:35
Done.
| |
166 return 0; | |
167 return rtcp_rtt_stats_->LastProcessedRtt(); | |
168 } | |
169 | |
170 void SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) { | |
171 rtc::CritScope lock(&crit_); | |
172 rtcp_rtt_stats_ = rtcp_rtt_stats; | |
173 } | |
174 | |
175 private: | |
176 rtc::CriticalSection crit_; | |
177 RtcpRttStats* rtcp_rtt_stats_ GUARDED_BY(crit_); | |
178 RTC_DISALLOW_COPY_AND_ASSIGN(RtcpRttStatsProxy); | |
179 }; | |
180 | |
153 class TransportFeedbackProxy : public TransportFeedbackObserver { | 181 class TransportFeedbackProxy : public TransportFeedbackObserver { |
154 public: | 182 public: |
155 TransportFeedbackProxy() : feedback_observer_(nullptr) { | 183 TransportFeedbackProxy() : feedback_observer_(nullptr) { |
156 pacer_thread_.DetachFromThread(); | 184 pacer_thread_.DetachFromThread(); |
157 network_thread_.DetachFromThread(); | 185 network_thread_.DetachFromThread(); |
158 } | 186 } |
159 | 187 |
160 void SetTransportFeedbackObserver( | 188 void SetTransportFeedbackObserver( |
161 TransportFeedbackObserver* feedback_observer) { | 189 TransportFeedbackObserver* feedback_observer) { |
162 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 190 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
826 "Channel::RecordFileEnded() => output file recorder module is" | 854 "Channel::RecordFileEnded() => output file recorder module is" |
827 " shutdown"); | 855 " shutdown"); |
828 } | 856 } |
829 | 857 |
830 Channel::Channel(int32_t channelId, | 858 Channel::Channel(int32_t channelId, |
831 uint32_t instanceId, | 859 uint32_t instanceId, |
832 const VoEBase::ChannelConfig& config) | 860 const VoEBase::ChannelConfig& config) |
833 : _instanceId(instanceId), | 861 : _instanceId(instanceId), |
834 _channelId(channelId), | 862 _channelId(channelId), |
835 event_log_proxy_(new RtcEventLogProxy()), | 863 event_log_proxy_(new RtcEventLogProxy()), |
864 rtcp_rtt_stats_proxy_(new RtcpRttStatsProxy()), | |
836 rtp_header_parser_(RtpHeaderParser::Create()), | 865 rtp_header_parser_(RtpHeaderParser::Create()), |
837 rtp_payload_registry_(new RTPPayloadRegistry()), | 866 rtp_payload_registry_(new RTPPayloadRegistry()), |
838 rtp_receive_statistics_( | 867 rtp_receive_statistics_( |
839 ReceiveStatistics::Create(Clock::GetRealTimeClock())), | 868 ReceiveStatistics::Create(Clock::GetRealTimeClock())), |
840 rtp_receiver_( | 869 rtp_receiver_( |
841 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(), | 870 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(), |
842 this, | 871 this, |
843 this, | 872 this, |
844 rtp_payload_registry_.get())), | 873 rtp_payload_registry_.get())), |
845 telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), | 874 telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
909 configuration.outgoing_transport = this; | 938 configuration.outgoing_transport = this; |
910 configuration.receive_statistics = rtp_receive_statistics_.get(); | 939 configuration.receive_statistics = rtp_receive_statistics_.get(); |
911 configuration.bandwidth_callback = rtcp_observer_.get(); | 940 configuration.bandwidth_callback = rtcp_observer_.get(); |
912 if (pacing_enabled_) { | 941 if (pacing_enabled_) { |
913 configuration.paced_sender = rtp_packet_sender_proxy_.get(); | 942 configuration.paced_sender = rtp_packet_sender_proxy_.get(); |
914 configuration.transport_sequence_number_allocator = | 943 configuration.transport_sequence_number_allocator = |
915 seq_num_allocator_proxy_.get(); | 944 seq_num_allocator_proxy_.get(); |
916 configuration.transport_feedback_callback = feedback_observer_proxy_.get(); | 945 configuration.transport_feedback_callback = feedback_observer_proxy_.get(); |
917 } | 946 } |
918 configuration.event_log = &(*event_log_proxy_); | 947 configuration.event_log = &(*event_log_proxy_); |
948 configuration.rtt_stats = &(*rtcp_rtt_stats_proxy_); | |
919 configuration.retransmission_rate_limiter = | 949 configuration.retransmission_rate_limiter = |
920 retransmission_rate_limiter_.get(); | 950 retransmission_rate_limiter_.get(); |
921 | 951 |
922 _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration)); | 952 _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration)); |
923 _rtpRtcpModule->SetSendingMediaStatus(false); | 953 _rtpRtcpModule->SetSendingMediaStatus(false); |
924 | 954 |
925 statistics_proxy_.reset(new StatisticsProxy(_rtpRtcpModule->SSRC())); | 955 statistics_proxy_.reset(new StatisticsProxy(_rtpRtcpModule->SSRC())); |
926 rtp_receive_statistics_->RegisterRtcpStatisticsCallback( | 956 rtp_receive_statistics_->RegisterRtcpStatisticsCallback( |
927 statistics_proxy_.get()); | 957 statistics_proxy_.get()); |
928 } | 958 } |
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2818 // Channel ID, disassociate with it. | 2848 // Channel ID, disassociate with it. |
2819 ChannelOwner ref(NULL); | 2849 ChannelOwner ref(NULL); |
2820 associate_send_channel_ = ref; | 2850 associate_send_channel_ = ref; |
2821 } | 2851 } |
2822 } | 2852 } |
2823 | 2853 |
2824 void Channel::SetRtcEventLog(RtcEventLog* event_log) { | 2854 void Channel::SetRtcEventLog(RtcEventLog* event_log) { |
2825 event_log_proxy_->SetEventLog(event_log); | 2855 event_log_proxy_->SetEventLog(event_log); |
2826 } | 2856 } |
2827 | 2857 |
2858 void Channel::SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) { | |
2859 rtcp_rtt_stats_proxy_->SetRtcpRttStats(rtcp_rtt_stats); | |
2860 } | |
2861 | |
2828 void Channel::SetTransportOverhead(int transport_overhead_per_packet) { | 2862 void Channel::SetTransportOverhead(int transport_overhead_per_packet) { |
2829 _rtpRtcpModule->SetTransportOverhead(transport_overhead_per_packet); | 2863 _rtpRtcpModule->SetTransportOverhead(transport_overhead_per_packet); |
2830 } | 2864 } |
2831 | 2865 |
2832 int Channel::RegisterExternalMediaProcessing(ProcessingTypes type, | 2866 int Channel::RegisterExternalMediaProcessing(ProcessingTypes type, |
2833 VoEMediaProcess& processObject) { | 2867 VoEMediaProcess& processObject) { |
2834 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 2868 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
2835 "Channel::RegisterExternalMediaProcessing()"); | 2869 "Channel::RegisterExternalMediaProcessing()"); |
2836 | 2870 |
2837 rtc::CritScope cs(&_callbackCritSect); | 2871 rtc::CritScope cs(&_callbackCritSect); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3227 int64_t min_rtt = 0; | 3261 int64_t min_rtt = 0; |
3228 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3262 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
3229 0) { | 3263 0) { |
3230 return 0; | 3264 return 0; |
3231 } | 3265 } |
3232 return rtt; | 3266 return rtt; |
3233 } | 3267 } |
3234 | 3268 |
3235 } // namespace voe | 3269 } // namespace voe |
3236 } // namespace webrtc | 3270 } // namespace webrtc |
OLD | NEW |