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

Side by Side Diff: content/renderer/media/webrtc_audio_device_impl.cc

Issue 178153007: Avoid hitting the thread check when WebRtcAudioRenderer is going away. (Closed) Base URL: http://git.chromium.org/chromium/src.git@libjingle_get_stats
Patch Set: Created 6 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/webrtc_audio_device_impl.h" 5 #include "content/renderer/media/webrtc_audio_device_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/win/windows_version.h" 10 #include "base/win/windows_version.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 for (PlayoutDataSinkList::const_iterator it = playout_sinks_.begin(); 168 for (PlayoutDataSinkList::const_iterator it = playout_sinks_.begin();
169 it != playout_sinks_.end(); ++it) { 169 it != playout_sinks_.end(); ++it) {
170 (*it)->OnPlayoutData(audio_bus, sample_rate, audio_delay_milliseconds); 170 (*it)->OnPlayoutData(audio_bus, sample_rate, audio_delay_milliseconds);
171 } 171 }
172 } 172 }
173 173
174 void WebRtcAudioDeviceImpl::RemoveAudioRenderer(WebRtcAudioRenderer* renderer) { 174 void WebRtcAudioDeviceImpl::RemoveAudioRenderer(WebRtcAudioRenderer* renderer) {
175 DCHECK(thread_checker_.CalledOnValidThread()); 175 DCHECK(thread_checker_.CalledOnValidThread());
176 DCHECK_EQ(renderer, renderer_); 176 DCHECK_EQ(renderer, renderer_);
177 base::AutoLock auto_lock(lock_); 177 base::AutoLock auto_lock(lock_);
178 // Notify the playout sink of the change.
179 for (PlayoutDataSinkList::const_iterator it = playout_sinks_.begin();
180 it != playout_sinks_.end(); ++it) {
181 (*it)->OnPlayoutDataSourceChanged();
182 }
183
178 renderer_ = NULL; 184 renderer_ = NULL;
179 playing_ = false; 185 playing_ = false;
180 } 186 }
181 187
182 int32_t WebRtcAudioDeviceImpl::RegisterAudioCallback( 188 int32_t WebRtcAudioDeviceImpl::RegisterAudioCallback(
183 webrtc::AudioTransport* audio_callback) { 189 webrtc::AudioTransport* audio_callback) {
184 DVLOG(1) << "WebRtcAudioDeviceImpl::RegisterAudioCallback()"; 190 DVLOG(1) << "WebRtcAudioDeviceImpl::RegisterAudioCallback()";
185 DCHECK(thread_checker_.CalledOnValidThread()); 191 DCHECK(thread_checker_.CalledOnValidThread());
186 DCHECK_EQ(audio_transport_callback_ == NULL, audio_callback != NULL); 192 DCHECK_EQ(audio_transport_callback_ == NULL, audio_callback != NULL);
187 audio_transport_callback_ = audio_callback; 193 audio_transport_callback_ = audio_callback;
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 // If there is no capturer or there are more than one open capture devices, 485 // If there is no capturer or there are more than one open capture devices,
480 // return false. 486 // return false.
481 if (capturers_.empty() || capturers_.size() > 1) 487 if (capturers_.empty() || capturers_.size() > 1)
482 return false; 488 return false;
483 489
484 return GetDefaultCapturer()->GetPairedOutputParameters( 490 return GetDefaultCapturer()->GetPairedOutputParameters(
485 session_id, output_sample_rate, output_frames_per_buffer); 491 session_id, output_sample_rate, output_frames_per_buffer);
486 } 492 }
487 493
488 } // namespace content 494 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_audio_device_impl.h ('k') | content/renderer/media/webrtc_audio_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698