| Index: content/renderer/media/external_media_stream_audio_source.h
|
| diff --git a/content/browser/device_sensors/device_sensor_message_filter.h b/content/renderer/media/external_media_stream_audio_source.h
|
| similarity index 13%
|
| copy from content/browser/device_sensors/device_sensor_message_filter.h
|
| copy to content/renderer/media/external_media_stream_audio_source.h
|
| index 13d0b0ac3ea7bf6f6fd2cff27190b8cdabe72aac..a2d3c641ee8304a4c6ede8a8fb38a6fd1bf9e94e 100644
|
| --- a/content/browser/device_sensors/device_sensor_message_filter.h
|
| +++ b/content/renderer/media/external_media_stream_audio_source.h
|
| @@ -2,39 +2,54 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CONTENT_BROWSER_DEVICE_SENSORS_DEVICE_SENSOR_MESSAGE_FILTER_H_
|
| -#define CONTENT_BROWSER_DEVICE_SENSORS_DEVICE_SENSOR_MESSAGE_FILTER_H_
|
| +#ifndef CONTENT_RENDERER_MEDIA_EXTERNAL_MEDIA_STREAM_AUDIO_SOURCE_H_
|
| +#define CONTENT_RENDERER_MEDIA_EXTERNAL_MEDIA_STREAM_AUDIO_SOURCE_H_
|
|
|
| -#include "base/macros.h"
|
| -#include "base/memory/shared_memory.h"
|
| -#include "content/browser/device_sensors/device_sensors_consts.h"
|
| -#include "content/public/browser/browser_message_filter.h"
|
| +#include "content/renderer/media/media_stream_audio_source.h"
|
| +
|
| +#include "media/base/audio_capturer_source.h"
|
|
|
| namespace content {
|
|
|
| -// A base class for device sensor related message filters.
|
| -class DeviceSensorMessageFilter : public BrowserMessageFilter {
|
| +// 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 final
|
| + : NON_EXPORTED_BASE(public MediaStreamAudioSource),
|
| + NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback) {
|
| public:
|
| - DeviceSensorMessageFilter(ConsumerType consumer_type,
|
| - uint32_t message_class_to_filter);
|
| -
|
| - protected:
|
| - // All methods below to be called on the IO thread.
|
| - ~DeviceSensorMessageFilter() override;
|
| + ExternalMediaStreamAudioSource(
|
| + scoped_refptr<media::AudioCapturerSource> source,
|
| + int sample_rate,
|
| + media::ChannelLayout channel_layout,
|
| + int frames_per_buffer,
|
| + bool is_remote);
|
|
|
| - virtual void OnStartPolling();
|
| - virtual void OnStopPolling();
|
| - // To be overriden by the subclass in order to send the appropriate message
|
| - // to the renderer with a handle to shared memory.
|
| - virtual void DidStartPolling(base::SharedMemoryHandle handle) = 0;
|
| + ~ExternalMediaStreamAudioSource() final;
|
|
|
| private:
|
| - ConsumerType consumer_type_;
|
| + // 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(DeviceSensorMessageFilter);
|
| + DISALLOW_COPY_AND_ASSIGN(ExternalMediaStreamAudioSource);
|
| };
|
|
|
| } // namespace content
|
|
|
| -#endif // CONTENT_BROWSER_DEVICE_SENSORS_DEVICE_SENSOR_MESSAGE_FILTER_H_
|
| +#endif // CONTENT_RENDERER_MEDIA_EXTERNAL_MEDIA_STREAM_AUDIO_SOURCE_H_
|
|
|