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

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

Issue 1647773002: MediaStream audio sourcing: Bypass audio processing for non-WebRTC cases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NOT FOR REVIEW -- This will be broken-up across multiple CLs. Created 4 years, 10 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/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_
« no previous file with comments | « content/renderer/media/audio_track_recorder_unittest.cc ('k') | content/renderer/media/external_media_stream_audio_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698