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 |