| Index: content/renderer/media/external_media_stream_audio_source.h
|
| diff --git a/content/renderer/media/media_interface_provider.h b/content/renderer/media/external_media_stream_audio_source.h
|
| similarity index 12%
|
| copy from content/renderer/media/media_interface_provider.h
|
| copy to content/renderer/media/external_media_stream_audio_source.h
|
| index 0e9166aa401523cef3f02e5d37e12660aa4e0a30..c9aad5bd268442e1b742f3a8052e04e6782f96b7 100644
|
| --- a/content/renderer/media/media_interface_provider.h
|
| +++ b/content/renderer/media/external_media_stream_audio_source.h
|
| @@ -2,48 +2,58 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CONTENT_RENDERER_MEDIA_MEDIA_INTERFACE_PROVIDER_H_
|
| -#define CONTENT_RENDERER_MEDIA_MEDIA_INTERFACE_PROVIDER_H_
|
| +#ifndef CONTENT_RENDERER_MEDIA_EXTERNAL_MEDIA_STREAM_AUDIO_SOURCE_H_
|
| +#define CONTENT_RENDERER_MEDIA_EXTERNAL_MEDIA_STREAM_AUDIO_SOURCE_H_
|
|
|
| -#include "base/callback.h"
|
| -#include "base/macros.h"
|
| -#include "base/threading/thread_checker.h"
|
| -#include "content/common/content_export.h"
|
| -#include "media/mojo/interfaces/service_factory.mojom.h"
|
| -#include "mojo/shell/public/interfaces/interface_provider.mojom.h"
|
| -#include "url/gurl.h"
|
| +#include "content/renderer/media/media_stream_audio_source.h"
|
| +
|
| +#include "media/base/audio_capturer_source.h"
|
|
|
| namespace content {
|
|
|
| -// MediaInterfaceProvider is an implementation of mojo InterfaceProvider that
|
| -// provides media related services and handles app disconnection automatically.
|
| -// This class is single threaded.
|
| -class CONTENT_EXPORT MediaInterfaceProvider
|
| - : public mojo::shell::mojom::InterfaceProvider {
|
| +// 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:
|
| - // Callback used to connect to a mojo application.
|
| - using ConnectToApplicationCB =
|
| - base::Callback<mojo::shell::mojom::InterfaceProviderPtr(const GURL& url)>;
|
| -
|
| - explicit MediaInterfaceProvider(
|
| - const ConnectToApplicationCB& connect_to_app_cb);
|
| - ~MediaInterfaceProvider() final;
|
| + ExternalMediaStreamAudioSource(
|
| + scoped_refptr<media::AudioCapturerSource> source,
|
| + int sample_rate,
|
| + media::ChannelLayout channel_layout,
|
| + int frames_per_buffer,
|
| + bool is_remote);
|
|
|
| - // InterfaceProvider implementation.
|
| - void GetInterface(const mojo::String& interface_name,
|
| - mojo::ScopedMessagePipeHandle pipe) final;
|
| + ~ExternalMediaStreamAudioSource() final;
|
|
|
| private:
|
| - media::interfaces::ServiceFactory* GetMediaServiceFactory();
|
| - void OnConnectionError();
|
| -
|
| + // MediaStreamAudioSource implementation.
|
| + bool EnsureSourceIsStarted() final;
|
| + void EnsureSourceIsStopped() 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.
|
| + scoped_refptr<media::AudioCapturerSource> source_;
|
| +
|
| + // In debug builds, check that all methods that could cause object graph
|
| + // or data flow changes are being called on the main thread.
|
| base::ThreadChecker thread_checker_;
|
| - ConnectToApplicationCB connect_to_app_cb_;
|
| - media::interfaces::ServiceFactoryPtr media_service_factory_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(MediaInterfaceProvider);
|
| + // True once the source has been started successfully.
|
| + bool was_started_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ExternalMediaStreamAudioSource);
|
| };
|
|
|
| } // namespace content
|
|
|
| -#endif // CONTENT_RENDERER_MEDIA_MEDIA_INTERFACE_PROVIDER_H_
|
| +#endif // CONTENT_RENDERER_MEDIA_EXTERNAL_MEDIA_STREAM_AUDIO_SOURCE_H_
|
|
|