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/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/public/common/media_stream_request.h" |
13 #include "content/renderer/media/webrtc_audio_device_impl.h" | 14 #include "content/renderer/media/webrtc_audio_device_impl.h" |
14 #include "media/base/audio_converter.h" | 15 #include "media/base/audio_converter.h" |
15 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 16 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
16 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h
" | 17 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h
" |
17 #include "third_party/webrtc/modules/interface/module_common_types.h" | 18 #include "third_party/webrtc/modules/interface/module_common_types.h" |
18 | 19 |
19 namespace blink { | 20 namespace blink { |
20 class WebMediaConstraints; | 21 class WebMediaConstraints; |
21 } | 22 } |
22 | 23 |
(...skipping 21 matching lines...) Expand all Loading... |
44 class CONTENT_EXPORT MediaStreamAudioProcessor : | 45 class CONTENT_EXPORT MediaStreamAudioProcessor : |
45 NON_EXPORTED_BASE(public WebRtcPlayoutDataSource::Sink), | 46 NON_EXPORTED_BASE(public WebRtcPlayoutDataSource::Sink), |
46 NON_EXPORTED_BASE(public AudioProcessorInterface) { | 47 NON_EXPORTED_BASE(public AudioProcessorInterface) { |
47 public: | 48 public: |
48 // |playout_data_source| is used to register this class as a sink to the | 49 // |playout_data_source| is used to register this class as a sink to the |
49 // WebRtc playout data for processing AEC. If clients do not enable AEC, | 50 // WebRtc playout data for processing AEC. If clients do not enable AEC, |
50 // |playout_data_source| won't be used. | 51 // |playout_data_source| won't be used. |
51 MediaStreamAudioProcessor(const media::AudioParameters& source_params, | 52 MediaStreamAudioProcessor(const media::AudioParameters& source_params, |
52 const blink::WebMediaConstraints& constraints, | 53 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 // Pushes capture data in |audio_source| to the internal FIFO. | 58 // Pushes capture data in |audio_source| to the internal FIFO. |
57 // Called on the capture audio thread. | 59 // Called on the capture audio thread. |
58 void PushCaptureData(media::AudioBus* audio_source); | 60 void PushCaptureData(media::AudioBus* audio_source); |
59 | 61 |
60 // Processes a block of 10 ms data from the internal FIFO and outputs it via | 62 // Processes a block of 10 ms data from the internal FIFO and outputs it via |
61 // |out|. |out| is the address of the pointer that will be pointed to | 63 // |out|. |out| is the address of the pointer that will be pointed to |
62 // the post-processed data if the method is returning a true. The lifetime | 64 // the post-processed data if the method is returning a true. The lifetime |
63 // of the data represeted by |out| is guaranteed to outlive the method call. | 65 // of the data represeted by |out| is guaranteed to outlive the method call. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 int sample_rate, | 102 int sample_rate, |
101 int audio_delay_milliseconds) OVERRIDE; | 103 int audio_delay_milliseconds) OVERRIDE; |
102 virtual void OnPlayoutDataSourceChanged() OVERRIDE; | 104 virtual void OnPlayoutDataSourceChanged() OVERRIDE; |
103 | 105 |
104 // webrtc::AudioProcessorInterface implementation. | 106 // webrtc::AudioProcessorInterface implementation. |
105 // This method is called on the libjingle thread. | 107 // This method is called on the libjingle thread. |
106 virtual void GetStats(AudioProcessorStats* stats) OVERRIDE; | 108 virtual void GetStats(AudioProcessorStats* stats) OVERRIDE; |
107 | 109 |
108 // Helper to initialize the WebRtc AudioProcessing. | 110 // Helper to initialize the WebRtc AudioProcessing. |
109 void InitializeAudioProcessingModule( | 111 void InitializeAudioProcessingModule( |
110 const blink::WebMediaConstraints& constraints, int effects); | 112 const blink::WebMediaConstraints& constraints, int effects, |
| 113 MediaStreamType type); |
111 | 114 |
112 // Helper to initialize the capture converter. | 115 // Helper to initialize the capture converter. |
113 void InitializeCaptureConverter(const media::AudioParameters& source_params); | 116 void InitializeCaptureConverter(const media::AudioParameters& source_params); |
114 | 117 |
115 // Helper to initialize the render converter. | 118 // Helper to initialize the render converter. |
116 void InitializeRenderConverterIfNeeded(int sample_rate, | 119 void InitializeRenderConverterIfNeeded(int sample_rate, |
117 int number_of_channels, | 120 int number_of_channels, |
118 int frames_per_buffer); | 121 int frames_per_buffer); |
119 | 122 |
120 // Called by ProcessAndConsumeData(). | 123 // Called by ProcessAndConsumeData(). |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 176 |
174 // This flag is used to show the result of typing detection. | 177 // This flag is used to show the result of typing detection. |
175 // It can be accessed by the capture audio thread and by the libjingle thread | 178 // It can be accessed by the capture audio thread and by the libjingle thread |
176 // which calls GetStats(). | 179 // which calls GetStats(). |
177 base::subtle::Atomic32 typing_detected_; | 180 base::subtle::Atomic32 typing_detected_; |
178 }; | 181 }; |
179 | 182 |
180 } // namespace content | 183 } // namespace content |
181 | 184 |
182 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ | 185 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ |
OLD | NEW |