| Index: media/renderers/renderer_impl.h
|
| diff --git a/media/renderers/renderer_impl.h b/media/renderers/renderer_impl.h
|
| index 0a30165b0cea2a7d96c18f4c2afe01fc5476c60d..8f2e2cdae5f3c43f2e334614745d60f662344a3a 100644
|
| --- a/media/renderers/renderer_impl.h
|
| +++ b/media/renderers/renderer_impl.h
|
| @@ -61,10 +61,6 @@ class MEDIA_EXPORT RendererImpl : public Renderer {
|
| void SetVolume(float volume) final;
|
| base::TimeDelta GetMediaTime() final;
|
|
|
| - void OnStreamStatusChanged(DemuxerStream* stream,
|
| - bool enabled,
|
| - base::TimeDelta time);
|
| -
|
| // Helper functions for testing purposes. Must be called before Initialize().
|
| void DisableUnderflowForTesting();
|
| void EnableClocklessVideoPlaybackForTesting();
|
| @@ -107,8 +103,36 @@ class MEDIA_EXPORT RendererImpl : public Renderer {
|
| void FlushVideoRenderer();
|
| void OnVideoRendererFlushDone();
|
|
|
| - void RestartAudioRenderer(base::TimeDelta time);
|
| - void RestartVideoRenderer(base::TimeDelta time);
|
| + // This function notifies the renderer that the status of the demuxer |stream|
|
| + // has been changed, the new status is |enabled| and the change occured while
|
| + // playback position was |time|.
|
| + void OnStreamStatusChanged(DemuxerStream* stream,
|
| + bool enabled,
|
| + base::TimeDelta time);
|
| +
|
| + // Reinitialize audio/video renderer during a demuxer stream switching. The
|
| + // renderer must be flushed first, and when the re-init is completed the
|
| + // corresponding callback will be invoked to restart playback.
|
| + // The |stream| parameter specifies the new demuxer stream, and the |time|
|
| + // parameter specifies the time on media timeline where the switch occured.
|
| + void ReinitializeAudioRenderer(DemuxerStream* stream, base::TimeDelta time);
|
| + void OnAudioRendererReinitialized(DemuxerStream* stream,
|
| + base::TimeDelta time,
|
| + PipelineStatus status);
|
| + void ReinitializeVideoRenderer(DemuxerStream* stream, base::TimeDelta time);
|
| + void OnVideoRendererReinitialized(DemuxerStream* stream,
|
| + base::TimeDelta time,
|
| + PipelineStatus status);
|
| +
|
| + // Restart audio/video renderer playback after a demuxer stream switch or
|
| + // after a demuxer stream has been disabled and re-enabled. The |stream|
|
| + // parameter specifies which stream needs to be restarted. The |time|
|
| + // parameter specifies the position on the media timeline where the playback
|
| + // needs to be restarted. It is necessary for demuxers with independent
|
| + // streams (e.g. MSE / ChunkDemuxer) to synchronize data reading between those
|
| + // streams.
|
| + void RestartAudioRenderer(DemuxerStream* stream, base::TimeDelta time);
|
| + void RestartVideoRenderer(DemuxerStream* stream, base::TimeDelta time);
|
|
|
| // Callback executed by filters to update statistics.
|
| void OnStatisticsUpdate(const PipelineStatistics& stats);
|
| @@ -124,6 +148,7 @@ class MEDIA_EXPORT RendererImpl : public Renderer {
|
| // and PausePlayback() should be called
|
| void OnBufferingStateChange(DemuxerStream::Type type,
|
| BufferingState new_buffering_state);
|
| +
|
| // Handles the buffering notifications that we might get while an audio or a
|
| // video stream is being restarted. In those cases we don't want to report
|
| // underflows immediately and instead give decoders a chance to catch up with
|
| @@ -133,6 +158,7 @@ class MEDIA_EXPORT RendererImpl : public Renderer {
|
| bool HandleRestartedStreamBufferingChanges(
|
| DemuxerStream::Type type,
|
| BufferingState new_buffering_state);
|
| +
|
| bool WaitingForEnoughData() const;
|
| void PausePlayback();
|
| void StartPlayback();
|
| @@ -167,6 +193,9 @@ class MEDIA_EXPORT RendererImpl : public Renderer {
|
| std::unique_ptr<AudioRenderer> audio_renderer_;
|
| std::unique_ptr<VideoRenderer> video_renderer_;
|
|
|
| + DemuxerStream* current_audio_stream_;
|
| + DemuxerStream* current_video_stream_;
|
| +
|
| // Renderer-provided time source used to control playback.
|
| TimeSource* time_source_;
|
| std::unique_ptr<WallClockTimeSource> wall_clock_time_source_;
|
| @@ -201,7 +230,13 @@ class MEDIA_EXPORT RendererImpl : public Renderer {
|
|
|
| bool restarting_audio_ = false;
|
| bool restarting_video_ = false;
|
| - std::list<base::Closure> pending_stream_status_notifications_;
|
| +
|
| + // Flush operations and media track status changes must be serialized to avoid
|
| + // interfering with each other. This list will hold a list of postponed
|
| + // actions that need to be completed after the current async operation is
|
| + // completed.
|
| + std::list<base::Closure> pending_actions_;
|
| + base::Closure pending_flush_cb_;
|
|
|
| base::WeakPtr<RendererImpl> weak_this_;
|
| base::WeakPtrFactory<RendererImpl> weak_factory_;
|
|
|