OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 virtual int GetVideoWidth() OVERRIDE; | 51 virtual int GetVideoWidth() OVERRIDE; |
52 virtual int GetVideoHeight() OVERRIDE; | 52 virtual int GetVideoHeight() OVERRIDE; |
53 virtual base::TimeDelta GetCurrentTime() OVERRIDE; | 53 virtual base::TimeDelta GetCurrentTime() OVERRIDE; |
54 virtual base::TimeDelta GetDuration() OVERRIDE; | 54 virtual base::TimeDelta GetDuration() OVERRIDE; |
55 virtual bool IsPlaying() OVERRIDE; | 55 virtual bool IsPlaying() OVERRIDE; |
56 virtual bool CanPause() OVERRIDE; | 56 virtual bool CanPause() OVERRIDE; |
57 virtual bool CanSeekForward() OVERRIDE; | 57 virtual bool CanSeekForward() OVERRIDE; |
58 virtual bool CanSeekBackward() OVERRIDE; | 58 virtual bool CanSeekBackward() OVERRIDE; |
59 virtual bool IsPlayerReady() OVERRIDE; | 59 virtual bool IsPlayerReady() OVERRIDE; |
60 virtual void OnSeekRequestAck(unsigned seek_request_id) OVERRIDE; | 60 virtual void OnSeekRequestAck(unsigned seek_request_id) OVERRIDE; |
61 virtual void DemuxerReady( | 61 virtual void DemuxerReady(const MediaConfigs& configs) OVERRIDE; |
62 const MediaPlayerHostMsg_DemuxerReady_Params& params) OVERRIDE; | 62 virtual void ReadFromDemuxerAck(const MediaData& data) OVERRIDE; |
63 virtual void ReadFromDemuxerAck( | |
64 const MediaPlayerHostMsg_ReadFromDemuxerAck_Params& params) OVERRIDE; | |
65 virtual void DurationChanged(const base::TimeDelta& duration) OVERRIDE; | 63 virtual void DurationChanged(const base::TimeDelta& duration) OVERRIDE; |
66 virtual void SetDrmBridge(MediaDrmBridge* drm_bridge) OVERRIDE; | 64 virtual void SetDrmBridge(MediaDrmBridge* drm_bridge) OVERRIDE; |
67 | 65 |
68 private: | 66 private: |
69 // Update the current timestamp. | 67 // Update the current timestamp. |
70 void UpdateTimestamps(const base::TimeDelta& presentation_timestamp, | 68 void UpdateTimestamps(const base::TimeDelta& presentation_timestamp, |
71 size_t audio_output_bytes); | 69 size_t audio_output_bytes); |
72 | 70 |
73 // Helper function for starting media playback. | 71 // Helper function for starting media playback. |
74 void StartInternal(); | 72 void StartInternal(); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 bool reconfig_audio_decoder_; | 183 bool reconfig_audio_decoder_; |
186 bool reconfig_video_decoder_; | 184 bool reconfig_video_decoder_; |
187 | 185 |
188 // These variables keep track of the current decoding data. | 186 // These variables keep track of the current decoding data. |
189 // TODO(qinmin): remove these variables when we no longer relies on IPC for | 187 // TODO(qinmin): remove these variables when we no longer relies on IPC for |
190 // data passing. | 188 // data passing. |
191 size_t audio_access_unit_index_; | 189 size_t audio_access_unit_index_; |
192 size_t video_access_unit_index_; | 190 size_t video_access_unit_index_; |
193 bool waiting_for_audio_data_; | 191 bool waiting_for_audio_data_; |
194 bool waiting_for_video_data_; | 192 bool waiting_for_video_data_; |
195 MediaPlayerHostMsg_ReadFromDemuxerAck_Params received_audio_; | 193 MediaData received_audio_; |
196 MediaPlayerHostMsg_ReadFromDemuxerAck_Params received_video_; | 194 MediaData received_video_; |
197 | 195 |
198 // A cancelable task that is posted when the audio decoder starts requesting | 196 // A cancelable task that is posted when the audio decoder starts requesting |
199 // new data. This callback runs if no data arrives before the timeout period | 197 // new data. This callback runs if no data arrives before the timeout period |
200 // elapses. | 198 // elapses. |
201 base::CancelableClosure decoder_starvation_callback_; | 199 base::CancelableClosure decoder_starvation_callback_; |
202 | 200 |
203 // Whether the audio and video decoder jobs should resync with each other. | 201 // Whether the audio and video decoder jobs should resync with each other. |
204 bool sync_decoder_jobs_; | 202 bool sync_decoder_jobs_; |
205 | 203 |
206 // Object to calculate the current audio timestamp for A/V sync. | 204 // Object to calculate the current audio timestamp for A/V sync. |
207 scoped_ptr<AudioTimestampHelper> audio_timestamp_helper_; | 205 scoped_ptr<AudioTimestampHelper> audio_timestamp_helper_; |
208 | 206 |
209 // Weak pointer passed to media decoder jobs for callbacks. | 207 // Weak pointer passed to media decoder jobs for callbacks. |
210 base::WeakPtrFactory<MediaSourcePlayer> weak_this_; | 208 base::WeakPtrFactory<MediaSourcePlayer> weak_this_; |
211 | 209 |
212 MediaDrmBridge* drm_bridge_; | 210 MediaDrmBridge* drm_bridge_; |
213 | 211 |
214 friend class MediaSourcePlayerTest; | 212 friend class MediaSourcePlayerTest; |
215 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); | 213 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); |
216 }; | 214 }; |
217 | 215 |
218 } // namespace media | 216 } // namespace media |
219 | 217 |
220 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ | 218 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ |
OLD | NEW |