Chromium Code Reviews| Index: media/renderers/renderer_impl.h |
| diff --git a/media/renderers/renderer_impl.h b/media/renderers/renderer_impl.h |
| index ba33103386d9549868b44fb57c3ab0bfd800c859..c493f85ef9cdef8c24471c5d2984b91993ca027e 100644 |
| --- a/media/renderers/renderer_impl.h |
| +++ b/media/renderers/renderer_impl.h |
| @@ -47,13 +47,9 @@ class MEDIA_EXPORT RendererImpl : public Renderer { |
| ~RendererImpl() final; |
| // Renderer implementation. |
| - void Initialize(DemuxerStreamProvider* demuxer_stream_provider, |
| - const PipelineStatusCB& init_cb, |
| - const StatisticsCB& statistics_cb, |
| - const BufferingStateCB& buffering_state_cb, |
| - const base::Closure& ended_cb, |
| - const PipelineStatusCB& error_cb, |
| - const base::Closure& waiting_for_decryption_key_cb) final; |
| + void Initialize(RendererClient* client, |
| + DemuxerStreamProvider* demuxer_stream_provider, |
| + const PipelineStatusCB& init_cb) final; |
| void SetCdm(CdmContext* cdm_context, |
| const CdmAttachedCB& cdm_attached_cb) final; |
| void Flush(const base::Closure& flush_cb) final; |
| @@ -75,6 +71,8 @@ class MEDIA_EXPORT RendererImpl : public Renderer { |
| } |
| private: |
| + class AudioVideoRendererClient; |
|
xhwang
2016/05/09 18:13:23
This can only be the client for audio OR video. So
alokp
2016/05/09 21:31:44
Done.
|
| + |
| enum State { |
| STATE_UNINITIALIZED, |
| STATE_INIT_PENDING_CDM, // Initialization is waiting for the CDM to be set. |
| @@ -104,7 +102,8 @@ class MEDIA_EXPORT RendererImpl : public Renderer { |
| void OnVideoRendererFlushDone(); |
| // Callback executed by filters to update statistics. |
| - void OnUpdateStatistics(const PipelineStatistics& stats); |
| + void OnStatisticsUpdate(AudioVideoRendererClient* client, |
| + const PipelineStatistics& stats); |
| // Collection of callback methods and helpers for tracking changes in |
| // buffering state and transition from paused/underflow states and playing |
| @@ -115,39 +114,35 @@ class MEDIA_EXPORT RendererImpl : public Renderer { |
| // and StartPlayback() should be called |
| // - A non-waiting to waiting transition indicates underflow has occurred |
| // and PausePlayback() should be called |
| - void OnBufferingStateChanged(BufferingState* buffering_state, |
| - BufferingState new_buffering_state); |
| + void OnBufferingStateChange(AudioVideoRendererClient* client, |
| + BufferingState new_buffering_state); |
| bool WaitingForEnoughData() const; |
| void PausePlayback(); |
| void StartPlayback(); |
| // Callbacks executed when a renderer has ended. |
| - void OnAudioRendererEnded(); |
| - void OnVideoRendererEnded(); |
| + void OnRendererEnded(AudioVideoRendererClient* client); |
| bool PlaybackHasEnded() const; |
| void RunEndedCallbackIfNeeded(); |
| // Callback executed when a runtime error happens. |
| - void OnError(PipelineStatus error); |
| + void OnError(AudioVideoRendererClient* client, PipelineStatus error); |
| + void OnWaitingForDecryptionKey(AudioVideoRendererClient* client); |
| State state_; |
| // Task runner used to execute pipeline tasks. |
| scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| + RendererClient* client_; |
| DemuxerStreamProvider* demuxer_stream_provider_; |
| - // Permanent callbacks to notify various renderer states/stats. |
| - StatisticsCB statistics_cb_; |
| - base::Closure ended_cb_; |
| - PipelineStatusCB error_cb_; |
| - BufferingStateCB buffering_state_cb_; |
| - base::Closure waiting_for_decryption_key_cb_; |
| - |
| // Temporary callback used for Initialize() and Flush(). |
| PipelineStatusCB init_cb_; |
| base::Closure flush_cb_; |
| + std::unique_ptr<AudioVideoRendererClient> audio_renderer_client_; |
| + std::unique_ptr<AudioVideoRendererClient> video_renderer_client_; |
| std::unique_ptr<AudioRenderer> audio_renderer_; |
| std::unique_ptr<VideoRenderer> video_renderer_; |