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/renderer/media/aec_dump_message_filter.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 13 matching lines...) Expand all Loading... |
37 class RTCMediaConstraints; | 38 class RTCMediaConstraints; |
38 | 39 |
39 using webrtc::AudioProcessorInterface; | 40 using webrtc::AudioProcessorInterface; |
40 | 41 |
41 // This class owns an object of webrtc::AudioProcessing which contains signal | 42 // This class owns an object of webrtc::AudioProcessing which contains signal |
42 // processing components like AGC, AEC and NS. It enables the components based | 43 // processing components like AGC, AEC and NS. It enables the components based |
43 // on the getUserMedia constraints, processes the data and outputs it in a unit | 44 // on the getUserMedia constraints, processes the data and outputs it in a unit |
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), |
| 49 NON_EXPORTED_BASE(public AecDumpMessageFilter::AecDumpDelegate) { |
48 public: | 50 public: |
49 // Returns false if |kDisableAudioTrackProcessing| is set to true, otherwise | 51 // Returns false if |kDisableAudioTrackProcessing| is set to true, otherwise |
50 // returns true. | 52 // returns true. |
51 static bool IsAudioTrackProcessingEnabled(); | 53 static bool IsAudioTrackProcessingEnabled(); |
52 | 54 |
53 // |playout_data_source| is used to register this class as a sink to the | 55 // |playout_data_source| is used to register this class as a sink to the |
54 // WebRtc playout data for processing AEC. If clients do not enable AEC, | 56 // WebRtc playout data for processing AEC. If clients do not enable AEC, |
55 // |playout_data_source| won't be used. | 57 // |playout_data_source| won't be used. |
56 MediaStreamAudioProcessor(const blink::WebMediaConstraints& constraints, | 58 MediaStreamAudioProcessor(const blink::WebMediaConstraints& constraints, |
57 int effects, | 59 int effects, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 91 |
90 // The audio format of the input to the processor. | 92 // The audio format of the input to the processor. |
91 const media::AudioParameters& InputFormat() const; | 93 const media::AudioParameters& InputFormat() const; |
92 | 94 |
93 // The audio format of the output from the processor. | 95 // The audio format of the output from the processor. |
94 const media::AudioParameters& OutputFormat() const; | 96 const media::AudioParameters& OutputFormat() const; |
95 | 97 |
96 // Accessor to check if the audio processing is enabled or not. | 98 // Accessor to check if the audio processing is enabled or not. |
97 bool has_audio_processing() const { return audio_processing_ != NULL; } | 99 bool has_audio_processing() const { return audio_processing_ != NULL; } |
98 | 100 |
99 // Starts/Stops the Aec dump on the |audio_processing_|. | 101 // AecDumpMessageFilter::AecDumpDelegate implementation. |
100 // Called on the main render thread. | 102 // Called on the main render thread. |
101 // This method takes the ownership of |aec_dump_file|. | 103 virtual void OnAecDumpFile( |
102 void StartAecDump(base::File aec_dump_file); | 104 const IPC::PlatformFileForTransit& file_handle) OVERRIDE; |
103 void StopAecDump(); | 105 virtual void OnDisableAecDump() OVERRIDE; |
| 106 virtual void OnIpcClosing() OVERRIDE; |
104 | 107 |
105 protected: | 108 protected: |
106 friend class base::RefCountedThreadSafe<MediaStreamAudioProcessor>; | 109 friend class base::RefCountedThreadSafe<MediaStreamAudioProcessor>; |
107 virtual ~MediaStreamAudioProcessor(); | 110 virtual ~MediaStreamAudioProcessor(); |
108 | 111 |
109 private: | 112 private: |
110 friend class MediaStreamAudioProcessorTest; | 113 friend class MediaStreamAudioProcessorTest; |
111 | 114 |
112 class MediaStreamAudioConverter; | 115 class MediaStreamAudioConverter; |
113 | 116 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // Flag to enable the stereo channels mirroring. | 187 // Flag to enable the stereo channels mirroring. |
185 bool audio_mirroring_; | 188 bool audio_mirroring_; |
186 | 189 |
187 // Used by the typing detection. | 190 // Used by the typing detection. |
188 scoped_ptr<webrtc::TypingDetection> typing_detector_; | 191 scoped_ptr<webrtc::TypingDetection> typing_detector_; |
189 | 192 |
190 // This flag is used to show the result of typing detection. | 193 // This flag is used to show the result of typing detection. |
191 // It can be accessed by the capture audio thread and by the libjingle thread | 194 // It can be accessed by the capture audio thread and by the libjingle thread |
192 // which calls GetStats(). | 195 // which calls GetStats(). |
193 base::subtle::Atomic32 typing_detected_; | 196 base::subtle::Atomic32 typing_detected_; |
| 197 |
| 198 // Communication with browser for AEC dump. |
| 199 scoped_refptr<AecDumpMessageFilter> aec_dump_message_filter_; |
194 }; | 200 }; |
195 | 201 |
196 } // namespace content | 202 } // namespace content |
197 | 203 |
198 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ | 204 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ |
OLD | NEW |