OLD | NEW |
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/files/file.h" | 9 #include "base/files/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" | |
15 #include "content/renderer/media/webrtc_audio_device_impl.h" | 14 #include "content/renderer/media/webrtc_audio_device_impl.h" |
16 #include "media/base/audio_converter.h" | 15 #include "media/base/audio_converter.h" |
17 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 16 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
18 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h
" | 17 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h
" |
19 #include "third_party/webrtc/modules/interface/module_common_types.h" | 18 #include "third_party/webrtc/modules/interface/module_common_types.h" |
20 | 19 |
21 namespace blink { | 20 namespace blink { |
22 class WebMediaConstraints; | 21 class WebMediaConstraints; |
23 } | 22 } |
24 | 23 |
(...skipping 24 matching lines...) Expand all Loading... |
49 public: | 48 public: |
50 // Returns true if |kEnableAudioTrackProcessing| is on or if the | 49 // Returns true if |kEnableAudioTrackProcessing| is on or if the |
51 // |MediaStreamAudioTrackProcessing| finch experiment is enabled. | 50 // |MediaStreamAudioTrackProcessing| finch experiment is enabled. |
52 static bool IsAudioTrackProcessingEnabled(); | 51 static bool IsAudioTrackProcessingEnabled(); |
53 | 52 |
54 // |playout_data_source| is used to register this class as a sink to the | 53 // |playout_data_source| is used to register this class as a sink to the |
55 // WebRtc playout data for processing AEC. If clients do not enable AEC, | 54 // WebRtc playout data for processing AEC. If clients do not enable AEC, |
56 // |playout_data_source| won't be used. | 55 // |playout_data_source| won't be used. |
57 MediaStreamAudioProcessor(const blink::WebMediaConstraints& constraints, | 56 MediaStreamAudioProcessor(const blink::WebMediaConstraints& constraints, |
58 int effects, | 57 int effects, |
59 MediaStreamType type, | |
60 WebRtcPlayoutDataSource* playout_data_source); | 58 WebRtcPlayoutDataSource* playout_data_source); |
61 | 59 |
62 // Called when format of the capture data has changed. | 60 // Called when format of the capture data has changed. |
63 // Called on the main render thread. The caller is responsible for stopping | 61 // Called on the main render thread. The caller is responsible for stopping |
64 // the capture thread before calling this method. | 62 // the capture thread before calling this method. |
65 // After this method, the capture thread will be changed to a new capture | 63 // After this method, the capture thread will be changed to a new capture |
66 // thread. | 64 // thread. |
67 void OnCaptureFormatChanged(const media::AudioParameters& source_params); | 65 void OnCaptureFormatChanged(const media::AudioParameters& source_params); |
68 | 66 |
69 // Pushes capture data in |audio_source| to the internal FIFO. | 67 // Pushes capture data in |audio_source| to the internal FIFO. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 int sample_rate, | 116 int sample_rate, |
119 int audio_delay_milliseconds) OVERRIDE; | 117 int audio_delay_milliseconds) OVERRIDE; |
120 virtual void OnPlayoutDataSourceChanged() OVERRIDE; | 118 virtual void OnPlayoutDataSourceChanged() OVERRIDE; |
121 | 119 |
122 // webrtc::AudioProcessorInterface implementation. | 120 // webrtc::AudioProcessorInterface implementation. |
123 // This method is called on the libjingle thread. | 121 // This method is called on the libjingle thread. |
124 virtual void GetStats(AudioProcessorStats* stats) OVERRIDE; | 122 virtual void GetStats(AudioProcessorStats* stats) OVERRIDE; |
125 | 123 |
126 // Helper to initialize the WebRtc AudioProcessing. | 124 // Helper to initialize the WebRtc AudioProcessing. |
127 void InitializeAudioProcessingModule( | 125 void InitializeAudioProcessingModule( |
128 const blink::WebMediaConstraints& constraints, int effects, | 126 const blink::WebMediaConstraints& constraints, int effects); |
129 MediaStreamType type); | |
130 | 127 |
131 // Helper to initialize the capture converter. | 128 // Helper to initialize the capture converter. |
132 void InitializeCaptureConverter(const media::AudioParameters& source_params); | 129 void InitializeCaptureConverter(const media::AudioParameters& source_params); |
133 | 130 |
134 // Helper to initialize the render converter. | 131 // Helper to initialize the render converter. |
135 void InitializeRenderConverterIfNeeded(int sample_rate, | 132 void InitializeRenderConverterIfNeeded(int sample_rate, |
136 int number_of_channels, | 133 int number_of_channels, |
137 int frames_per_buffer); | 134 int frames_per_buffer); |
138 | 135 |
139 // Called by ProcessAndConsumeData(). | 136 // Called by ProcessAndConsumeData(). |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 189 |
193 // This flag is used to show the result of typing detection. | 190 // This flag is used to show the result of typing detection. |
194 // It can be accessed by the capture audio thread and by the libjingle thread | 191 // It can be accessed by the capture audio thread and by the libjingle thread |
195 // which calls GetStats(). | 192 // which calls GetStats(). |
196 base::subtle::Atomic32 typing_detected_; | 193 base::subtle::Atomic32 typing_detected_; |
197 }; | 194 }; |
198 | 195 |
199 } // namespace content | 196 } // namespace content |
200 | 197 |
201 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ | 198 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ |
OLD | NEW |