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

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

Issue 1834323002: MediaStream audio: Refactor 3 separate "glue" implementations into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE + Workaround to ensure MediaStreamAudioProcessor is destroyed on the main thread. Created 4 years, 7 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 for (int time = kMaxLookbackTimeMs; time >= kMinLookbackTimeMs; 295 for (int time = kMaxLookbackTimeMs; time >= kMinLookbackTimeMs;
296 time -= kLookbackTimeStepMs) { 296 time -= kLookbackTimeStepMs) {
297 look_back_times.push_back(time); 297 look_back_times.push_back(time);
298 } 298 }
299 audio_repetition_detector_.reset( 299 audio_repetition_detector_.reset(
300 new AudioRepetitionDetector(kMinLengthMs, kMaxFrames, look_back_times, 300 new AudioRepetitionDetector(kMinLengthMs, kMaxFrames, look_back_times,
301 base::Bind(&ReportRepetition))); 301 base::Bind(&ReportRepetition)));
302 } 302 }
303 303
304 MediaStreamAudioProcessor::~MediaStreamAudioProcessor() { 304 MediaStreamAudioProcessor::~MediaStreamAudioProcessor() {
305 // TODO(miu): This class is ref-counted, shared among threads, and then
306 // requires itself to be destroyed on the main thread only?!?!? Fix this, and
307 // then remove the hack in WebRtcAudioSink::Adapter.
305 DCHECK(main_thread_checker_.CalledOnValidThread()); 308 DCHECK(main_thread_checker_.CalledOnValidThread());
306 Stop(); 309 Stop();
307 } 310 }
308 311
309 void MediaStreamAudioProcessor::OnCaptureFormatChanged( 312 void MediaStreamAudioProcessor::OnCaptureFormatChanged(
310 const media::AudioParameters& input_format) { 313 const media::AudioParameters& input_format) {
311 DCHECK(main_thread_checker_.CalledOnValidThread()); 314 DCHECK(main_thread_checker_.CalledOnValidThread());
312 // There is no need to hold a lock here since the caller guarantees that 315 // There is no need to hold a lock here since the caller guarantees that
313 // there is no more PushCaptureData() and ProcessAndConsumeData() callbacks 316 // there is no more PushCaptureData() and ProcessAndConsumeData() callbacks
314 // on the capture thread. 317 // on the capture thread.
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 if (echo_information_) { 742 if (echo_information_) {
740 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); 743 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation());
741 } 744 }
742 745
743 // Return 0 if the volume hasn't been changed, and otherwise the new volume. 746 // Return 0 if the volume hasn't been changed, and otherwise the new volume.
744 return (agc->stream_analog_level() == volume) ? 747 return (agc->stream_analog_level() == volume) ?
745 0 : agc->stream_analog_level(); 748 0 : agc->stream_analog_level();
746 } 749 }
747 750
748 } // namespace content 751 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_audio_deliverer.h ('k') | content/renderer/media/media_stream_audio_processor_options.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698