| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // process when this method is called. | 90 // process when this method is called. |
| 91 // 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 |
| 92 // seek. | 92 // seek. |
| 93 // TODO(wolenetz): Instead of doing browser seek, browser player should replay | 93 // TODO(wolenetz): Instead of doing browser seek, browser player should replay |
| 94 // cached data since last keyframe. See http://crbug.com/304234. | 94 // cached data since last keyframe. See http://crbug.com/304234. |
| 95 void Seek(const base::TimeDelta& seek_time, bool is_browser_seek); | 95 void Seek(const base::TimeDelta& seek_time, bool is_browser_seek); |
| 96 | 96 |
| 97 // Called when DemuxerStreamPlayer needs to read data from ChunkDemuxer. | 97 // Called when DemuxerStreamPlayer needs to read data from ChunkDemuxer. |
| 98 void OnReadFromDemuxer(media::DemuxerStream::Type type); | 98 void OnReadFromDemuxer(media::DemuxerStream::Type type); |
| 99 | 99 |
| 100 // Called when the player needs the new config data from ChunkDemuxer. | |
| 101 void OnMediaConfigRequest(); | |
| 102 | |
| 103 // Called by the Destroyer to destroy an instance of this object. | 100 // Called by the Destroyer to destroy an instance of this object. |
| 104 void Destroy(); | 101 void Destroy(); |
| 105 | 102 |
| 106 // Called on the main thread to check whether the video stream is encrypted. | 103 // Called on the main thread to check whether the video stream is encrypted. |
| 107 bool IsVideoEncrypted(); | 104 bool IsVideoEncrypted(); |
| 108 | 105 |
| 109 // Gets the ChunkDemuxer timeline offset. | 106 // Gets the ChunkDemuxer timeline offset. |
| 110 base::Time GetTimelineOffset() const; | 107 base::Time GetTimelineOffset() const; |
| 111 | 108 |
| 112 private: | 109 private: |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void OnNeedKey(const std::string& type, | 151 void OnNeedKey(const std::string& type, |
| 155 const std::vector<uint8>& init_data); | 152 const std::vector<uint8>& init_data); |
| 156 void NotifyDemuxerReady(); | 153 void NotifyDemuxerReady(); |
| 157 bool CanNotifyDemuxerReady(); | 154 bool CanNotifyDemuxerReady(); |
| 158 | 155 |
| 159 void StopDemuxer(); | 156 void StopDemuxer(); |
| 160 void InitializeDemuxer(); | 157 void InitializeDemuxer(); |
| 161 void SeekInternal(const base::TimeDelta& seek_time); | 158 void SeekInternal(const base::TimeDelta& seek_time); |
| 162 // Reads an access unit from the demuxer stream |stream| and stores it in | 159 // Reads an access unit from the demuxer stream |stream| and stores it in |
| 163 // the |index|th access unit in |params|. | 160 // the |index|th access unit in |params|. |
| 164 void ReadFromDemuxerStream(media::DemuxerStream::Type type, | 161 bool ReadFromDemuxerStream(media::DemuxerStream::Type type, |
| 165 scoped_ptr<media::DemuxerData> data, | 162 scoped_ptr<media::DemuxerData> data, |
| 166 size_t index); | 163 size_t index); |
| 167 void OnBufferReady(media::DemuxerStream::Type type, | 164 void OnBufferReady(media::DemuxerStream::Type type, |
| 168 scoped_ptr<media::DemuxerData> data, | 165 scoped_ptr<media::DemuxerData> data, |
| 169 size_t index, | 166 size_t index, |
| 170 media::DemuxerStream::Status status, | 167 media::DemuxerStream::Status status, |
| 171 const scoped_refptr<media::DecoderBuffer>& buffer); | 168 const scoped_refptr<media::DecoderBuffer>& buffer); |
| 172 | 169 |
| 173 // Helper function for calculating duration. | 170 // Helper function for calculating duration. |
| 174 base::TimeDelta GetDuration() const; | 171 base::TimeDelta GetDuration() const; |
| 175 | 172 |
| 176 bool IsSeeking() const; | 173 bool IsSeeking() const; |
| 177 | 174 |
| 178 // Returns |seek_time| if it is still buffered or if there is no currently | 175 // Returns |seek_time| if it is still buffered or if there is no currently |
| 179 // buffered range including or soon after |seek_time|. If |seek_time| is not | 176 // buffered range including or soon after |seek_time|. If |seek_time| is not |
| 180 // buffered, but there is a later range buffered near to |seek_time|, returns | 177 // buffered, but there is a later range buffered near to |seek_time|, returns |
| 181 // next buffered range's start time instead. Only call this for browser seeks. | 178 // next buffered range's start time instead. Only call this for browser seeks. |
| 182 // |seeking_lock_| must be held by caller. | 179 // |seeking_lock_| must be held by caller. |
| 183 base::TimeDelta FindBufferedBrowserSeekTime_Locked( | 180 base::TimeDelta FindBufferedBrowserSeekTime_Locked( |
| 184 const base::TimeDelta& seek_time) const; | 181 const base::TimeDelta& seek_time) const; |
| 185 | 182 |
| 183 // Get the demuxer configs for a particular stream identified by |is_audio|. |
| 184 // Returns true on success, of false otherwise. |
| 185 bool GetDemuxerConfigFromStream(media::DemuxerConfigs* configs, |
| 186 bool is_audio); |
| 187 |
| 186 RendererDemuxerAndroid* demuxer_client_; | 188 RendererDemuxerAndroid* demuxer_client_; |
| 187 int demuxer_client_id_; | 189 int demuxer_client_id_; |
| 188 | 190 |
| 189 scoped_refptr<media::MediaLog> media_log_; | 191 scoped_refptr<media::MediaLog> media_log_; |
| 190 UpdateNetworkStateCB update_network_state_cb_; | 192 UpdateNetworkStateCB update_network_state_cb_; |
| 191 DurationChangeCB duration_change_cb_; | 193 DurationChangeCB duration_change_cb_; |
| 192 | 194 |
| 193 scoped_ptr<media::ChunkDemuxer> chunk_demuxer_; | 195 scoped_ptr<media::ChunkDemuxer> chunk_demuxer_; |
| 194 bool is_demuxer_ready_; | 196 bool is_demuxer_ready_; |
| 195 | 197 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 base::WeakPtrFactory<MediaSourceDelegate> main_weak_factory_; | 242 base::WeakPtrFactory<MediaSourceDelegate> main_weak_factory_; |
| 241 base::WeakPtrFactory<MediaSourceDelegate> media_weak_factory_; | 243 base::WeakPtrFactory<MediaSourceDelegate> media_weak_factory_; |
| 242 base::WeakPtr<MediaSourceDelegate> main_weak_this_; | 244 base::WeakPtr<MediaSourceDelegate> main_weak_this_; |
| 243 | 245 |
| 244 DISALLOW_COPY_AND_ASSIGN(MediaSourceDelegate); | 246 DISALLOW_COPY_AND_ASSIGN(MediaSourceDelegate); |
| 245 }; | 247 }; |
| 246 | 248 |
| 247 } // namespace content | 249 } // namespace content |
| 248 | 250 |
| 249 #endif // CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ | 251 #endif // CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ |
| OLD | NEW |