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 CHROMECAST_MEDIA_CMA_PIPELINE_MEDIA_PIPELINE_IMPL_H_ | 5 #ifndef CHROMECAST_MEDIA_CMA_PIPELINE_MEDIA_PIPELINE_IMPL_H_ |
6 #define CHROMECAST_MEDIA_CMA_PIPELINE_MEDIA_PIPELINE_IMPL_H_ | 6 #define CHROMECAST_MEDIA_CMA_PIPELINE_MEDIA_PIPELINE_IMPL_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "chromecast/media/cma/pipeline/load_type.h" | 17 #include "chromecast/media/cma/pipeline/load_type.h" |
18 #include "chromecast/media/cma/pipeline/media_pipeline_client.h" | 18 #include "chromecast/media/cma/pipeline/media_pipeline_client.h" |
19 #include "chromecast/public/media/media_pipeline_backend.h" | 19 #include "chromecast/public/media/media_pipeline_backend.h" |
20 | 20 |
21 namespace media { | 21 namespace media { |
22 class AudioDecoderConfig; | 22 class AudioDecoderConfig; |
23 class VideoDecoderConfig; | 23 class VideoDecoderConfig; |
(...skipping 11 matching lines...) Expand all Loading... |
35 struct VideoPipelineClient; | 35 struct VideoPipelineClient; |
36 | 36 |
37 class MediaPipelineImpl { | 37 class MediaPipelineImpl { |
38 public: | 38 public: |
39 MediaPipelineImpl(); | 39 MediaPipelineImpl(); |
40 ~MediaPipelineImpl(); | 40 ~MediaPipelineImpl(); |
41 | 41 |
42 // Initialize the media pipeline: the pipeline is configured based on | 42 // Initialize the media pipeline: the pipeline is configured based on |
43 // |load_type|. | 43 // |load_type|. |
44 void Initialize(LoadType load_type, | 44 void Initialize(LoadType load_type, |
45 scoped_ptr<MediaPipelineBackend> media_pipeline_backend); | 45 std::unique_ptr<MediaPipelineBackend> media_pipeline_backend); |
46 | 46 |
47 void SetClient(const MediaPipelineClient& client); | 47 void SetClient(const MediaPipelineClient& client); |
48 void SetCdm(int cdm_id); | 48 void SetCdm(int cdm_id); |
49 | 49 |
50 ::media::PipelineStatus InitializeAudio( | 50 ::media::PipelineStatus InitializeAudio( |
51 const ::media::AudioDecoderConfig& config, | 51 const ::media::AudioDecoderConfig& config, |
52 const AvPipelineClient& client, | 52 const AvPipelineClient& client, |
53 scoped_ptr<CodedFrameProvider> frame_provider); | 53 std::unique_ptr<CodedFrameProvider> frame_provider); |
54 ::media::PipelineStatus InitializeVideo( | 54 ::media::PipelineStatus InitializeVideo( |
55 const std::vector<::media::VideoDecoderConfig>& configs, | 55 const std::vector<::media::VideoDecoderConfig>& configs, |
56 const VideoPipelineClient& client, | 56 const VideoPipelineClient& client, |
57 scoped_ptr<CodedFrameProvider> frame_provider); | 57 std::unique_ptr<CodedFrameProvider> frame_provider); |
58 void StartPlayingFrom(base::TimeDelta time); | 58 void StartPlayingFrom(base::TimeDelta time); |
59 void Flush(const base::Closure& flush_cb); | 59 void Flush(const base::Closure& flush_cb); |
60 void Stop(); | 60 void Stop(); |
61 void SetPlaybackRate(double playback_rate); | 61 void SetPlaybackRate(double playback_rate); |
62 void SetVolume(float volume); | 62 void SetVolume(float volume); |
63 base::TimeDelta GetMediaTime() const; | 63 base::TimeDelta GetMediaTime() const; |
64 bool HasAudio() const; | 64 bool HasAudio() const; |
65 bool HasVideo() const; | 65 bool HasVideo() const; |
66 | 66 |
67 void SetCdm(BrowserCdmCast* cdm); | 67 void SetCdm(BrowserCdmCast* cdm); |
(...skipping 12 matching lines...) Expand all Loading... |
80 void OnBufferingNotification(bool is_buffering); | 80 void OnBufferingNotification(bool is_buffering); |
81 | 81 |
82 void UpdateMediaTime(); | 82 void UpdateMediaTime(); |
83 | 83 |
84 void OnError(::media::PipelineStatus error); | 84 void OnError(::media::PipelineStatus error); |
85 | 85 |
86 void ResetBitrateState(); | 86 void ResetBitrateState(); |
87 | 87 |
88 base::ThreadChecker thread_checker_; | 88 base::ThreadChecker thread_checker_; |
89 MediaPipelineClient client_; | 89 MediaPipelineClient client_; |
90 scoped_ptr<BufferingController> buffering_controller_; | 90 std::unique_ptr<BufferingController> buffering_controller_; |
91 BrowserCdmCast* cdm_; | 91 BrowserCdmCast* cdm_; |
92 | 92 |
93 // Interface with the underlying hardware media pipeline. | 93 // Interface with the underlying hardware media pipeline. |
94 BackendState backend_state_; | 94 BackendState backend_state_; |
95 // Playback rate set by the upper layer. | 95 // Playback rate set by the upper layer. |
96 // Cached here because CMA pipeline backend does not support rate == 0, | 96 // Cached here because CMA pipeline backend does not support rate == 0, |
97 // which is emulated by pausing the backend. | 97 // which is emulated by pausing the backend. |
98 float playback_rate_; | 98 float playback_rate_; |
99 scoped_ptr<MediaPipelineBackend> media_pipeline_backend_; | 99 std::unique_ptr<MediaPipelineBackend> media_pipeline_backend_; |
100 scoped_ptr<AudioDecoderSoftwareWrapper> audio_decoder_; | 100 std::unique_ptr<AudioDecoderSoftwareWrapper> audio_decoder_; |
101 MediaPipelineBackend::VideoDecoder* video_decoder_; | 101 MediaPipelineBackend::VideoDecoder* video_decoder_; |
102 | 102 |
103 scoped_ptr<AudioPipelineImpl> audio_pipeline_; | 103 std::unique_ptr<AudioPipelineImpl> audio_pipeline_; |
104 scoped_ptr<VideoPipelineImpl> video_pipeline_; | 104 std::unique_ptr<VideoPipelineImpl> video_pipeline_; |
105 scoped_ptr<FlushTask> pending_flush_task_; | 105 std::unique_ptr<FlushTask> pending_flush_task_; |
106 | 106 |
107 // The media time is retrieved at regular intervals. | 107 // The media time is retrieved at regular intervals. |
108 bool pending_time_update_task_; | 108 bool pending_time_update_task_; |
109 base::TimeDelta last_media_time_; | 109 base::TimeDelta last_media_time_; |
110 | 110 |
111 // Used to make the statistics update period a multiplier of the time update | 111 // Used to make the statistics update period a multiplier of the time update |
112 // period. | 112 // period. |
113 int statistics_rolling_counter_; | 113 int statistics_rolling_counter_; |
114 base::TimeTicks last_sample_time_; | 114 base::TimeTicks last_sample_time_; |
115 base::TimeDelta elapsed_time_delta_; | 115 base::TimeDelta elapsed_time_delta_; |
116 int audio_bytes_for_bitrate_estimation_; | 116 int audio_bytes_for_bitrate_estimation_; |
117 int video_bytes_for_bitrate_estimation_; | 117 int video_bytes_for_bitrate_estimation_; |
118 | 118 |
119 base::WeakPtr<MediaPipelineImpl> weak_this_; | 119 base::WeakPtr<MediaPipelineImpl> weak_this_; |
120 base::WeakPtrFactory<MediaPipelineImpl> weak_factory_; | 120 base::WeakPtrFactory<MediaPipelineImpl> weak_factory_; |
121 | 121 |
122 DISALLOW_COPY_AND_ASSIGN(MediaPipelineImpl); | 122 DISALLOW_COPY_AND_ASSIGN(MediaPipelineImpl); |
123 }; | 123 }; |
124 | 124 |
125 } // namespace media | 125 } // namespace media |
126 } // namespace chromecast | 126 } // namespace chromecast |
127 | 127 |
128 #endif // CHROMECAST_MEDIA_CMA_PIPELINE_MEDIA_PIPELINE_IMPL_H_ | 128 #endif // CHROMECAST_MEDIA_CMA_PIPELINE_MEDIA_PIPELINE_IMPL_H_ |
OLD | NEW |