OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ |
6 #define CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 // Initialize the MediaSourceDelegate. |media_source| will be owned by | 61 // Initialize the MediaSourceDelegate. |media_source| will be owned by |
62 // this object after this call. | 62 // this object after this call. |
63 void InitializeMediaSource( | 63 void InitializeMediaSource( |
64 const MediaSourceOpenedCB& media_source_opened_cb, | 64 const MediaSourceOpenedCB& media_source_opened_cb, |
65 const media::Demuxer::NeedKeyCB& need_key_cb, | 65 const media::Demuxer::NeedKeyCB& need_key_cb, |
66 const media::SetDecryptorReadyCB& set_decryptor_ready_cb, | 66 const media::SetDecryptorReadyCB& set_decryptor_ready_cb, |
67 const UpdateNetworkStateCB& update_network_state_cb, | 67 const UpdateNetworkStateCB& update_network_state_cb, |
68 const DurationChangeCB& duration_change_cb); | 68 const DurationChangeCB& duration_change_cb); |
69 | 69 |
70 #if defined(GOOGLE_TV) | |
71 void InitializeMediaStream( | |
72 media::Demuxer* demuxer, | |
73 const UpdateNetworkStateCB& update_network_state_cb); | |
74 #endif | |
75 | |
76 const blink::WebTimeRanges& Buffered(); | 70 const blink::WebTimeRanges& Buffered(); |
77 size_t DecodedFrameCount() const; | 71 size_t DecodedFrameCount() const; |
78 size_t DroppedFrameCount() const; | 72 size_t DroppedFrameCount() const; |
79 size_t AudioDecodedByteCount() const; | 73 size_t AudioDecodedByteCount() const; |
80 size_t VideoDecodedByteCount() const; | 74 size_t VideoDecodedByteCount() const; |
81 | 75 |
82 // In MSE case, calls ChunkDemuxer::CancelPendingSeek(). Also sets the | 76 // In MSE case, calls ChunkDemuxer::CancelPendingSeek(). Also sets the |
83 // expectation that a regular seek will be arriving and to trivially finish | 77 // expectation that a regular seek will be arriving and to trivially finish |
84 // any browser seeks that may be requested prior to the regular seek. | 78 // any browser seeks that may be requested prior to the regular seek. |
85 void CancelPendingSeek(const base::TimeDelta& seek_time); | 79 void CancelPendingSeek(const base::TimeDelta& seek_time); |
86 | 80 |
87 // In MSE case, calls ChunkDemuxer::StartWaitingForSeek(), first calling | 81 // In MSE case, calls ChunkDemuxer::StartWaitingForSeek(), first calling |
88 // ChunkDemuxer::CancelPendingSeek() if a browser seek is in progress. | 82 // ChunkDemuxer::CancelPendingSeek() if a browser seek is in progress. |
89 // Also sets the expectation that a regular seek will be arriving and to | 83 // Also sets the expectation that a regular seek will be arriving and to |
90 // trivially finish any browser seeks that may be requested prior to the | 84 // trivially finish any browser seeks that may be requested prior to the |
91 // regular seek. | 85 // regular seek. |
92 void StartWaitingForSeek(const base::TimeDelta& seek_time); | 86 void StartWaitingForSeek(const base::TimeDelta& seek_time); |
93 | 87 |
94 // Seeks the demuxer and later calls OnDemuxerSeekDone() after the seek has | 88 // Seeks the demuxer and later calls OnDemuxerSeekDone() after the seek has |
95 // been completed. There must be no other seek of the demuxer currently in | 89 // been completed. There must be no other seek of the demuxer currently in |
96 // process when this method is called. | 90 // process when this method is called. |
97 // If |is_browser_seek| is true, then this is a short-term hack browser | 91 // If |is_browser_seek| is true, then this is a short-term hack browser |
98 // seek. | 92 // seek. |
99 // TODO(wolenetz): Instead of doing browser seek, browser player should replay | 93 // TODO(wolenetz): Instead of doing browser seek, browser player should replay |
100 // cached data since last keyframe. See http://crbug.com/304234. | 94 // cached data since last keyframe. See http://crbug.com/304234. |
101 void Seek(const base::TimeDelta& seek_time, bool is_browser_seek); | 95 void Seek(const base::TimeDelta& seek_time, bool is_browser_seek); |
102 | 96 |
103 void NotifyKeyAdded(const std::string& key_system); | |
104 | |
105 // Called when DemuxerStreamPlayer needs to read data from ChunkDemuxer. | 97 // Called when DemuxerStreamPlayer needs to read data from ChunkDemuxer. |
106 void OnReadFromDemuxer(media::DemuxerStream::Type type); | 98 void OnReadFromDemuxer(media::DemuxerStream::Type type); |
107 | 99 |
108 // Called when the player needs the new config data from ChunkDemuxer. | 100 // Called when the player needs the new config data from ChunkDemuxer. |
109 void OnMediaConfigRequest(); | 101 void OnMediaConfigRequest(); |
110 | 102 |
111 // Called by the Destroyer to destroy an instance of this object. | 103 // Called by the Destroyer to destroy an instance of this object. |
112 void Destroy(); | 104 void Destroy(); |
113 | 105 |
114 private: | 106 private: |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 media::DemuxerStream* video_stream_; | 215 media::DemuxerStream* video_stream_; |
224 | 216 |
225 media::PipelineStatistics statistics_; | 217 media::PipelineStatistics statistics_; |
226 media::Ranges<base::TimeDelta> buffered_time_ranges_; | 218 media::Ranges<base::TimeDelta> buffered_time_ranges_; |
227 // Keep a list of buffered time ranges. | 219 // Keep a list of buffered time ranges. |
228 blink::WebTimeRanges buffered_web_time_ranges_; | 220 blink::WebTimeRanges buffered_web_time_ranges_; |
229 | 221 |
230 MediaSourceOpenedCB media_source_opened_cb_; | 222 MediaSourceOpenedCB media_source_opened_cb_; |
231 media::Demuxer::NeedKeyCB need_key_cb_; | 223 media::Demuxer::NeedKeyCB need_key_cb_; |
232 | 224 |
233 // The currently selected key system. Empty string means that no key system | |
234 // has been selected. | |
235 blink::WebString current_key_system_; | |
236 | |
237 // Temporary for EME v0.1. In the future the init data type should be passed | 225 // Temporary for EME v0.1. In the future the init data type should be passed |
238 // through GenerateKeyRequest() directly from WebKit. | 226 // through GenerateKeyRequest() directly from WebKit. |
239 std::string init_data_type_; | 227 std::string init_data_type_; |
240 | 228 |
241 // Lock used to serialize access for |seeking_|. | 229 // Lock used to serialize access for |seeking_|. |
242 mutable base::Lock seeking_lock_; | 230 mutable base::Lock seeking_lock_; |
243 bool seeking_; | 231 bool seeking_; |
244 | 232 |
245 // Track if we are currently performing a browser seek, and track whether or | 233 // Track if we are currently performing a browser seek, and track whether or |
246 // not a regular seek is expected soon. If a regular seek is expected soon, | 234 // not a regular seek is expected soon. If a regular seek is expected soon, |
247 // then any in-progress browser seek will be canceled pending the | 235 // then any in-progress browser seek will be canceled pending the |
248 // regular seek, if using |chunk_demuxer_|, and any requested browser seek | 236 // regular seek, if using |chunk_demuxer_|, and any requested browser seek |
249 // will be trivially finished. Access is serialized by |seeking_lock_|. | 237 // will be trivially finished. Access is serialized by |seeking_lock_|. |
250 bool doing_browser_seek_; | 238 bool doing_browser_seek_; |
251 base::TimeDelta browser_seek_time_; | 239 base::TimeDelta browser_seek_time_; |
252 bool expecting_regular_seek_; | 240 bool expecting_regular_seek_; |
253 | 241 |
254 #if defined(GOOGLE_TV) | |
255 bool key_added_; | |
256 std::string key_system_; | |
257 #endif // defined(GOOGLE_TV) | |
258 | |
259 size_t access_unit_size_; | 242 size_t access_unit_size_; |
260 | 243 |
261 DISALLOW_COPY_AND_ASSIGN(MediaSourceDelegate); | 244 DISALLOW_COPY_AND_ASSIGN(MediaSourceDelegate); |
262 }; | 245 }; |
263 | 246 |
264 } // namespace content | 247 } // namespace content |
265 | 248 |
266 #endif // CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ | 249 #endif // CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ |
OLD | NEW |