Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: chromecast/browser/media/cast_renderer.h

Issue 1955843002: Move Renderer permanent callbacks into RendererClient interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chromecast/browser/media/cast_renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "base/memory/weak_ptr.h"
5 #include "chromecast/browser/media/media_pipeline_backend_factory.h" 6 #include "chromecast/browser/media/media_pipeline_backend_factory.h"
6 #include "media/base/renderer.h" 7 #include "media/base/renderer.h"
7 8
8 namespace base { 9 namespace base {
9 class SingleThreadTaskRunner; 10 class SingleThreadTaskRunner;
10 } // namespace base 11 } // namespace base
11 12
12 namespace media { 13 namespace media {
13 class MediaLog; 14 class MediaLog;
14 } // namespace media 15 } // namespace media
15 16
16 namespace chromecast { 17 namespace chromecast {
17 class TaskRunnerImpl; 18 class TaskRunnerImpl;
18 19
19 namespace media { 20 namespace media {
20 class BalancedMediaTaskRunnerFactory; 21 class BalancedMediaTaskRunnerFactory;
21 class MediaPipelineImpl; 22 class MediaPipelineImpl;
22 23
23 class CastRenderer : public ::media::Renderer { 24 class CastRenderer : public ::media::Renderer {
24 public: 25 public:
25 CastRenderer(const CreateMediaPipelineBackendCB& create_backend_cb, 26 CastRenderer(const CreateMediaPipelineBackendCB& create_backend_cb,
26 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); 27 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
27 ~CastRenderer() final; 28 ~CastRenderer() final;
28 29
29 // ::media::Renderer implementation. 30 // ::media::Renderer implementation.
30 void Initialize(::media::DemuxerStreamProvider* demuxer_stream_provider, 31 void Initialize(::media::DemuxerStreamProvider* demuxer_stream_provider,
31 const ::media::PipelineStatusCB& init_cb, 32 ::media::RendererClient* client,
32 const ::media::StatisticsCB& statistics_cb, 33 const ::media::PipelineStatusCB& init_cb) final;
33 const ::media::BufferingStateCB& buffering_state_cb,
34 const base::Closure& ended_cb,
35 const ::media::PipelineStatusCB& error_cb,
36 const base::Closure& waiting_for_decryption_key_cb) final;
37 void SetCdm(::media::CdmContext* cdm_context, 34 void SetCdm(::media::CdmContext* cdm_context,
38 const ::media::CdmAttachedCB& cdm_attached_cb) final; 35 const ::media::CdmAttachedCB& cdm_attached_cb) final;
39 void Flush(const base::Closure& flush_cb) final; 36 void Flush(const base::Closure& flush_cb) final;
40 void StartPlayingFrom(base::TimeDelta time) final; 37 void StartPlayingFrom(base::TimeDelta time) final;
41 void SetPlaybackRate(double playback_rate) final; 38 void SetPlaybackRate(double playback_rate) final;
42 void SetVolume(float volume) final; 39 void SetVolume(float volume) final;
43 base::TimeDelta GetMediaTime() final; 40 base::TimeDelta GetMediaTime() final;
44 bool HasAudio() final; 41 bool HasAudio() final;
45 bool HasVideo() final; 42 bool HasVideo() final;
46 43
47 private: 44 private:
48 enum Stream { STREAM_AUDIO, STREAM_VIDEO }; 45 enum Stream { STREAM_AUDIO, STREAM_VIDEO };
49 void OnEos(Stream stream); 46 void OnError(::media::PipelineStatus status);
47 void OnEnded(Stream stream);
48 void OnStatisticsUpdate(const ::media::PipelineStatistics& stats);
49 void OnBufferingStateChange(::media::BufferingState state);
50 void OnWaitingForDecryptionKey();
50 51
51 const CreateMediaPipelineBackendCB create_backend_cb_; 52 const CreateMediaPipelineBackendCB create_backend_cb_;
52 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 53 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
54 ::media::RendererClient* client_;
53 scoped_refptr<BalancedMediaTaskRunnerFactory> media_task_runner_factory_; 55 scoped_refptr<BalancedMediaTaskRunnerFactory> media_task_runner_factory_;
54 std::unique_ptr<TaskRunnerImpl> backend_task_runner_; 56 std::unique_ptr<TaskRunnerImpl> backend_task_runner_;
55 std::unique_ptr<MediaPipelineImpl> pipeline_; 57 std::unique_ptr<MediaPipelineImpl> pipeline_;
56 bool eos_[2]; 58 bool eos_[2];
57 base::Closure ended_cb_; 59 base::WeakPtrFactory<CastRenderer> weak_factory_;
60
58 DISALLOW_COPY_AND_ASSIGN(CastRenderer); 61 DISALLOW_COPY_AND_ASSIGN(CastRenderer);
59 }; 62 };
60 63
61 } // namespace media 64 } // namespace media
62 } // namespace chromecast 65 } // namespace chromecast
OLDNEW
« no previous file with comments | « no previous file | chromecast/browser/media/cast_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698