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

Side by Side Diff: media/renderers/renderer_impl.h

Issue 1935873002: Implement disabling and enabling media tracks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track-control2
Patch Set: Added tests to verify no rendering happens for disabled tracks Created 4 years, 5 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 <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 void SetCdm(CdmContext* cdm_context, 55 void SetCdm(CdmContext* cdm_context,
56 const CdmAttachedCB& cdm_attached_cb) final; 56 const CdmAttachedCB& cdm_attached_cb) final;
57 void Flush(const base::Closure& flush_cb) final; 57 void Flush(const base::Closure& flush_cb) final;
58 void StartPlayingFrom(base::TimeDelta time) final; 58 void StartPlayingFrom(base::TimeDelta time) final;
59 void SetPlaybackRate(double playback_rate) final; 59 void SetPlaybackRate(double playback_rate) final;
60 void SetVolume(float volume) final; 60 void SetVolume(float volume) final;
61 base::TimeDelta GetMediaTime() final; 61 base::TimeDelta GetMediaTime() final;
62 bool HasAudio() final; 62 bool HasAudio() final;
63 bool HasVideo() final; 63 bool HasVideo() final;
64 64
65 void RestartStreamPlayback(DemuxerStream* stream, base::TimeDelta time);
66
65 // Helper functions for testing purposes. Must be called before Initialize(). 67 // Helper functions for testing purposes. Must be called before Initialize().
66 void DisableUnderflowForTesting(); 68 void DisableUnderflowForTesting();
67 void EnableClocklessVideoPlaybackForTesting(); 69 void EnableClocklessVideoPlaybackForTesting();
68 void set_time_source_for_testing(TimeSource* time_source) { 70 void set_time_source_for_testing(TimeSource* time_source) {
69 time_source_ = time_source; 71 time_source_ = time_source;
70 } 72 }
71 void set_video_underflow_threshold_for_testing(base::TimeDelta threshold) { 73 void set_video_underflow_threshold_for_testing(base::TimeDelta threshold) {
72 video_underflow_threshold_ = threshold; 74 video_underflow_threshold_ = threshold;
73 } 75 }
74 76
(...skipping 21 matching lines...) Expand all
96 void OnAudioRendererInitializeDone(PipelineStatus status); 98 void OnAudioRendererInitializeDone(PipelineStatus status);
97 void InitializeVideoRenderer(); 99 void InitializeVideoRenderer();
98 void OnVideoRendererInitializeDone(PipelineStatus status); 100 void OnVideoRendererInitializeDone(PipelineStatus status);
99 101
100 // Helper functions and callbacks for Flush(). 102 // Helper functions and callbacks for Flush().
101 void FlushAudioRenderer(); 103 void FlushAudioRenderer();
102 void OnAudioRendererFlushDone(); 104 void OnAudioRendererFlushDone();
103 void FlushVideoRenderer(); 105 void FlushVideoRenderer();
104 void OnVideoRendererFlushDone(); 106 void OnVideoRendererFlushDone();
105 107
108 void RestartAudioRenderer(base::TimeDelta time);
109 void RestartVideoRenderer(base::TimeDelta time);
110
106 // Callback executed by filters to update statistics. 111 // Callback executed by filters to update statistics.
107 void OnStatisticsUpdate(const PipelineStatistics& stats); 112 void OnStatisticsUpdate(const PipelineStatistics& stats);
108 113
109 // Collection of callback methods and helpers for tracking changes in 114 // Collection of callback methods and helpers for tracking changes in
110 // buffering state and transition from paused/underflow states and playing 115 // buffering state and transition from paused/underflow states and playing
111 // states. 116 // states.
112 // 117 //
113 // While in the kPlaying state: 118 // While in the kPlaying state:
114 // - A waiting to non-waiting transition indicates preroll has completed 119 // - A waiting to non-waiting transition indicates preroll has completed
115 // and StartPlayback() should be called 120 // and StartPlayback() should be called
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 172
168 CdmContext* cdm_context_; 173 CdmContext* cdm_context_;
169 CdmAttachedCB pending_cdm_attached_cb_; 174 CdmAttachedCB pending_cdm_attached_cb_;
170 175
171 bool underflow_disabled_for_testing_; 176 bool underflow_disabled_for_testing_;
172 bool clockless_video_playback_enabled_for_testing_; 177 bool clockless_video_playback_enabled_for_testing_;
173 178
174 // Used to defer underflow for video when audio is present. 179 // Used to defer underflow for video when audio is present.
175 base::CancelableClosure deferred_underflow_cb_; 180 base::CancelableClosure deferred_underflow_cb_;
176 181
182 // Used to defer underflow for audio when restarting audio playback.
183 base::CancelableClosure deferred_audio_restart_underflow_cb_;
184
177 // The amount of time to wait before declaring underflow if the video renderer 185 // The amount of time to wait before declaring underflow if the video renderer
178 // runs out of data but the audio renderer still has enough. 186 // runs out of data but the audio renderer still has enough.
179 base::TimeDelta video_underflow_threshold_; 187 base::TimeDelta video_underflow_threshold_;
180 188
189 bool restarting_audio_ = false;
190 bool restarting_video_ = false;
191
181 base::WeakPtr<RendererImpl> weak_this_; 192 base::WeakPtr<RendererImpl> weak_this_;
182 base::WeakPtrFactory<RendererImpl> weak_factory_; 193 base::WeakPtrFactory<RendererImpl> weak_factory_;
183 194
184 DISALLOW_COPY_AND_ASSIGN(RendererImpl); 195 DISALLOW_COPY_AND_ASSIGN(RendererImpl);
185 }; 196 };
186 197
187 } // namespace media 198 } // namespace media
188 199
189 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_ 200 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698