| Index: content/renderer/media/media_stream_audio_track.h
|
| diff --git a/content/renderer/media/media_stream_audio_track.h b/content/renderer/media/media_stream_audio_track.h
|
| index 2175b4e186f47fefc982e097a1691dac1fdd7383..0ef126b431a3af9bcdc0686f71ecd95a474214bc 100644
|
| --- a/content/renderer/media/media_stream_audio_track.h
|
| +++ b/content/renderer/media/media_stream_audio_track.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_H_
|
| #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_H_
|
|
|
| +#include "base/callback.h"
|
| #include "base/macros.h"
|
| #include "content/renderer/media/media_stream_track.h"
|
|
|
| @@ -16,13 +17,21 @@ namespace content {
|
|
|
| class MediaStreamAudioSink;
|
|
|
| +// TODO(miu): In a soon-upcoming set of refactoring changes, this class will
|
| +// take on the functionality of managing sink connections and the audio data
|
| +// flow between source and sinks. The WebRTC-specific elements will then be
|
| +// moved into a subclass. http://crbug.com/577874
|
| class CONTENT_EXPORT MediaStreamAudioTrack : public MediaStreamTrack {
|
| public:
|
| explicit MediaStreamAudioTrack(bool is_local_track);
|
| +
|
| + // Subclasses must ensure the track is stopped (i.e., Stop() has been called
|
| + // at least once) before this destructor is invoked.
|
| ~MediaStreamAudioTrack() override;
|
|
|
| - static MediaStreamAudioTrack* GetTrack(
|
| - const blink::WebMediaStreamTrack& track);
|
| + // Returns the MediaStreamAudioTrack instance owned by the given blink |track|
|
| + // or null.
|
| + static MediaStreamAudioTrack* From(const blink::WebMediaStreamTrack& track);
|
|
|
| // Add a sink to the track. This function will trigger a OnSetFormat()
|
| // call on the |sink|.
|
| @@ -34,6 +43,7 @@ class CONTENT_EXPORT MediaStreamAudioTrack : public MediaStreamTrack {
|
| virtual void RemoveSink(MediaStreamAudioSink* sink) = 0;
|
|
|
| // TODO(tommi, xians): Remove this method.
|
| + // TODO(miu): See class-level TODO comment. ;-)
|
| virtual webrtc::AudioTrackInterface* GetAudioAdapter();
|
|
|
| // Returns the output format of the capture source. May return an invalid
|
| @@ -44,7 +54,23 @@ class CONTENT_EXPORT MediaStreamAudioTrack : public MediaStreamTrack {
|
| // to the complexity of all types of audio tracks+source implementations.
|
| virtual media::AudioParameters GetOutputFormat() const = 0;
|
|
|
| + // Called to notify this track that the flow of audio data has started from
|
| + // the source. |stop_callback| is run by Stop() when the source must halt the
|
| + // flow of audio data to this track.
|
| + void Start(const base::Closure& stop_callback);
|
| +
|
| + // Halts the flow of audio data from the source (and to the sinks), and then
|
| + // invokes OnStop() to perform any additional actions.
|
| + void Stop() final;
|
| +
|
| + protected:
|
| + // Called by Stop() after the source has halted the flow of audio data.
|
| + virtual void OnStop();
|
| +
|
| private:
|
| + // Callback provided to Start() which is run when the audio flow must halt.
|
| + base::Closure stop_callback_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioTrack);
|
| };
|
|
|
|
|