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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 void SetVolume(double volume) override; | 56 void SetVolume(double volume) override; |
57 int GetVideoWidth() override; | 57 int GetVideoWidth() override; |
58 int GetVideoHeight() override; | 58 int GetVideoHeight() override; |
59 base::TimeDelta GetCurrentTime() override; | 59 base::TimeDelta GetCurrentTime() override; |
60 base::TimeDelta GetDuration() override; | 60 base::TimeDelta GetDuration() override; |
61 bool IsPlaying() override; | 61 bool IsPlaying() override; |
62 bool CanPause() override; | 62 bool CanPause() override; |
63 bool CanSeekForward() override; | 63 bool CanSeekForward() override; |
64 bool CanSeekBackward() override; | 64 bool CanSeekBackward() override; |
65 bool IsPlayerReady() override; | 65 bool IsPlayerReady() override; |
66 void SetCdm(BrowserCdm* cdm) override; | 66 void SetCdm(const scoped_refptr<MediaKeys>& cdm) override; |
67 | 67 |
68 // DemuxerAndroidClient implementation. | 68 // DemuxerAndroidClient implementation. |
69 void OnDemuxerConfigsAvailable(const DemuxerConfigs& params) override; | 69 void OnDemuxerConfigsAvailable(const DemuxerConfigs& params) override; |
70 void OnDemuxerDataAvailable(const DemuxerData& params) override; | 70 void OnDemuxerDataAvailable(const DemuxerData& params) override; |
71 void OnDemuxerSeekDone(base::TimeDelta actual_browser_seek_time) override; | 71 void OnDemuxerSeekDone(base::TimeDelta actual_browser_seek_time) override; |
72 void OnDemuxerDurationChanged(base::TimeDelta duration) override; | 72 void OnDemuxerDurationChanged(base::TimeDelta duration) override; |
73 | 73 |
74 private: | 74 private: |
75 friend class MediaSourcePlayerTest; | 75 friend class MediaSourcePlayerTest; |
76 | 76 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 // Track the most recent preroll target. Decoder re-creation needs this to | 239 // Track the most recent preroll target. Decoder re-creation needs this to |
240 // resume any in-progress preroll. | 240 // resume any in-progress preroll. |
241 base::TimeDelta preroll_timestamp_; | 241 base::TimeDelta preroll_timestamp_; |
242 | 242 |
243 // A cancelable task that is posted when the audio decoder starts requesting | 243 // A cancelable task that is posted when the audio decoder starts requesting |
244 // new data. This callback runs if no data arrives before the timeout period | 244 // new data. This callback runs if no data arrives before the timeout period |
245 // elapses. | 245 // elapses. |
246 base::CancelableClosure decoder_starvation_callback_; | 246 base::CancelableClosure decoder_starvation_callback_; |
247 | 247 |
| 248 // Holds a ref-count to the CDM to keep |drm_bridge_| valid. |
| 249 scoped_refptr<MediaKeys> cdm_; |
| 250 |
248 MediaDrmBridge* drm_bridge_; | 251 MediaDrmBridge* drm_bridge_; |
249 int cdm_registration_id_; | 252 int cdm_registration_id_; |
250 | 253 |
251 // No decryption key available to decrypt the encrypted buffer. In this case, | 254 // No decryption key available to decrypt the encrypted buffer. In this case, |
252 // the player should pause. When a new key is added (OnKeyAdded()), we should | 255 // the player should pause. When a new key is added (OnKeyAdded()), we should |
253 // try to start playback again. | 256 // try to start playback again. |
254 bool is_waiting_for_key_; | 257 bool is_waiting_for_key_; |
255 | 258 |
256 // Indicates the situation where new key is added during pending decode | 259 // Indicates the situation where new key is added during pending decode |
257 // (this variable can only be set when *_decoder_job_->is_decoding()). If this | 260 // (this variable can only be set when *_decoder_job_->is_decoding()). If this |
(...skipping 21 matching lines...) Expand all Loading... |
279 base::WeakPtr<MediaSourcePlayer> weak_this_; | 282 base::WeakPtr<MediaSourcePlayer> weak_this_; |
280 // NOTE: Weak pointers must be invalidated before all other member variables. | 283 // NOTE: Weak pointers must be invalidated before all other member variables. |
281 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_; | 284 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_; |
282 | 285 |
283 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); | 286 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); |
284 }; | 287 }; |
285 | 288 |
286 } // namespace media | 289 } // namespace media |
287 | 290 |
288 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ | 291 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ |
OLD | NEW |