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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_RENDERERS_RENDERER_IMPL_H_ 5 #ifndef MEDIA_RENDERERS_RENDERER_IMPL_H_
6 #define MEDIA_RENDERERS_RENDERER_IMPL_H_ 6 #define MEDIA_RENDERERS_RENDERER_IMPL_H_
7 7
8 #include <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 void OnAudioRendererInitializeDone(PipelineStatus status); 99 void OnAudioRendererInitializeDone(PipelineStatus status);
100 void InitializeVideoRenderer(); 100 void InitializeVideoRenderer();
101 void OnVideoRendererInitializeDone(PipelineStatus status); 101 void OnVideoRendererInitializeDone(PipelineStatus status);
102 102
103 // Helper functions and callbacks for Flush(). 103 // Helper functions and callbacks for Flush().
104 void FlushAudioRenderer(); 104 void FlushAudioRenderer();
105 void OnAudioRendererFlushDone(); 105 void OnAudioRendererFlushDone();
106 void FlushVideoRenderer(); 106 void FlushVideoRenderer();
107 void OnVideoRendererFlushDone(); 107 void OnVideoRendererFlushDone();
108 108
109 void RestartAudioRenderer(base::TimeDelta time); 109 // Restart audio/video renderer playback after a media track switch or after a
110 void RestartVideoRenderer(base::TimeDelta time); 110 // media track has been disabled and re-enabled. The |stream| parameter
111 // specifies which stream needs to be restarted. If it's the same as the most
112 // recently playing stream of that type, then the renderer is only restarted.
113 // But if it differs from the most recent stream, then the renderer is
114 // completely reinitialized, i.e. the corresponding DecoderStream is recreated
115 // and decoder is reinitialized too.
116 // The |time| parameter specifies the position on the media timeline where the
117 // playback needs to be restarted. It is necessary for demuxers with
118 // independent streams (e.g. MSE / ChunkDemuxer) to synchronize data reading
119 // between those streams.
120 void RestartAudioRenderer(DemuxerStream* stream, base::TimeDelta time);
121 void RestartVideoRenderer(DemuxerStream* stream, base::TimeDelta time);
122
123 // These callbacks are invoked when the corresponding renderer has been
124 // reinitialized. If the |status| indicates success, then playback of the
125 // |stream| should be resumed from media position specified by |time|.
126 void OnAudioRendererReinitCompleted(DemuxerStream* stream,
xhwang 2017/03/27 19:13:53 nit: OnAudioRendererReinitialized, or OnAudioRende
servolk 2017/03/27 22:34:13 Done.
127 base::TimeDelta time,
128 PipelineStatus status);
129 void OnVideoRendererReinitCompleted(DemuxerStream* stream,
130 base::TimeDelta time,
131 PipelineStatus status);
111 132
112 // Callback executed by filters to update statistics. 133 // Callback executed by filters to update statistics.
113 void OnStatisticsUpdate(const PipelineStatistics& stats); 134 void OnStatisticsUpdate(const PipelineStatistics& stats);
114 135
115 // Collection of callback methods and helpers for tracking changes in 136 // Collection of callback methods and helpers for tracking changes in
116 // buffering state and transition from paused/underflow states and playing 137 // buffering state and transition from paused/underflow states and playing
117 // states. 138 // states.
118 // 139 //
119 // While in the kPlaying state: 140 // While in the kPlaying state:
120 // - A waiting to non-waiting transition indicates preroll has completed 141 // - A waiting to non-waiting transition indicates preroll has completed
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 180
160 // Temporary callback used for Initialize() and Flush(). 181 // Temporary callback used for Initialize() and Flush().
161 PipelineStatusCB init_cb_; 182 PipelineStatusCB init_cb_;
162 base::Closure flush_cb_; 183 base::Closure flush_cb_;
163 184
164 std::unique_ptr<RendererClientInternal> audio_renderer_client_; 185 std::unique_ptr<RendererClientInternal> audio_renderer_client_;
165 std::unique_ptr<RendererClientInternal> video_renderer_client_; 186 std::unique_ptr<RendererClientInternal> video_renderer_client_;
166 std::unique_ptr<AudioRenderer> audio_renderer_; 187 std::unique_ptr<AudioRenderer> audio_renderer_;
167 std::unique_ptr<VideoRenderer> video_renderer_; 188 std::unique_ptr<VideoRenderer> video_renderer_;
168 189
190 DemuxerStream* current_audio_stream_;
191 DemuxerStream* current_video_stream_;
192
169 // Renderer-provided time source used to control playback. 193 // Renderer-provided time source used to control playback.
170 TimeSource* time_source_; 194 TimeSource* time_source_;
171 std::unique_ptr<WallClockTimeSource> wall_clock_time_source_; 195 std::unique_ptr<WallClockTimeSource> wall_clock_time_source_;
172 bool time_ticking_; 196 bool time_ticking_;
173 double playback_rate_; 197 double playback_rate_;
174 198
175 // The time to start playback from after starting/seeking has completed. 199 // The time to start playback from after starting/seeking has completed.
176 base::TimeDelta start_time_; 200 base::TimeDelta start_time_;
177 201
178 BufferingState audio_buffering_state_; 202 BufferingState audio_buffering_state_;
(...skipping 25 matching lines...) Expand all
204 228
205 base::WeakPtr<RendererImpl> weak_this_; 229 base::WeakPtr<RendererImpl> weak_this_;
206 base::WeakPtrFactory<RendererImpl> weak_factory_; 230 base::WeakPtrFactory<RendererImpl> weak_factory_;
207 231
208 DISALLOW_COPY_AND_ASSIGN(RendererImpl); 232 DISALLOW_COPY_AND_ASSIGN(RendererImpl);
209 }; 233 };
210 234
211 } // namespace media 235 } // namespace media
212 236
213 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_ 237 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698