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

Side by Side Diff: webrtc/pc/channelmanager.cc

Issue 2019423006: Adding more detail to MessageQueue::Dispatch logging. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing one more place where RTC_FROM_HERE wasn't used. Created 4 years, 6 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/pc/channel_unittest.cc ('k') | webrtc/pc/mediamonitor.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 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2004 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 Terminate(); 74 Terminate();
75 // If srtp is initialized (done by the Channel) then we must call 75 // If srtp is initialized (done by the Channel) then we must call
76 // srtp_shutdown to free all crypto kernel lists. But we need to make sure 76 // srtp_shutdown to free all crypto kernel lists. But we need to make sure
77 // shutdown always called at the end, after channels are destroyed. 77 // shutdown always called at the end, after channels are destroyed.
78 // ChannelManager d'tor is always called last, it's safe place to call 78 // ChannelManager d'tor is always called last, it's safe place to call
79 // shutdown. 79 // shutdown.
80 ShutdownSrtp(); 80 ShutdownSrtp();
81 } 81 }
82 // The media engine needs to be deleted on the worker thread for thread safe 82 // The media engine needs to be deleted on the worker thread for thread safe
83 // destruction, 83 // destruction,
84 worker_thread_->Invoke<void>(Bind( 84 worker_thread_->Invoke<void>(
85 &ChannelManager::DestructorDeletes_w, this)); 85 RTC_FROM_HERE, Bind(&ChannelManager::DestructorDeletes_w, this));
86 } 86 }
87 87
88 bool ChannelManager::SetVideoRtxEnabled(bool enable) { 88 bool ChannelManager::SetVideoRtxEnabled(bool enable) {
89 // To be safe, this call is only allowed before initialization. Apps like 89 // To be safe, this call is only allowed before initialization. Apps like
90 // Flute only have a singleton ChannelManager and we don't want this flag to 90 // Flute only have a singleton ChannelManager and we don't want this flag to
91 // be toggled between calls or when there's concurrent calls. We expect apps 91 // be toggled between calls or when there's concurrent calls. We expect apps
92 // to enable this at startup and retain that setting for the lifetime of the 92 // to enable this at startup and retain that setting for the lifetime of the
93 // app. 93 // app.
94 if (!initialized_) { 94 if (!initialized_) {
95 enable_rtx_ = enable; 95 enable_rtx_ = enable;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 bool ChannelManager::Init() { 143 bool ChannelManager::Init() {
144 ASSERT(!initialized_); 144 ASSERT(!initialized_);
145 if (initialized_) { 145 if (initialized_) {
146 return false; 146 return false;
147 } 147 }
148 RTC_DCHECK(network_thread_); 148 RTC_DCHECK(network_thread_);
149 RTC_DCHECK(worker_thread_); 149 RTC_DCHECK(worker_thread_);
150 if (!network_thread_->IsCurrent()) { 150 if (!network_thread_->IsCurrent()) {
151 // Do not allow invoking calls to other threads on the network thread. 151 // Do not allow invoking calls to other threads on the network thread.
152 network_thread_->Invoke<bool>( 152 network_thread_->Invoke<bool>(
153 RTC_FROM_HERE,
153 rtc::Bind(&rtc::Thread::SetAllowBlockingCalls, network_thread_, false)); 154 rtc::Bind(&rtc::Thread::SetAllowBlockingCalls, network_thread_, false));
154 } 155 }
155 156
156 initialized_ = worker_thread_->Invoke<bool>( 157 initialized_ = worker_thread_->Invoke<bool>(
157 Bind(&ChannelManager::InitMediaEngine_w, this)); 158 RTC_FROM_HERE, Bind(&ChannelManager::InitMediaEngine_w, this));
158 ASSERT(initialized_); 159 ASSERT(initialized_);
159 if (!initialized_) { 160 if (!initialized_) {
160 return false; 161 return false;
161 } 162 }
162 163
163 // If audio_output_volume_ has been set via SetOutputVolume(), set the 164 // If audio_output_volume_ has been set via SetOutputVolume(), set the
164 // audio output volume of the engine. 165 // audio output volume of the engine.
165 if (kNotSetOutputVolume != audio_output_volume_ && 166 if (kNotSetOutputVolume != audio_output_volume_ &&
166 !SetOutputVolume(audio_output_volume_)) { 167 !SetOutputVolume(audio_output_volume_)) {
167 LOG(LS_WARNING) << "Failed to SetOutputVolume to " 168 LOG(LS_WARNING) << "Failed to SetOutputVolume to "
168 << audio_output_volume_; 169 << audio_output_volume_;
169 } 170 }
170 171
171 return initialized_; 172 return initialized_;
172 } 173 }
173 174
174 bool ChannelManager::InitMediaEngine_w() { 175 bool ChannelManager::InitMediaEngine_w() {
175 ASSERT(worker_thread_ == rtc::Thread::Current()); 176 ASSERT(worker_thread_ == rtc::Thread::Current());
176 return media_engine_->Init(); 177 return media_engine_->Init();
177 } 178 }
178 179
179 void ChannelManager::Terminate() { 180 void ChannelManager::Terminate() {
180 ASSERT(initialized_); 181 ASSERT(initialized_);
181 if (!initialized_) { 182 if (!initialized_) {
182 return; 183 return;
183 } 184 }
184 worker_thread_->Invoke<void>(Bind(&ChannelManager::Terminate_w, this)); 185 worker_thread_->Invoke<void>(RTC_FROM_HERE,
186 Bind(&ChannelManager::Terminate_w, this));
185 initialized_ = false; 187 initialized_ = false;
186 } 188 }
187 189
188 void ChannelManager::DestructorDeletes_w() { 190 void ChannelManager::DestructorDeletes_w() {
189 ASSERT(worker_thread_ == rtc::Thread::Current()); 191 ASSERT(worker_thread_ == rtc::Thread::Current());
190 media_engine_.reset(NULL); 192 media_engine_.reset(NULL);
191 } 193 }
192 194
193 void ChannelManager::Terminate_w() { 195 void ChannelManager::Terminate_w() {
194 ASSERT(worker_thread_ == rtc::Thread::Current()); 196 ASSERT(worker_thread_ == rtc::Thread::Current());
195 // Need to destroy the voice/video channels 197 // Need to destroy the voice/video channels
196 while (!video_channels_.empty()) { 198 while (!video_channels_.empty()) {
197 DestroyVideoChannel_w(video_channels_.back()); 199 DestroyVideoChannel_w(video_channels_.back());
198 } 200 }
199 while (!voice_channels_.empty()) { 201 while (!voice_channels_.empty()) {
200 DestroyVoiceChannel_w(voice_channels_.back()); 202 DestroyVoiceChannel_w(voice_channels_.back());
201 } 203 }
202 } 204 }
203 205
204 VoiceChannel* ChannelManager::CreateVoiceChannel( 206 VoiceChannel* ChannelManager::CreateVoiceChannel(
205 webrtc::MediaControllerInterface* media_controller, 207 webrtc::MediaControllerInterface* media_controller,
206 TransportController* transport_controller, 208 TransportController* transport_controller,
207 const std::string& content_name, 209 const std::string& content_name,
208 const std::string* bundle_transport_name, 210 const std::string* bundle_transport_name,
209 bool rtcp, 211 bool rtcp,
210 const AudioOptions& options) { 212 const AudioOptions& options) {
211 return worker_thread_->Invoke<VoiceChannel*>( 213 return worker_thread_->Invoke<VoiceChannel*>(
212 Bind(&ChannelManager::CreateVoiceChannel_w, this, media_controller, 214 RTC_FROM_HERE, Bind(&ChannelManager::CreateVoiceChannel_w, this,
213 transport_controller, content_name, bundle_transport_name, rtcp, 215 media_controller, transport_controller, content_name,
214 options)); 216 bundle_transport_name, rtcp, options));
215 } 217 }
216 218
217 VoiceChannel* ChannelManager::CreateVoiceChannel_w( 219 VoiceChannel* ChannelManager::CreateVoiceChannel_w(
218 webrtc::MediaControllerInterface* media_controller, 220 webrtc::MediaControllerInterface* media_controller,
219 TransportController* transport_controller, 221 TransportController* transport_controller,
220 const std::string& content_name, 222 const std::string& content_name,
221 const std::string* bundle_transport_name, 223 const std::string* bundle_transport_name,
222 bool rtcp, 224 bool rtcp,
223 const AudioOptions& options) { 225 const AudioOptions& options) {
224 ASSERT(initialized_); 226 ASSERT(initialized_);
(...skipping 12 matching lines...) Expand all
237 return nullptr; 239 return nullptr;
238 } 240 }
239 voice_channels_.push_back(voice_channel); 241 voice_channels_.push_back(voice_channel);
240 return voice_channel; 242 return voice_channel;
241 } 243 }
242 244
243 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { 245 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) {
244 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); 246 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel");
245 if (voice_channel) { 247 if (voice_channel) {
246 worker_thread_->Invoke<void>( 248 worker_thread_->Invoke<void>(
249 RTC_FROM_HERE,
247 Bind(&ChannelManager::DestroyVoiceChannel_w, this, voice_channel)); 250 Bind(&ChannelManager::DestroyVoiceChannel_w, this, voice_channel));
248 } 251 }
249 } 252 }
250 253
251 void ChannelManager::DestroyVoiceChannel_w(VoiceChannel* voice_channel) { 254 void ChannelManager::DestroyVoiceChannel_w(VoiceChannel* voice_channel) {
252 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel_w"); 255 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel_w");
253 // Destroy voice channel. 256 // Destroy voice channel.
254 ASSERT(initialized_); 257 ASSERT(initialized_);
255 ASSERT(worker_thread_ == rtc::Thread::Current()); 258 ASSERT(worker_thread_ == rtc::Thread::Current());
256 VoiceChannels::iterator it = std::find(voice_channels_.begin(), 259 VoiceChannels::iterator it = std::find(voice_channels_.begin(),
257 voice_channels_.end(), voice_channel); 260 voice_channels_.end(), voice_channel);
258 ASSERT(it != voice_channels_.end()); 261 ASSERT(it != voice_channels_.end());
259 if (it == voice_channels_.end()) 262 if (it == voice_channels_.end())
260 return; 263 return;
261 voice_channels_.erase(it); 264 voice_channels_.erase(it);
262 delete voice_channel; 265 delete voice_channel;
263 } 266 }
264 267
265 VideoChannel* ChannelManager::CreateVideoChannel( 268 VideoChannel* ChannelManager::CreateVideoChannel(
266 webrtc::MediaControllerInterface* media_controller, 269 webrtc::MediaControllerInterface* media_controller,
267 TransportController* transport_controller, 270 TransportController* transport_controller,
268 const std::string& content_name, 271 const std::string& content_name,
269 const std::string* bundle_transport_name, 272 const std::string* bundle_transport_name,
270 bool rtcp, 273 bool rtcp,
271 const VideoOptions& options) { 274 const VideoOptions& options) {
272 return worker_thread_->Invoke<VideoChannel*>( 275 return worker_thread_->Invoke<VideoChannel*>(
273 Bind(&ChannelManager::CreateVideoChannel_w, this, media_controller, 276 RTC_FROM_HERE, Bind(&ChannelManager::CreateVideoChannel_w, this,
274 transport_controller, content_name, bundle_transport_name, rtcp, 277 media_controller, transport_controller, content_name,
275 options)); 278 bundle_transport_name, rtcp, options));
276 } 279 }
277 280
278 VideoChannel* ChannelManager::CreateVideoChannel_w( 281 VideoChannel* ChannelManager::CreateVideoChannel_w(
279 webrtc::MediaControllerInterface* media_controller, 282 webrtc::MediaControllerInterface* media_controller,
280 TransportController* transport_controller, 283 TransportController* transport_controller,
281 const std::string& content_name, 284 const std::string& content_name,
282 const std::string* bundle_transport_name, 285 const std::string* bundle_transport_name,
283 bool rtcp, 286 bool rtcp,
284 const VideoOptions& options) { 287 const VideoOptions& options) {
285 ASSERT(initialized_); 288 ASSERT(initialized_);
(...skipping 13 matching lines...) Expand all
299 return NULL; 302 return NULL;
300 } 303 }
301 video_channels_.push_back(video_channel); 304 video_channels_.push_back(video_channel);
302 return video_channel; 305 return video_channel;
303 } 306 }
304 307
305 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { 308 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) {
306 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); 309 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel");
307 if (video_channel) { 310 if (video_channel) {
308 worker_thread_->Invoke<void>( 311 worker_thread_->Invoke<void>(
312 RTC_FROM_HERE,
309 Bind(&ChannelManager::DestroyVideoChannel_w, this, video_channel)); 313 Bind(&ChannelManager::DestroyVideoChannel_w, this, video_channel));
310 } 314 }
311 } 315 }
312 316
313 void ChannelManager::DestroyVideoChannel_w(VideoChannel* video_channel) { 317 void ChannelManager::DestroyVideoChannel_w(VideoChannel* video_channel) {
314 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel_w"); 318 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel_w");
315 // Destroy video channel. 319 // Destroy video channel.
316 ASSERT(initialized_); 320 ASSERT(initialized_);
317 ASSERT(worker_thread_ == rtc::Thread::Current()); 321 ASSERT(worker_thread_ == rtc::Thread::Current());
318 VideoChannels::iterator it = std::find(video_channels_.begin(), 322 VideoChannels::iterator it = std::find(video_channels_.begin(),
319 video_channels_.end(), video_channel); 323 video_channels_.end(), video_channel);
320 ASSERT(it != video_channels_.end()); 324 ASSERT(it != video_channels_.end());
321 if (it == video_channels_.end()) 325 if (it == video_channels_.end())
322 return; 326 return;
323 327
324 video_channels_.erase(it); 328 video_channels_.erase(it);
325 delete video_channel; 329 delete video_channel;
326 } 330 }
327 331
328 DataChannel* ChannelManager::CreateDataChannel( 332 DataChannel* ChannelManager::CreateDataChannel(
329 TransportController* transport_controller, 333 TransportController* transport_controller,
330 const std::string& content_name, 334 const std::string& content_name,
331 const std::string* bundle_transport_name, 335 const std::string* bundle_transport_name,
332 bool rtcp, 336 bool rtcp,
333 DataChannelType channel_type) { 337 DataChannelType channel_type) {
334 return worker_thread_->Invoke<DataChannel*>( 338 return worker_thread_->Invoke<DataChannel*>(
339 RTC_FROM_HERE,
335 Bind(&ChannelManager::CreateDataChannel_w, this, transport_controller, 340 Bind(&ChannelManager::CreateDataChannel_w, this, transport_controller,
336 content_name, bundle_transport_name, rtcp, channel_type)); 341 content_name, bundle_transport_name, rtcp, channel_type));
337 } 342 }
338 343
339 DataChannel* ChannelManager::CreateDataChannel_w( 344 DataChannel* ChannelManager::CreateDataChannel_w(
340 TransportController* transport_controller, 345 TransportController* transport_controller,
341 const std::string& content_name, 346 const std::string& content_name,
342 const std::string* bundle_transport_name, 347 const std::string* bundle_transport_name,
343 bool rtcp, 348 bool rtcp,
344 DataChannelType data_channel_type) { 349 DataChannelType data_channel_type) {
(...skipping 16 matching lines...) Expand all
361 return NULL; 366 return NULL;
362 } 367 }
363 data_channels_.push_back(data_channel); 368 data_channels_.push_back(data_channel);
364 return data_channel; 369 return data_channel;
365 } 370 }
366 371
367 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { 372 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) {
368 TRACE_EVENT0("webrtc", "ChannelManager::DestroyDataChannel"); 373 TRACE_EVENT0("webrtc", "ChannelManager::DestroyDataChannel");
369 if (data_channel) { 374 if (data_channel) {
370 worker_thread_->Invoke<void>( 375 worker_thread_->Invoke<void>(
376 RTC_FROM_HERE,
371 Bind(&ChannelManager::DestroyDataChannel_w, this, data_channel)); 377 Bind(&ChannelManager::DestroyDataChannel_w, this, data_channel));
372 } 378 }
373 } 379 }
374 380
375 void ChannelManager::DestroyDataChannel_w(DataChannel* data_channel) { 381 void ChannelManager::DestroyDataChannel_w(DataChannel* data_channel) {
376 TRACE_EVENT0("webrtc", "ChannelManager::DestroyDataChannel_w"); 382 TRACE_EVENT0("webrtc", "ChannelManager::DestroyDataChannel_w");
377 // Destroy data channel. 383 // Destroy data channel.
378 ASSERT(initialized_); 384 ASSERT(initialized_);
379 DataChannels::iterator it = std::find(data_channels_.begin(), 385 DataChannels::iterator it = std::find(data_channels_.begin(),
380 data_channels_.end(), data_channel); 386 data_channels_.end(), data_channel);
381 ASSERT(it != data_channels_.end()); 387 ASSERT(it != data_channels_.end());
382 if (it == data_channels_.end()) 388 if (it == data_channels_.end())
383 return; 389 return;
384 390
385 data_channels_.erase(it); 391 data_channels_.erase(it);
386 delete data_channel; 392 delete data_channel;
387 } 393 }
388 394
389 bool ChannelManager::GetOutputVolume(int* level) { 395 bool ChannelManager::GetOutputVolume(int* level) {
390 if (!initialized_) { 396 if (!initialized_) {
391 return false; 397 return false;
392 } 398 }
393 return worker_thread_->Invoke<bool>( 399 return worker_thread_->Invoke<bool>(
400 RTC_FROM_HERE,
394 Bind(&MediaEngineInterface::GetOutputVolume, media_engine_.get(), level)); 401 Bind(&MediaEngineInterface::GetOutputVolume, media_engine_.get(), level));
395 } 402 }
396 403
397 bool ChannelManager::SetOutputVolume(int level) { 404 bool ChannelManager::SetOutputVolume(int level) {
398 bool ret = level >= 0 && level <= 255; 405 bool ret = level >= 0 && level <= 255;
399 if (initialized_) { 406 if (initialized_) {
400 ret &= worker_thread_->Invoke<bool>( 407 ret &= worker_thread_->Invoke<bool>(
401 Bind(&MediaEngineInterface::SetOutputVolume, 408 RTC_FROM_HERE, Bind(&MediaEngineInterface::SetOutputVolume,
402 media_engine_.get(), level)); 409 media_engine_.get(), level));
403 } 410 }
404 411
405 if (ret) { 412 if (ret) {
406 audio_output_volume_ = level; 413 audio_output_volume_ = level;
407 } 414 }
408 415
409 return ret; 416 return ret;
410 } 417 }
411 418
412 419
413 bool ChannelManager::StartAecDump(rtc::PlatformFile file, 420 bool ChannelManager::StartAecDump(rtc::PlatformFile file,
414 int64_t max_size_bytes) { 421 int64_t max_size_bytes) {
415 return worker_thread_->Invoke<bool>(Bind(&MediaEngineInterface::StartAecDump, 422 return worker_thread_->Invoke<bool>(
416 media_engine_.get(), file, 423 RTC_FROM_HERE, Bind(&MediaEngineInterface::StartAecDump,
417 max_size_bytes)); 424 media_engine_.get(), file, max_size_bytes));
418 } 425 }
419 426
420 void ChannelManager::StopAecDump() { 427 void ChannelManager::StopAecDump() {
421 worker_thread_->Invoke<void>( 428 worker_thread_->Invoke<void>(
429 RTC_FROM_HERE,
422 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); 430 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get()));
423 } 431 }
424 432
425 bool ChannelManager::StartRtcEventLog(rtc::PlatformFile file, 433 bool ChannelManager::StartRtcEventLog(rtc::PlatformFile file,
426 int64_t max_size_bytes) { 434 int64_t max_size_bytes) {
427 return worker_thread_->Invoke<bool>( 435 return worker_thread_->Invoke<bool>(
428 Bind(&MediaEngineInterface::StartRtcEventLog, media_engine_.get(), file, 436 RTC_FROM_HERE, Bind(&MediaEngineInterface::StartRtcEventLog,
429 max_size_bytes)); 437 media_engine_.get(), file, max_size_bytes));
430 } 438 }
431 439
432 void ChannelManager::StopRtcEventLog() { 440 void ChannelManager::StopRtcEventLog() {
433 worker_thread_->Invoke<void>( 441 worker_thread_->Invoke<void>(
442 RTC_FROM_HERE,
434 Bind(&MediaEngineInterface::StopRtcEventLog, media_engine_.get())); 443 Bind(&MediaEngineInterface::StopRtcEventLog, media_engine_.get()));
435 } 444 }
436 445
437 } // namespace cricket 446 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/pc/channel_unittest.cc ('k') | webrtc/pc/mediamonitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698