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

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

Issue 190713004: Only turn on the audio processing by default for MEDIA_DEVICE_AUDIO_CAPTURE (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: unittest 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
« no previous file with comments | « no previous file | content/renderer/media/media_stream_audio_processor.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 // 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 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_
7 7
8 #include "base/atomicops.h" 8 #include "base/atomicops.h"
9 #include "base/platform_file.h" 9 #include "base/platform_file.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "base/threading/thread_checker.h" 11 #include "base/threading/thread_checker.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/public/common/media_stream_request.h"
14 #include "content/renderer/media/webrtc_audio_device_impl.h" 15 #include "content/renderer/media/webrtc_audio_device_impl.h"
15 #include "media/base/audio_converter.h" 16 #include "media/base/audio_converter.h"
16 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" 17 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
17 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h " 18 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h "
18 #include "third_party/webrtc/modules/interface/module_common_types.h" 19 #include "third_party/webrtc/modules/interface/module_common_types.h"
19 20
20 namespace blink { 21 namespace blink {
21 class WebMediaConstraints; 22 class WebMediaConstraints;
22 } 23 }
23 24
(...skipping 20 matching lines...) Expand all
44 // of 10 ms data chunk. 45 // of 10 ms data chunk.
45 class CONTENT_EXPORT MediaStreamAudioProcessor : 46 class CONTENT_EXPORT MediaStreamAudioProcessor :
46 NON_EXPORTED_BASE(public WebRtcPlayoutDataSource::Sink), 47 NON_EXPORTED_BASE(public WebRtcPlayoutDataSource::Sink),
47 NON_EXPORTED_BASE(public AudioProcessorInterface) { 48 NON_EXPORTED_BASE(public AudioProcessorInterface) {
48 public: 49 public:
49 // |playout_data_source| is used to register this class as a sink to the 50 // |playout_data_source| is used to register this class as a sink to the
50 // WebRtc playout data for processing AEC. If clients do not enable AEC, 51 // WebRtc playout data for processing AEC. If clients do not enable AEC,
51 // |playout_data_source| won't be used. 52 // |playout_data_source| won't be used.
52 MediaStreamAudioProcessor(const blink::WebMediaConstraints& constraints, 53 MediaStreamAudioProcessor(const blink::WebMediaConstraints& constraints,
53 int effects, 54 int effects,
55 MediaStreamType type,
54 WebRtcPlayoutDataSource* playout_data_source); 56 WebRtcPlayoutDataSource* playout_data_source);
55 57
56 // Called when format of the capture data has changed. 58 // Called when format of the capture data has changed.
57 // Called on the main render thread. The caller is responsible for stopping 59 // Called on the main render thread. The caller is responsible for stopping
58 // the capture thread before calling this method. 60 // the capture thread before calling this method.
59 // After this method, the capture thread will be changed to a new capture 61 // After this method, the capture thread will be changed to a new capture
60 // thread. 62 // thread.
61 void OnCaptureFormatChanged(const media::AudioParameters& source_params); 63 void OnCaptureFormatChanged(const media::AudioParameters& source_params);
62 64
63 // Pushes capture data in |audio_source| to the internal FIFO. 65 // Pushes capture data in |audio_source| to the internal FIFO.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 int sample_rate, 114 int sample_rate,
113 int audio_delay_milliseconds) OVERRIDE; 115 int audio_delay_milliseconds) OVERRIDE;
114 virtual void OnPlayoutDataSourceChanged() OVERRIDE; 116 virtual void OnPlayoutDataSourceChanged() OVERRIDE;
115 117
116 // webrtc::AudioProcessorInterface implementation. 118 // webrtc::AudioProcessorInterface implementation.
117 // This method is called on the libjingle thread. 119 // This method is called on the libjingle thread.
118 virtual void GetStats(AudioProcessorStats* stats) OVERRIDE; 120 virtual void GetStats(AudioProcessorStats* stats) OVERRIDE;
119 121
120 // Helper to initialize the WebRtc AudioProcessing. 122 // Helper to initialize the WebRtc AudioProcessing.
121 void InitializeAudioProcessingModule( 123 void InitializeAudioProcessingModule(
122 const blink::WebMediaConstraints& constraints, int effects); 124 const blink::WebMediaConstraints& constraints, int effects,
125 MediaStreamType type);
123 126
124 // Helper to initialize the capture converter. 127 // Helper to initialize the capture converter.
125 void InitializeCaptureConverter(const media::AudioParameters& source_params); 128 void InitializeCaptureConverter(const media::AudioParameters& source_params);
126 129
127 // Helper to initialize the render converter. 130 // Helper to initialize the render converter.
128 void InitializeRenderConverterIfNeeded(int sample_rate, 131 void InitializeRenderConverterIfNeeded(int sample_rate,
129 int number_of_channels, 132 int number_of_channels,
130 int frames_per_buffer); 133 int frames_per_buffer);
131 134
132 // Called by ProcessAndConsumeData(). 135 // Called by ProcessAndConsumeData().
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 188
186 // This flag is used to show the result of typing detection. 189 // This flag is used to show the result of typing detection.
187 // It can be accessed by the capture audio thread and by the libjingle thread 190 // It can be accessed by the capture audio thread and by the libjingle thread
188 // which calls GetStats(). 191 // which calls GetStats().
189 base::subtle::Atomic32 typing_detected_; 192 base::subtle::Atomic32 typing_detected_;
190 }; 193 };
191 194
192 } // namespace content 195 } // namespace content
193 196
194 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ 197 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/media_stream_audio_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698