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

Side by Side Diff: content/renderer/media/media_stream_audio_processor.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/media_stream_audio_processor.h" 5 #include "content/renderer/media/media_stream_audio_processor.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "content/public/common/content_switches.h" 9 #include "content/public/common/content_switches.h"
10 #include "content/renderer/media/media_stream_audio_processor_options.h" 10 #include "content/renderer/media/media_stream_audio_processor_options.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 base::subtle::Release_Store(&render_delay_ms_, audio_delay_milliseconds); 211 base::subtle::Release_Store(&render_delay_ms_, audio_delay_milliseconds);
212 212
213 InitializeRenderConverterIfNeeded(sample_rate, audio_bus->channels(), 213 InitializeRenderConverterIfNeeded(sample_rate, audio_bus->channels(),
214 audio_bus->frames()); 214 audio_bus->frames());
215 215
216 render_converter_->Push(audio_bus); 216 render_converter_->Push(audio_bus);
217 while (render_converter_->Convert(&render_frame_)) 217 while (render_converter_->Convert(&render_frame_))
218 audio_processing_->AnalyzeReverseStream(&render_frame_); 218 audio_processing_->AnalyzeReverseStream(&render_frame_);
219 } 219 }
220 220
221 void MediaStreamAudioProcessor::OnPlayoutDataSourceChanged() {
222 DCHECK(main_thread_checker_.CalledOnValidThread());
223 // There is no need to hold a lock here since the caller guarantees that
224 // there is no more OnPlayoutData() callback on the render thread.
225 render_thread_checker_.DetachFromThread();
226 render_converter_.reset();
227 }
228
221 void MediaStreamAudioProcessor::InitializeAudioProcessingModule( 229 void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
222 const blink::WebMediaConstraints& constraints, int effects) { 230 const blink::WebMediaConstraints& constraints, int effects) {
223 DCHECK(!audio_processing_); 231 DCHECK(!audio_processing_);
224 if (!CommandLine::ForCurrentProcess()->HasSwitch( 232 if (!CommandLine::ForCurrentProcess()->HasSwitch(
225 switches::kEnableAudioTrackProcessing)) { 233 switches::kEnableAudioTrackProcessing)) {
226 return; 234 return;
227 } 235 }
228 236
229 RTCMediaConstraints native_constraints(constraints); 237 RTCMediaConstraints native_constraints(constraints);
230 ApplyFixedAudioConstraints(&native_constraints); 238 ApplyFixedAudioConstraints(&native_constraints);
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 if (!audio_processing_.get()) 439 if (!audio_processing_.get())
432 return; 440 return;
433 441
434 if (playout_data_source_) 442 if (playout_data_source_)
435 playout_data_source_->RemovePlayoutSink(this); 443 playout_data_source_->RemovePlayoutSink(this);
436 444
437 audio_processing_.reset(); 445 audio_processing_.reset();
438 } 446 }
439 447
440 } // namespace content 448 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_audio_processor.h ('k') | content/renderer/media/webrtc_audio_device_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698