| 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 |
| 11 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "base/time/clock.h" | 16 #include "base/time/clock.h" |
| 17 #include "base/time/default_tick_clock.h" | 17 #include "base/time/default_tick_clock.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "media/base/buffering_state.h" | 19 #include "media/base/buffering_state.h" |
| 20 #include "media/base/decryptor.h" | 20 #include "media/base/decryptor.h" |
| 21 #include "media/base/demuxer_stream.h" | 21 #include "media/base/demuxer_stream.h" |
| 22 #include "media/base/media_export.h" | 22 #include "media/base/media_export.h" |
| 23 #include "media/base/pipeline_status.h" | 23 #include "media/base/pipeline_status.h" |
| 24 #include "media/base/renderer.h" | 24 #include "media/base/renderer.h" |
| 25 #include "media/base/stream_position.h" |
| 25 #include "ui/gfx/geometry/size.h" | 26 #include "ui/gfx/geometry/size.h" |
| 26 | 27 |
| 27 namespace base { | 28 namespace base { |
| 28 class SingleThreadTaskRunner; | 29 class SingleThreadTaskRunner; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace media { | 32 namespace media { |
| 32 | 33 |
| 33 class AudioRenderer; | 34 class AudioRenderer; |
| 34 class DemuxerStreamProvider; | 35 class DemuxerStreamProvider; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 48 | 49 |
| 49 ~RendererImpl() final; | 50 ~RendererImpl() final; |
| 50 | 51 |
| 51 // Renderer implementation. | 52 // Renderer implementation. |
| 52 void Initialize(DemuxerStreamProvider* demuxer_stream_provider, | 53 void Initialize(DemuxerStreamProvider* demuxer_stream_provider, |
| 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(StreamPosition position) 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 void RestartStreamPlayback(DemuxerStream* stream, | 66 void RestartStreamPlayback(DemuxerStream* stream, |
| 66 bool enabled, | 67 bool enabled, |
| 67 base::TimeDelta time); | 68 base::TimeDelta time); |
| 68 | 69 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 void OnAudioRendererFlushDone(); | 107 void OnAudioRendererFlushDone(); |
| 107 void FlushVideoRenderer(); | 108 void FlushVideoRenderer(); |
| 108 void OnVideoRendererFlushDone(); | 109 void OnVideoRendererFlushDone(); |
| 109 | 110 |
| 110 void RestartAudioRenderer(base::TimeDelta time); | 111 void RestartAudioRenderer(base::TimeDelta time); |
| 111 void RestartVideoRenderer(base::TimeDelta time); | 112 void RestartVideoRenderer(base::TimeDelta time); |
| 112 | 113 |
| 113 // Callback executed by filters to update statistics. | 114 // Callback executed by filters to update statistics. |
| 114 void OnStatisticsUpdate(const PipelineStatistics& stats); | 115 void OnStatisticsUpdate(const PipelineStatistics& stats); |
| 115 | 116 |
| 117 void OnFirstVideoFrameTimestampKnown(base::TimeDelta timestamp); |
| 118 |
| 116 // Collection of callback methods and helpers for tracking changes in | 119 // Collection of callback methods and helpers for tracking changes in |
| 117 // buffering state and transition from paused/underflow states and playing | 120 // buffering state and transition from paused/underflow states and playing |
| 118 // states. | 121 // states. |
| 119 // | 122 // |
| 120 // While in the kPlaying state: | 123 // While in the kPlaying state: |
| 121 // - A waiting to non-waiting transition indicates preroll has completed | 124 // - A waiting to non-waiting transition indicates preroll has completed |
| 122 // and StartPlayback() should be called | 125 // and StartPlayback() should be called |
| 123 // - A non-waiting to waiting transition indicates underflow has occurred | 126 // - A non-waiting to waiting transition indicates underflow has occurred |
| 124 // and PausePlayback() should be called | 127 // and PausePlayback() should be called |
| 125 void OnBufferingStateChange(DemuxerStream::Type type, | 128 void OnBufferingStateChange(DemuxerStream::Type type, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 205 |
| 203 base::WeakPtr<RendererImpl> weak_this_; | 206 base::WeakPtr<RendererImpl> weak_this_; |
| 204 base::WeakPtrFactory<RendererImpl> weak_factory_; | 207 base::WeakPtrFactory<RendererImpl> weak_factory_; |
| 205 | 208 |
| 206 DISALLOW_COPY_AND_ASSIGN(RendererImpl); | 209 DISALLOW_COPY_AND_ASSIGN(RendererImpl); |
| 207 }; | 210 }; |
| 208 | 211 |
| 209 } // namespace media | 212 } // namespace media |
| 210 | 213 |
| 211 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_ | 214 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_ |
| OLD | NEW |