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

Unified Diff: media/renderers/renderer_impl.h

Issue 2684103005: Allow media track switching. (Closed)
Patch Set: Added a LayoutTest for media track switching Created 3 years, 9 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: media/renderers/renderer_impl.h
diff --git a/media/renderers/renderer_impl.h b/media/renderers/renderer_impl.h
index f55a7635e22707644c5b818813542d23a49544c0..b8d2fcf87e142ee70d33f5c05839ec0c3577c6a2 100644
--- a/media/renderers/renderer_impl.h
+++ b/media/renderers/renderer_impl.h
@@ -106,8 +106,29 @@ class MEDIA_EXPORT RendererImpl : public Renderer {
void FlushVideoRenderer();
void OnVideoRendererFlushDone();
- void RestartAudioRenderer(base::TimeDelta time);
- void RestartVideoRenderer(base::TimeDelta time);
+ // Restart audio/video renderer playback after a media track switch or after a
+ // media track has been disabled and re-enabled. The |stream| parameter
+ // specifies which stream needs to be restarted. If it's the same as the most
+ // recently playing stream of that type, then the renderer is only restarted.
+ // But if it differs from the most recent stream, then the renderer is
+ // completely reinitialized, i.e. the corresponding DecoderStream is recreated
+ // and decoder is reinitialized too.
+ // 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);
+
+ // These callbacks are invoked when the corresponding renderer has been
+ // reinitialized. If the |status| indicates success, then playback of the
+ // |stream| should be resumed from media position specified by |time|.
+ void OnAudioRendererReinitCompleted(DemuxerStream* stream,
xhwang 2017/03/27 19:13:53 nit: OnAudioRendererReinitialized, or OnAudioRende
servolk 2017/03/27 22:34:13 Done.
+ base::TimeDelta time,
+ PipelineStatus status);
+ void OnVideoRendererReinitCompleted(DemuxerStream* stream,
+ base::TimeDelta time,
+ PipelineStatus status);
// Callback executed by filters to update statistics.
void OnStatisticsUpdate(const PipelineStatistics& stats);
@@ -166,6 +187,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_;

Powered by Google App Engine
This is Rietveld 408576698