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

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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 base::subtle::Release_Store(&render_delay_ms_, audio_delay_milliseconds); 204 base::subtle::Release_Store(&render_delay_ms_, audio_delay_milliseconds);
205 205
206 InitializeRenderConverterIfNeeded(sample_rate, audio_bus->channels(), 206 InitializeRenderConverterIfNeeded(sample_rate, audio_bus->channels(),
207 audio_bus->frames()); 207 audio_bus->frames());
208 208
209 render_converter_->Push(audio_bus); 209 render_converter_->Push(audio_bus);
210 while (render_converter_->Convert(&render_frame_)) 210 while (render_converter_->Convert(&render_frame_))
211 audio_processing_->AnalyzeReverseStream(&render_frame_); 211 audio_processing_->AnalyzeReverseStream(&render_frame_);
212 } 212 }
213 213
214 void MediaStreamAudioProcessor::OnPlayoutDataSourceChanged() {
215 render_thread_checker_.DetachFromThread();
tommi (sloooow) - chröme 2014/03/04 20:48:39 add some documentation here that explains what thr
no longer working on chromium 2014/03/05 13:01:04 Done, I added a thread check here as well.
216 render_converter_.reset();
217 }
218
214 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) { 219 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) {
215 stats->typing_noise_detected = 220 stats->typing_noise_detected =
216 (base::subtle::Acquire_Load(&typing_detected_) != false); 221 (base::subtle::Acquire_Load(&typing_detected_) != false);
217 GetAecStats(audio_processing_.get(), stats); 222 GetAecStats(audio_processing_.get(), stats);
218 } 223 }
219 224
220 void MediaStreamAudioProcessor::InitializeAudioProcessingModule( 225 void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
221 const blink::WebMediaConstraints& constraints, int effects) { 226 const blink::WebMediaConstraints& constraints, int effects) {
222 DCHECK(!audio_processing_); 227 DCHECK(!audio_processing_);
223 if (!CommandLine::ForCurrentProcess()->HasSwitch( 228 if (!CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 if (!audio_processing_.get()) 441 if (!audio_processing_.get())
437 return; 442 return;
438 443
439 if (playout_data_source_) 444 if (playout_data_source_)
440 playout_data_source_->RemovePlayoutSink(this); 445 playout_data_source_->RemovePlayoutSink(this);
441 446
442 audio_processing_.reset(); 447 audio_processing_.reset();
443 } 448 }
444 449
445 } // namespace content 450 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698