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

Side by Side Diff: webrtc/call/call.cc

Issue 1390753002: Implement AudioReceiveStream::GetStats(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: merge master Created 5 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/call/bitrate_estimator_tests.cc ('k') | webrtc/call/call_perf_tests.cc » ('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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 GUARDED_BY(receive_crit_); 119 GUARDED_BY(receive_crit_);
120 120
121 rtc::scoped_ptr<RWLockWrapper> send_crit_; 121 rtc::scoped_ptr<RWLockWrapper> send_crit_;
122 // Audio and Video send streams are owned by the client that creates them. 122 // Audio and Video send streams are owned by the client that creates them.
123 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); 123 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_);
124 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); 124 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_);
125 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); 125 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_);
126 126
127 VideoSendStream::RtpStateMap suspended_video_send_ssrcs_; 127 VideoSendStream::RtpStateMap suspended_video_send_ssrcs_;
128 128
129 RtcEventLog* event_log_; 129 RtcEventLog* event_log_ = nullptr;
130 VoECodec* voe_codec_ = nullptr;
130 131
131 RTC_DISALLOW_COPY_AND_ASSIGN(Call); 132 RTC_DISALLOW_COPY_AND_ASSIGN(Call);
132 }; 133 };
133 } // namespace internal 134 } // namespace internal
134 135
135 Call* Call::Create(const Call::Config& config) { 136 Call* Call::Create(const Call::Config& config) {
136 return new internal::Call(config); 137 return new internal::Call(config);
137 } 138 }
138 139
139 namespace internal { 140 namespace internal {
140 141
141 Call::Call(const Call::Config& config) 142 Call::Call(const Call::Config& config)
142 : num_cpu_cores_(CpuInfo::DetectNumberOfCores()), 143 : num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
143 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), 144 module_process_thread_(ProcessThread::Create("ModuleProcessThread")),
144 call_stats_(new CallStats()), 145 call_stats_(new CallStats()),
145 congestion_controller_(new CongestionController( 146 congestion_controller_(new CongestionController(
146 module_process_thread_.get(), call_stats_.get())), 147 module_process_thread_.get(), call_stats_.get())),
147 config_(config), 148 config_(config),
148 network_enabled_(true), 149 network_enabled_(true),
149 receive_crit_(RWLockWrapper::CreateRWLock()), 150 receive_crit_(RWLockWrapper::CreateRWLock()),
150 send_crit_(RWLockWrapper::CreateRWLock()), 151 send_crit_(RWLockWrapper::CreateRWLock()) {
151 event_log_(nullptr) {
152 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 152 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
153 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); 153 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0);
154 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, 154 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps,
155 config.bitrate_config.min_bitrate_bps); 155 config.bitrate_config.min_bitrate_bps);
156 if (config.bitrate_config.max_bitrate_bps != -1) { 156 if (config.bitrate_config.max_bitrate_bps != -1) {
157 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, 157 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps,
158 config.bitrate_config.start_bitrate_bps); 158 config.bitrate_config.start_bitrate_bps);
159 } 159 }
160 if (config.voice_engine) { 160 if (config.voice_engine) {
161 VoECodec* voe_codec = VoECodec::GetInterface(config.voice_engine); 161 // Keep a reference to VoECodec, so we're sure the VoiceEngine lives for the
162 if (voe_codec) { 162 // duration of the call.
163 event_log_ = voe_codec->GetEventLog(); 163 voe_codec_ = VoECodec::GetInterface(config.voice_engine);
164 voe_codec->Release(); 164 if (voe_codec_)
165 } 165 event_log_ = voe_codec_->GetEventLog();
166 } 166 }
167 167
168 Trace::CreateTrace(); 168 Trace::CreateTrace();
169 module_process_thread_->Start(); 169 module_process_thread_->Start();
170 module_process_thread_->RegisterModule(call_stats_.get()); 170 module_process_thread_->RegisterModule(call_stats_.get());
171 171
172 congestion_controller_->SetBweBitrates( 172 congestion_controller_->SetBweBitrates(
173 config_.bitrate_config.min_bitrate_bps, 173 config_.bitrate_config.min_bitrate_bps,
174 config_.bitrate_config.start_bitrate_bps, 174 config_.bitrate_config.start_bitrate_bps,
175 config_.bitrate_config.max_bitrate_bps); 175 config_.bitrate_config.max_bitrate_bps);
176 } 176 }
177 177
178 Call::~Call() { 178 Call::~Call() {
179 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 179 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
180 RTC_CHECK(audio_send_ssrcs_.empty()); 180 RTC_CHECK(audio_send_ssrcs_.empty());
181 RTC_CHECK(video_send_ssrcs_.empty()); 181 RTC_CHECK(video_send_ssrcs_.empty());
182 RTC_CHECK(video_send_streams_.empty()); 182 RTC_CHECK(video_send_streams_.empty());
183 RTC_CHECK(audio_receive_ssrcs_.empty()); 183 RTC_CHECK(audio_receive_ssrcs_.empty());
184 RTC_CHECK(video_receive_ssrcs_.empty()); 184 RTC_CHECK(video_receive_ssrcs_.empty());
185 RTC_CHECK(video_receive_streams_.empty()); 185 RTC_CHECK(video_receive_streams_.empty());
186 186
187 module_process_thread_->DeRegisterModule(call_stats_.get()); 187 module_process_thread_->DeRegisterModule(call_stats_.get());
188 module_process_thread_->Stop(); 188 module_process_thread_->Stop();
189 Trace::ReturnTrace(); 189 Trace::ReturnTrace();
190
191 if (voe_codec_)
192 voe_codec_->Release();
190 } 193 }
191 194
192 PacketReceiver* Call::Receiver() { 195 PacketReceiver* Call::Receiver() {
193 // TODO(solenberg): Some test cases in EndToEndTest use this from a different 196 // TODO(solenberg): Some test cases in EndToEndTest use this from a different
194 // thread. Re-enable once that is fixed. 197 // thread. Re-enable once that is fixed.
195 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 198 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
196 return this; 199 return this;
197 } 200 }
198 201
199 webrtc::AudioSendStream* Call::CreateAudioSendStream( 202 webrtc::AudioSendStream* Call::CreateAudioSendStream(
(...skipping 30 matching lines...) Expand all
230 RTC_DCHECK(num_deleted == 1); 233 RTC_DCHECK(num_deleted == 1);
231 } 234 }
232 delete audio_send_stream; 235 delete audio_send_stream;
233 } 236 }
234 237
235 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( 238 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream(
236 const webrtc::AudioReceiveStream::Config& config) { 239 const webrtc::AudioReceiveStream::Config& config) {
237 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); 240 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream");
238 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 241 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
239 AudioReceiveStream* receive_stream = new AudioReceiveStream( 242 AudioReceiveStream* receive_stream = new AudioReceiveStream(
240 congestion_controller_->GetRemoteBitrateEstimator(false), config); 243 congestion_controller_->GetRemoteBitrateEstimator(false), config,
244 config_.voice_engine);
241 { 245 {
242 WriteLockScoped write_lock(*receive_crit_); 246 WriteLockScoped write_lock(*receive_crit_);
243 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == 247 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) ==
244 audio_receive_ssrcs_.end()); 248 audio_receive_ssrcs_.end());
245 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; 249 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream;
246 ConfigureSync(config.sync_group); 250 ConfigureSync(config.sync_group);
247 } 251 }
248 return receive_stream; 252 return receive_stream;
249 } 253 }
250 254
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 // thread. Then this check can be enabled. 606 // thread. Then this check can be enabled.
603 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); 607 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread());
604 if (RtpHeaderParser::IsRtcp(packet, length)) 608 if (RtpHeaderParser::IsRtcp(packet, length))
605 return DeliverRtcp(media_type, packet, length); 609 return DeliverRtcp(media_type, packet, length);
606 610
607 return DeliverRtp(media_type, packet, length, packet_time); 611 return DeliverRtp(media_type, packet, length, packet_time);
608 } 612 }
609 613
610 } // namespace internal 614 } // namespace internal
611 } // namespace webrtc 615 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/bitrate_estimator_tests.cc ('k') | webrtc/call/call_perf_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698