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

Unified Diff: content/public/renderer/media_stream_audio_sink.h

Issue 90743004: Add generic interfaces for the sinks of the media stream audio track (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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/public/renderer/media_stream_audio_sink.h
diff --git a/content/public/renderer/media_stream_audio_sink.h b/content/public/renderer/media_stream_audio_sink.h
new file mode 100644
index 0000000000000000000000000000000000000000..079c086d859045c26757ec45a6c3e6ce555df9c1
--- /dev/null
+++ b/content/public/renderer/media_stream_audio_sink.h
@@ -0,0 +1,58 @@
+// 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.
+
+
+#include "content/common/content_export.h"
+
+namespace blink {
+class WebMediaStreamTrack;
+}
+
+namespace content {
+
+class CONTENT_EXPORT MediaStreamAudioSink {
no longer working on chromium 2013/11/27 13:36:20 it will inherit MediaStreamSink after Per lands hi
+ // Callback on delivering the audio interleaved data.
+ // |audio_data| is the pointer to the audio data.
+ // |sample_rate| is the sample frequency of audio data.
+ // |number_of_channels| is the number of channels reflecting the order of
+ // surround sound channels.
+ // |number_of_frames| is the number of audio freams in the buffer.
perkj_chrome 2013/11/27 14:56:40 spelling
no longer working on chromium 2013/11/27 16:27:57 Done.
+ // |channels| contains a vector of WebRtc VoE channels.
+ // |audio_delay_milliseconds| is recording delay value.
+ // |current_volume| is current microphone volume, in range of |0, 255].
+ // |need_audio_processing| indicates if the audio needs WebRtc AEC/NS/AGC
+ // audio processing.
+ // |key_pressed| is the flag to help typing detection.
+ // Note, |channels|, |audio_delay_milliseconds|, |current_volume|,
+ // |need_audio_processing| and |key_pressed| are needed by WebRtc, for other
+ // clients, those variables can be ignore.
+ // TODO(xians): Remove those WebRtc specific variables after moving the
no longer working on chromium 2013/11/27 13:36:20 I hope these comments and TODO can explain why we
+ // APM from WebRtc to Chrome.
+ // The return value is the new microphone volume, in the range of |0, 255].
+ // When the volume does not need to be updated, it returns 0.
+ virtual int OnData(const int16* audio_data,
+ int sample_rate,
+ int number_of_channels,
+ int number_of_frames,
+ const std::vector<int>& channels,
+ int audio_delay_milliseconds,
+ int current_volume,
+ bool need_audio_processing,
+ bool key_pressed) = 0;
+
+ // Callback called when the forma of the audio stream has changed, and
+ // it will be called on the same thread as calling OnData().
+ virtual void OnSetFormat(const media::AudioParameters& params) = 0;
+
+ protected:
+ virtual ~MediaStreamAudioSink() {}
+};
+
+CONTENT_EXPORT void AddToAudioTrack(MediaStreamAudioSink* sink,
+ const blink::WebMediaStreamTrack& track);
+
+CONTENT_EXPORT void RemoveFromAudioTrack(
+ MediaStreamAudioSink* sink, const blink::WebMediaStreamTrack& track);
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698