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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.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 "chromecast/media/cma/pipeline/load_type.h" | 17 #include "chromecast/media/cma/pipeline/load_type.h" |
17 #include "chromecast/media/cma/pipeline/media_pipeline_client.h" | 18 #include "chromecast/media/cma/pipeline/media_pipeline_client.h" |
18 #include "chromecast/public/media/media_pipeline_backend.h" | 19 #include "chromecast/public/media/media_pipeline_backend.h" |
19 | 20 |
20 namespace media { | 21 namespace media { |
21 class AudioDecoderConfig; | 22 class AudioDecoderConfig; |
22 class VideoDecoderConfig; | 23 class VideoDecoderConfig; |
23 } // namespace media | 24 } // namespace media |
24 | 25 |
25 namespace chromecast { | 26 namespace chromecast { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 struct FlushTask; | 76 struct FlushTask; |
76 void OnFlushDone(bool is_audio_stream); | 77 void OnFlushDone(bool is_audio_stream); |
77 | 78 |
78 // Invoked to notify about a change of buffering state. | 79 // Invoked to notify about a change of buffering state. |
79 void OnBufferingNotification(bool is_buffering); | 80 void OnBufferingNotification(bool is_buffering); |
80 | 81 |
81 void UpdateMediaTime(); | 82 void UpdateMediaTime(); |
82 | 83 |
83 void OnError(::media::PipelineStatus error); | 84 void OnError(::media::PipelineStatus error); |
84 | 85 |
86 void ResetBitrateState(); | |
87 | |
85 base::ThreadChecker thread_checker_; | 88 base::ThreadChecker thread_checker_; |
86 MediaPipelineClient client_; | 89 MediaPipelineClient client_; |
87 scoped_ptr<BufferingController> buffering_controller_; | 90 scoped_ptr<BufferingController> buffering_controller_; |
88 BrowserCdmCast* cdm_; | 91 BrowserCdmCast* cdm_; |
89 | 92 |
90 // Interface with the underlying hardware media pipeline. | 93 // Interface with the underlying hardware media pipeline. |
91 BackendState backend_state_; | 94 BackendState backend_state_; |
92 // Playback rate set by the upper layer. | 95 // Playback rate set by the upper layer. |
93 // Cached here because CMA pipeline backend does not support rate == 0, | 96 // Cached here because CMA pipeline backend does not support rate == 0, |
94 // which is emulated by pausing the backend. | 97 // which is emulated by pausing the backend. |
95 float playback_rate_; | 98 float playback_rate_; |
96 scoped_ptr<MediaPipelineBackend> media_pipeline_backend_; | 99 scoped_ptr<MediaPipelineBackend> media_pipeline_backend_; |
97 scoped_ptr<AudioDecoderSoftwareWrapper> audio_decoder_; | 100 scoped_ptr<AudioDecoderSoftwareWrapper> audio_decoder_; |
98 MediaPipelineBackend::VideoDecoder* video_decoder_; | 101 MediaPipelineBackend::VideoDecoder* video_decoder_; |
99 | 102 |
100 scoped_ptr<AudioPipelineImpl> audio_pipeline_; | 103 scoped_ptr<AudioPipelineImpl> audio_pipeline_; |
101 scoped_ptr<VideoPipelineImpl> video_pipeline_; | 104 scoped_ptr<VideoPipelineImpl> video_pipeline_; |
102 scoped_ptr<FlushTask> pending_flush_task_; | 105 scoped_ptr<FlushTask> pending_flush_task_; |
103 | 106 |
104 // The media time is retrieved at regular intervals. | 107 // The media time is retrieved at regular intervals. |
105 bool pending_time_update_task_; | 108 bool pending_time_update_task_; |
106 base::TimeDelta last_media_time_; | 109 base::TimeDelta last_media_time_; |
107 | 110 |
108 // 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 |
109 // period. | 112 // period. |
110 int statistics_rolling_counter_; | 113 int statistics_rolling_counter_; |
114 base::Time last_sample_time_; | |
kmackay
2016/03/11 17:47:40
I recommend using base::TimeTicks
ejason
2016/03/11 20:18:08
Done.
| |
115 base::TimeDelta elapsed_time_delta_; | |
116 int audio_bytes_for_bitrate_estimation_; | |
117 int video_bytes_for_bitrate_estimation_; | |
111 | 118 |
112 base::WeakPtr<MediaPipelineImpl> weak_this_; | 119 base::WeakPtr<MediaPipelineImpl> weak_this_; |
113 base::WeakPtrFactory<MediaPipelineImpl> weak_factory_; | 120 base::WeakPtrFactory<MediaPipelineImpl> weak_factory_; |
114 | 121 |
115 DISALLOW_COPY_AND_ASSIGN(MediaPipelineImpl); | 122 DISALLOW_COPY_AND_ASSIGN(MediaPipelineImpl); |
116 }; | 123 }; |
117 | 124 |
118 } // namespace media | 125 } // namespace media |
119 } // namespace chromecast | 126 } // namespace chromecast |
120 | 127 |
121 #endif // CHROMECAST_MEDIA_CMA_PIPELINE_MEDIA_PIPELINE_IMPL_H_ | 128 #endif // CHROMECAST_MEDIA_CMA_PIPELINE_MEDIA_PIPELINE_IMPL_H_ |
OLD | NEW |