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 <queue> | |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 15 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 16 #include "base/time/clock.h" | 17 #include "base/time/clock.h" |
| 17 #include "base/time/default_tick_clock.h" | 18 #include "base/time/default_tick_clock.h" |
| 18 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 RendererClient* client, | 54 RendererClient* client, |
| 54 const PipelineStatusCB& init_cb) final; | 55 const PipelineStatusCB& init_cb) final; |
| 55 void SetCdm(CdmContext* cdm_context, | 56 void SetCdm(CdmContext* cdm_context, |
| 56 const CdmAttachedCB& cdm_attached_cb) final; | 57 const CdmAttachedCB& cdm_attached_cb) final; |
| 57 void Flush(const base::Closure& flush_cb) final; | 58 void Flush(const base::Closure& flush_cb) final; |
| 58 void StartPlayingFrom(base::TimeDelta time) final; | 59 void StartPlayingFrom(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 | 63 |
| 63 void RestartStreamPlayback(DemuxerStream* stream, | 64 void OnStreamStatusChanged(DemuxerStream* stream, |
| 64 bool enabled, | 65 bool enabled, |
| 65 base::TimeDelta time); | 66 base::TimeDelta time); |
| 66 | 67 |
| 67 // Helper functions for testing purposes. Must be called before Initialize(). | 68 // Helper functions for testing purposes. Must be called before Initialize(). |
| 68 void DisableUnderflowForTesting(); | 69 void DisableUnderflowForTesting(); |
| 69 void EnableClocklessVideoPlaybackForTesting(); | 70 void EnableClocklessVideoPlaybackForTesting(); |
| 70 void set_time_source_for_testing(TimeSource* time_source) { | 71 void set_time_source_for_testing(TimeSource* time_source) { |
| 71 time_source_ = time_source; | 72 time_source_ = time_source; |
| 72 } | 73 } |
| 73 void set_video_underflow_threshold_for_testing(base::TimeDelta threshold) { | 74 void set_video_underflow_threshold_for_testing(base::TimeDelta threshold) { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 base::CancelableClosure deferred_video_underflow_cb_; | 190 base::CancelableClosure deferred_video_underflow_cb_; |
| 190 | 191 |
| 191 // Used to defer underflow for audio when restarting audio playback. | 192 // Used to defer underflow for audio when restarting audio playback. |
| 192 base::CancelableClosure deferred_audio_restart_underflow_cb_; | 193 base::CancelableClosure deferred_audio_restart_underflow_cb_; |
| 193 | 194 |
| 194 // The amount of time to wait before declaring underflow if the video renderer | 195 // The amount of time to wait before declaring underflow if the video renderer |
| 195 // runs out of data but the audio renderer still has enough. | 196 // runs out of data but the audio renderer still has enough. |
| 196 base::TimeDelta video_underflow_threshold_; | 197 base::TimeDelta video_underflow_threshold_; |
| 197 | 198 |
| 198 bool restarting_audio_ = false; | 199 bool restarting_audio_ = false; |
| 200 std::queue<base::Closure> postponed_audio_status_notifications_; | |
|
xhwang
2017/01/04 22:04:16
tiny nit:
- typically we use "pending" instead of
servolk
2017/01/05 02:38:45
Done.
| |
| 199 bool restarting_video_ = false; | 201 bool restarting_video_ = false; |
| 202 std::queue<base::Closure> postponed_video_status_notifications_; | |
| 200 | 203 |
| 201 base::WeakPtr<RendererImpl> weak_this_; | 204 base::WeakPtr<RendererImpl> weak_this_; |
| 202 base::WeakPtrFactory<RendererImpl> weak_factory_; | 205 base::WeakPtrFactory<RendererImpl> weak_factory_; |
| 203 | 206 |
| 204 DISALLOW_COPY_AND_ASSIGN(RendererImpl); | 207 DISALLOW_COPY_AND_ASSIGN(RendererImpl); |
| 205 }; | 208 }; |
| 206 | 209 |
| 207 } // namespace media | 210 } // namespace media |
| 208 | 211 |
| 209 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_ | 212 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_ |
| OLD | NEW |