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

Unified Diff: content/renderer/media/local_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/local_media_stream_audio_source.h
diff --git a/content/renderer/media/local_media_stream_audio_source.h b/content/renderer/media/local_media_stream_audio_source.h
new file mode 100644
index 0000000000000000000000000000000000000000..1c4847c98ed27d162d0752683b6fc485ab7c7412
--- /dev/null
+++ b/content/renderer/media/local_media_stream_audio_source.h
@@ -0,0 +1,60 @@
+// 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_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_
+#define CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_
+
+#include "content/common/media/media_stream_options.h"
+#include "content/renderer/media/media_stream_audio_source.h"
+#include "media/base/audio_capturer_source.h"
+#include "media/audio/audio_input_device.h"
+
+namespace content {
+
+// Represents a local source of audio data generated by an AudioInputDevice.
+// Uses content::AudioDeviceFactory to auto-create the AudioInputDevice, using
+// the parameters and session ID found in StreamDeviceInfo, just before the
+// first track is connected. Audio data is transported directly to the tracks
+// (i.e., there is no audio processing).
+class CONTENT_EXPORT LocalMediaStreamAudioSource
+ : NON_EXPORTED_BASE(public MediaStreamAudioSource),
+ NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback) {
+ public:
+ // |consumer_render_frame_id| references the RenderFrame that will consume the
+ // audio data. Audio parameters and (optionally) a pre-existing audio session
+ // ID are read from |device_info|.
+ LocalMediaStreamAudioSource(int consumer_render_frame_id,
+ const StreamDeviceInfo& device_info);
+
+ ~LocalMediaStreamAudioSource() 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 RenderFrame that will consume the audio data. Used when creating
+ // AudioInputDevices via the AudioDeviceFactory.
+ const int consumer_render_frame_id_;
+
+ // The StreamDeviceInfo session ID. Used when creating AudioInputDevices via
+ // the AudioDeviceFactory.
+ const int session_id_;
+
+ // The device created by the AudioDeviceFactory in EnsureSourceIsStarted().
+ scoped_refptr<media::AudioInputDevice> input_device_;
+
+ DISALLOW_COPY_AND_ASSIGN(LocalMediaStreamAudioSource);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_

Powered by Google App Engine
This is Rietveld 408576698