Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: webrtc/voice_engine/channel.cc

Issue 2402333002: Add RtcpRttStats to AudioStream (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 rtc::CritScope lock(&crit_); 150 rtc::CritScope lock(&crit_);
151 event_log_ = event_log; 151 event_log_ = event_log;
152 } 152 }
153 153
154 private: 154 private:
155 rtc::CriticalSection crit_; 155 rtc::CriticalSection crit_;
156 RtcEventLog* event_log_ GUARDED_BY(crit_); 156 RtcEventLog* event_log_ GUARDED_BY(crit_);
157 RTC_DISALLOW_COPY_AND_ASSIGN(RtcEventLogProxy); 157 RTC_DISALLOW_COPY_AND_ASSIGN(RtcEventLogProxy);
158 }; 158 };
159 159
160 class RtcpRttStatsProxy final : public RtcpRttStats {
161 public:
162 RtcpRttStatsProxy() : rtcp_rtt_stats_(nullptr) {}
163
164 void OnRttUpdate(int64_t rtt) override {
165 rtc::CritScope lock(&crit_);
166 if (rtcp_rtt_stats_)
167 rtcp_rtt_stats_->OnRttUpdate(rtt);
168 }
169
170 int64_t LastProcessedRtt() const override {
171 rtc::CritScope lock(&crit_);
172 if (rtcp_rtt_stats_ == nullptr)
173 return 0;
174 return rtcp_rtt_stats_->LastProcessedRtt();
175 }
176
177 void SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) {
178 rtc::CritScope lock(&crit_);
179 rtcp_rtt_stats_ = rtcp_rtt_stats;
180 }
181
182 private:
183 rtc::CriticalSection crit_;
184 RtcpRttStats* rtcp_rtt_stats_ GUARDED_BY(crit_);
185 RTC_DISALLOW_COPY_AND_ASSIGN(RtcpRttStatsProxy);
186 };
187
160 class TransportFeedbackProxy : public TransportFeedbackObserver { 188 class TransportFeedbackProxy : public TransportFeedbackObserver {
161 public: 189 public:
162 TransportFeedbackProxy() : feedback_observer_(nullptr) { 190 TransportFeedbackProxy() : feedback_observer_(nullptr) {
163 pacer_thread_.DetachFromThread(); 191 pacer_thread_.DetachFromThread();
164 network_thread_.DetachFromThread(); 192 network_thread_.DetachFromThread();
165 } 193 }
166 194
167 void SetTransportFeedbackObserver( 195 void SetTransportFeedbackObserver(
168 TransportFeedbackObserver* feedback_observer) { 196 TransportFeedbackObserver* feedback_observer) {
169 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 197 RTC_DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 "Channel::RecordFileEnded() => output file recorder module is" 836 "Channel::RecordFileEnded() => output file recorder module is"
809 " shutdown"); 837 " shutdown");
810 } 838 }
811 839
812 Channel::Channel(int32_t channelId, 840 Channel::Channel(int32_t channelId,
813 uint32_t instanceId, 841 uint32_t instanceId,
814 const VoEBase::ChannelConfig& config) 842 const VoEBase::ChannelConfig& config)
815 : _instanceId(instanceId), 843 : _instanceId(instanceId),
816 _channelId(channelId), 844 _channelId(channelId),
817 event_log_proxy_(new RtcEventLogProxy()), 845 event_log_proxy_(new RtcEventLogProxy()),
846 rtcp_rtt_stats_proxy_(new RtcpRttStatsProxy()),
818 rtp_header_parser_(RtpHeaderParser::Create()), 847 rtp_header_parser_(RtpHeaderParser::Create()),
819 rtp_payload_registry_( 848 rtp_payload_registry_(
820 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))), 849 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))),
821 rtp_receive_statistics_( 850 rtp_receive_statistics_(
822 ReceiveStatistics::Create(Clock::GetRealTimeClock())), 851 ReceiveStatistics::Create(Clock::GetRealTimeClock())),
823 rtp_receiver_( 852 rtp_receiver_(
824 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(), 853 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(),
825 this, 854 this,
826 this, 855 this,
827 rtp_payload_registry_.get())), 856 rtp_payload_registry_.get())),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 configuration.outgoing_transport = this; 922 configuration.outgoing_transport = this;
894 configuration.receive_statistics = rtp_receive_statistics_.get(); 923 configuration.receive_statistics = rtp_receive_statistics_.get();
895 configuration.bandwidth_callback = rtcp_observer_.get(); 924 configuration.bandwidth_callback = rtcp_observer_.get();
896 if (pacing_enabled_) { 925 if (pacing_enabled_) {
897 configuration.paced_sender = rtp_packet_sender_proxy_.get(); 926 configuration.paced_sender = rtp_packet_sender_proxy_.get();
898 configuration.transport_sequence_number_allocator = 927 configuration.transport_sequence_number_allocator =
899 seq_num_allocator_proxy_.get(); 928 seq_num_allocator_proxy_.get();
900 configuration.transport_feedback_callback = feedback_observer_proxy_.get(); 929 configuration.transport_feedback_callback = feedback_observer_proxy_.get();
901 } 930 }
902 configuration.event_log = &(*event_log_proxy_); 931 configuration.event_log = &(*event_log_proxy_);
932 configuration.rtt_stats = &(*rtcp_rtt_stats_proxy_);
903 configuration.retransmission_rate_limiter = 933 configuration.retransmission_rate_limiter =
904 retransmission_rate_limiter_.get(); 934 retransmission_rate_limiter_.get();
905 935
906 _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration)); 936 _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration));
907 _rtpRtcpModule->SetSendingMediaStatus(false); 937 _rtpRtcpModule->SetSendingMediaStatus(false);
908 938
909 statistics_proxy_.reset(new StatisticsProxy(_rtpRtcpModule->SSRC())); 939 statistics_proxy_.reset(new StatisticsProxy(_rtpRtcpModule->SSRC()));
910 rtp_receive_statistics_->RegisterRtcpStatisticsCallback( 940 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(
911 statistics_proxy_.get()); 941 statistics_proxy_.get());
912 } 942 }
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after
2804 // Channel ID, disassociate with it. 2834 // Channel ID, disassociate with it.
2805 ChannelOwner ref(NULL); 2835 ChannelOwner ref(NULL);
2806 associate_send_channel_ = ref; 2836 associate_send_channel_ = ref;
2807 } 2837 }
2808 } 2838 }
2809 2839
2810 void Channel::SetRtcEventLog(RtcEventLog* event_log) { 2840 void Channel::SetRtcEventLog(RtcEventLog* event_log) {
2811 event_log_proxy_->SetEventLog(event_log); 2841 event_log_proxy_->SetEventLog(event_log);
2812 } 2842 }
2813 2843
2844 void Channel::SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) {
2845 rtcp_rtt_stats_proxy_->SetRtcpRttStats(rtcp_rtt_stats);
2846 }
2847
2814 int Channel::RegisterExternalMediaProcessing(ProcessingTypes type, 2848 int Channel::RegisterExternalMediaProcessing(ProcessingTypes type,
2815 VoEMediaProcess& processObject) { 2849 VoEMediaProcess& processObject) {
2816 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 2850 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
2817 "Channel::RegisterExternalMediaProcessing()"); 2851 "Channel::RegisterExternalMediaProcessing()");
2818 2852
2819 rtc::CritScope cs(&_callbackCritSect); 2853 rtc::CritScope cs(&_callbackCritSect);
2820 2854
2821 if (kPlaybackPerChannel == type) { 2855 if (kPlaybackPerChannel == type) {
2822 if (_outputExternalMediaCallbackPtr) { 2856 if (_outputExternalMediaCallbackPtr) {
2823 _engineStatisticsPtr->SetLastError( 2857 _engineStatisticsPtr->SetLastError(
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
3221 int64_t min_rtt = 0; 3255 int64_t min_rtt = 0;
3222 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3256 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3223 0) { 3257 0) {
3224 return 0; 3258 return 0;
3225 } 3259 }
3226 return rtt; 3260 return rtt;
3227 } 3261 }
3228 3262
3229 } // namespace voe 3263 } // namespace voe
3230 } // namespace webrtc 3264 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698