Index: content/renderer/media/external_media_stream_audio_source.h |
diff --git a/content/renderer/media/external_media_stream_audio_source.h b/content/renderer/media/external_media_stream_audio_source.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5e8dd77993bb30dd749d39537956499cdfbb96c9 |
--- /dev/null |
+++ b/content/renderer/media/external_media_stream_audio_source.h |
@@ -0,0 +1,55 @@ |
+// Copyright 2016 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_EXTERNAL_MEDIA_STREAM_AUDIO_SOURCE_H_ |
+#define CONTENT_RENDERER_MEDIA_EXTERNAL_MEDIA_STREAM_AUDIO_SOURCE_H_ |
+ |
+#include "content/renderer/media/media_stream_audio_source.h" |
+ |
+#include "media/base/audio_capturer_source.h" |
+ |
+namespace content { |
+ |
+// Represents an externally-provided local or remote source of audio data. This |
+// allows users of the public content::MediaStreamApi to provide a |
+// media::AudioCapturerSource to be used as the source of audio data in the |
+// MediaStream framework. Audio data is transported directly to the tracks |
+// (i.e., there is no audio processing). |
+class CONTENT_EXPORT ExternalMediaStreamAudioSource |
+ : NON_EXPORTED_BASE(public MediaStreamAudioSource), |
+ NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback) { |
+ public: |
+ ExternalMediaStreamAudioSource( |
+ const scoped_refptr<media::AudioCapturerSource>& source, |
+ int sample_rate, |
+ media::ChannelLayout channel_layout, |
+ int frames_per_buffer, |
+ bool is_remote); |
+ |
+ ~ExternalMediaStreamAudioSource() final; |
+ |
+ private: |
+ // MediaStreamAudioSource implementation. |
+ void DoStopSource() final; |
+ bool EnsureSourceIsStarted() final; |
+ |
+ // media::AudioCapturerSource::CaptureCallback implementation. |
+ void Capture(const media::AudioBus* audio_bus, |
+ int audio_delay_milliseconds, |
+ double volume, |
+ bool key_pressed) final; |
+ void OnCaptureError(const std::string& message) final; |
+ |
+ // The external source provided to the constructor. |
+ const scoped_refptr<media::AudioCapturerSource> source_; |
+ |
+ // True once the source has been started successfully. |
+ bool is_started_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ExternalMediaStreamAudioSource); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_MEDIA_EXTERNAL_MEDIA_STREAM_AUDIO_SOURCE_H_ |