Index: content/renderer/media/webrtc_audio_processing_wrapper.h |
diff --git a/content/renderer/media/webrtc_audio_processing_wrapper.h b/content/renderer/media/webrtc_audio_processing_wrapper.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4c9635c40169ee474ad491c610d46bdc0686c026 |
--- /dev/null |
+++ b/content/renderer/media/webrtc_audio_processing_wrapper.h |
@@ -0,0 +1,77 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_PROCESSING_WRAPPER_H_ |
+#define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_PROCESSING_WRAPPER_H_ |
+ |
+#include "content/common/content_export.h" |
+#include "media/base/audio_converter.h" |
+#include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface.h" |
+#include "third_party/webrtc/modules/audio_processing/include/audio_processing.h" |
+#include "third_party/webrtc/modules/interface/module_common_types.h" |
+ |
+namespace media { |
+class AudioBus; |
+class AudioFifo; |
+class AudioParameters; |
+} // namespace media |
+ |
+namespace webrtc { |
+class AudioFrame; |
+} |
+ |
+namespace content { |
+ |
+// This class is a wrapper class of webrtc::AudioProcessing. |
+class CONTENT_EXPORT WebRtcAudioProcessingWrapper { |
+ public: |
+ WebRtcAudioProcessingWrapper(); |
+ ~WebRtcAudioProcessingWrapper(); |
+ |
+ // TODO(xians): Add comment. |
+ void Configure(const media::AudioParameters& source_params, |
+ const webrtc::MediaConstraintsInterface* constraints); |
+ |
+ void Push(media::AudioBus* audio_source); |
+ |
+ // Returns true if it has 10ms data for processing, otherwise false. |
+ bool ProcessAndConsume10MsData(int capture_audio_delay_ms, |
+ int volume, |
+ bool key_pressed); |
+ |
+ const int16* OutputBuffer() const; |
+ const media::AudioParameters& OutputFormat() const; |
+ |
+ // Feed render audio to AudioProcessing for analysis. This is needed |
+ // if and only if echo processing is enabled. |
+ void FeedRenderDataToAudioProcessing(const int16* render_audio, |
+ int sample_rate, |
+ int number_of_channels, |
+ int number_of_frames, |
+ int render_delay_ms); |
+ |
+ private: |
+ class WebRtcAudioConverter; |
+ |
+ void InitializeCaptureConverter(const media::AudioParameters& source_params); |
+ void InitializeRenderConverterIfNeeded(int sample_rate, |
+ int number_of_channels, |
+ int frames_per_buffer); |
+ // Processes 10ms data. |
+ void Process10MsData(int audio_delay_milliseconds, |
+ int volume, |
+ bool key_pressed); |
+ |
+ void StopAudioProcessing(); |
+ |
+ // Hanles processing the audio data. |
+ scoped_ptr<webrtc::AudioProcessing> audio_processing_; |
+ |
+ scoped_ptr<WebRtcAudioConverter> capture_converter_; |
+ scoped_ptr<WebRtcAudioConverter> render_converter_; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_PROCESSING_WRAPPER_H_ |