Index: media/renderers/renderer_impl.h |
diff --git a/media/renderers/renderer_impl.h b/media/renderers/renderer_impl.h |
index ba33103386d9549868b44fb57c3ab0bfd800c859..22417857058a9332af7516eae24aa4b33191c586 100644 |
--- a/media/renderers/renderer_impl.h |
+++ b/media/renderers/renderer_impl.h |
@@ -18,6 +18,7 @@ |
#include "base/time/time.h" |
#include "media/base/buffering_state.h" |
#include "media/base/decryptor.h" |
+#include "media/base/demuxer_stream.h" |
#include "media/base/media_export.h" |
#include "media/base/pipeline_status.h" |
#include "media/base/renderer.h" |
@@ -48,12 +49,8 @@ class MEDIA_EXPORT RendererImpl : public Renderer { |
// 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; |
+ RendererClient* client, |
+ 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 +72,8 @@ class MEDIA_EXPORT RendererImpl : public Renderer { |
} |
private: |
+ class RendererClientInternal; |
+ |
enum State { |
STATE_UNINITIALIZED, |
STATE_INIT_PENDING_CDM, // Initialization is waiting for the CDM to be set. |
@@ -104,7 +103,7 @@ class MEDIA_EXPORT RendererImpl : public Renderer { |
void OnVideoRendererFlushDone(); |
// Callback executed by filters to update statistics. |
- void OnUpdateStatistics(const PipelineStatistics& stats); |
+ void OnStatisticsUpdate(const PipelineStatistics& stats); |
// Collection of callback methods and helpers for tracking changes in |
// buffering state and transition from paused/underflow states and playing |
@@ -115,20 +114,20 @@ 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(DemuxerStream::Type type, |
+ BufferingState new_buffering_state); |
bool WaitingForEnoughData() const; |
void PausePlayback(); |
void StartPlayback(); |
// Callbacks executed when a renderer has ended. |
- void OnAudioRendererEnded(); |
- void OnVideoRendererEnded(); |
+ void OnRendererEnded(DemuxerStream::Type type); |
bool PlaybackHasEnded() const; |
void RunEndedCallbackIfNeeded(); |
// Callback executed when a runtime error happens. |
void OnError(PipelineStatus error); |
+ void OnWaitingForDecryptionKey(); |
State state_; |
@@ -136,18 +135,14 @@ class MEDIA_EXPORT RendererImpl : public Renderer { |
scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
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_; |
+ RendererClient* client_; |
// Temporary callback used for Initialize() and Flush(). |
PipelineStatusCB init_cb_; |
base::Closure flush_cb_; |
+ std::unique_ptr<RendererClientInternal> audio_renderer_client_; |
+ std::unique_ptr<RendererClientInternal> video_renderer_client_; |
std::unique_ptr<AudioRenderer> audio_renderer_; |
std::unique_ptr<VideoRenderer> video_renderer_; |