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

Unified Diff: content/renderer/media/webrtc_audio_processing_wrapper.h

Issue 37793005: move the APM to chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698