Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 ~RendererImpl() final; | 49 ~RendererImpl() final; |
| 50 | 50 |
| 51 // Renderer implementation. | 51 // Renderer implementation. |
| 52 void Initialize(DemuxerStreamProvider* demuxer_stream_provider, | 52 void Initialize(DemuxerStreamProvider* demuxer_stream_provider, |
| 53 RendererClient* client, | 53 RendererClient* client, |
| 54 const PipelineStatusCB& init_cb) final; | 54 const PipelineStatusCB& init_cb) final; |
| 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 RestartStreamPlayback(DemuxerStream* stream, base::TimeDelta time) final; | |
| 59 void SetPlaybackRate(double playback_rate) final; | 60 void SetPlaybackRate(double playback_rate) final; |
| 60 void SetVolume(float volume) final; | 61 void SetVolume(float volume) final; |
| 61 base::TimeDelta GetMediaTime() final; | 62 base::TimeDelta GetMediaTime() final; |
| 62 bool HasAudio() final; | 63 bool HasAudio() final; |
| 63 bool HasVideo() final; | 64 bool HasVideo() final; |
| 64 | 65 |
| 65 // Helper functions for testing purposes. Must be called before Initialize(). | 66 // Helper functions for testing purposes. Must be called before Initialize(). |
| 66 void DisableUnderflowForTesting(); | 67 void DisableUnderflowForTesting(); |
| 67 void EnableClocklessVideoPlaybackForTesting(); | 68 void EnableClocklessVideoPlaybackForTesting(); |
| 68 void set_time_source_for_testing(TimeSource* time_source) { | 69 void set_time_source_for_testing(TimeSource* time_source) { |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 96 void OnAudioRendererInitializeDone(PipelineStatus status); | 97 void OnAudioRendererInitializeDone(PipelineStatus status); |
| 97 void InitializeVideoRenderer(); | 98 void InitializeVideoRenderer(); |
| 98 void OnVideoRendererInitializeDone(PipelineStatus status); | 99 void OnVideoRendererInitializeDone(PipelineStatus status); |
| 99 | 100 |
| 100 // Helper functions and callbacks for Flush(). | 101 // Helper functions and callbacks for Flush(). |
| 101 void FlushAudioRenderer(); | 102 void FlushAudioRenderer(); |
| 102 void OnAudioRendererFlushDone(); | 103 void OnAudioRendererFlushDone(); |
| 103 void FlushVideoRenderer(); | 104 void FlushVideoRenderer(); |
| 104 void OnVideoRendererFlushDone(); | 105 void OnVideoRendererFlushDone(); |
| 105 | 106 |
| 107 void OnAudioRendererFlushDone_ForRestart(base::TimeDelta time); | |
|
xhwang
2016/06/04 00:09:43
nit: We don't use underscore in function names.
| |
| 108 void OnVideoRendererFlushDone_ForRestart(base::TimeDelta time); | |
| 109 | |
| 106 // Callback executed by filters to update statistics. | 110 // Callback executed by filters to update statistics. |
| 107 void OnStatisticsUpdate(const PipelineStatistics& stats); | 111 void OnStatisticsUpdate(const PipelineStatistics& stats); |
| 108 | 112 |
| 109 // Collection of callback methods and helpers for tracking changes in | 113 // Collection of callback methods and helpers for tracking changes in |
| 110 // buffering state and transition from paused/underflow states and playing | 114 // buffering state and transition from paused/underflow states and playing |
| 111 // states. | 115 // states. |
| 112 // | 116 // |
| 113 // While in the kPlaying state: | 117 // While in the kPlaying state: |
| 114 // - A waiting to non-waiting transition indicates preroll has completed | 118 // - A waiting to non-waiting transition indicates preroll has completed |
| 115 // and StartPlayback() should be called | 119 // and StartPlayback() should be called |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 bool underflow_disabled_for_testing_; | 175 bool underflow_disabled_for_testing_; |
| 172 bool clockless_video_playback_enabled_for_testing_; | 176 bool clockless_video_playback_enabled_for_testing_; |
| 173 | 177 |
| 174 // Used to defer underflow for video when audio is present. | 178 // Used to defer underflow for video when audio is present. |
| 175 base::CancelableClosure deferred_underflow_cb_; | 179 base::CancelableClosure deferred_underflow_cb_; |
| 176 | 180 |
| 177 // The amount of time to wait before declaring underflow if the video renderer | 181 // 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. | 182 // runs out of data but the audio renderer still has enough. |
| 179 base::TimeDelta video_underflow_threshold_; | 183 base::TimeDelta video_underflow_threshold_; |
| 180 | 184 |
| 185 bool restarting_audio_ = false; | |
| 186 bool restarting_video_ = false; | |
| 187 | |
| 181 base::WeakPtr<RendererImpl> weak_this_; | 188 base::WeakPtr<RendererImpl> weak_this_; |
| 182 base::WeakPtrFactory<RendererImpl> weak_factory_; | 189 base::WeakPtrFactory<RendererImpl> weak_factory_; |
| 183 | 190 |
| 184 DISALLOW_COPY_AND_ASSIGN(RendererImpl); | 191 DISALLOW_COPY_AND_ASSIGN(RendererImpl); |
| 185 }; | 192 }; |
| 186 | 193 |
| 187 } // namespace media | 194 } // namespace media |
| 188 | 195 |
| 189 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_ | 196 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_ |
| OLD | NEW |