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 MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // Parameter order is reversed for easy binding. | 227 // Parameter order is reversed for easy binding. |
228 void SetCdm(const CdmAttachedCB& cdm_attached_cb, CdmContext* cdm_context); | 228 void SetCdm(const CdmAttachedCB& cdm_attached_cb, CdmContext* cdm_context); |
229 | 229 |
230 // Called when a CDM has been attached to the |pipeline_|. | 230 // Called when a CDM has been attached to the |pipeline_|. |
231 void OnCdmAttached(bool success); | 231 void OnCdmAttached(bool success); |
232 | 232 |
233 // Updates |paused_time_| to the current media time with consideration for the | 233 // Updates |paused_time_| to the current media time with consideration for the |
234 // |ended_| state by clamping current time to duration upon |ended_|. | 234 // |ended_| state by clamping current time to duration upon |ended_|. |
235 void UpdatePausedTime(); | 235 void UpdatePausedTime(); |
236 | 236 |
| 237 // Called at low frequency to tell external observers how much memory we're |
| 238 // using for video playback. Called by |memory_usage_reporting_timer_|. |
| 239 void ReportMemoryUsage(); |
| 240 |
237 blink::WebLocalFrame* frame_; | 241 blink::WebLocalFrame* frame_; |
238 | 242 |
239 // TODO(hclam): get rid of these members and read from the pipeline directly. | 243 // TODO(hclam): get rid of these members and read from the pipeline directly. |
240 blink::WebMediaPlayer::NetworkState network_state_; | 244 blink::WebMediaPlayer::NetworkState network_state_; |
241 blink::WebMediaPlayer::ReadyState ready_state_; | 245 blink::WebMediaPlayer::ReadyState ready_state_; |
242 | 246 |
243 // Preload state for when |data_source_| is created after setPreload(). | 247 // Preload state for when |data_source_| is created after setPreload(). |
244 BufferedDataSource::Preload preload_; | 248 BufferedDataSource::Preload preload_; |
245 | 249 |
246 // Task runner for posting tasks on Chrome's main thread. Also used | 250 // Task runner for posting tasks on Chrome's main thread. Also used |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 bool should_notify_time_changed_; | 298 bool should_notify_time_changed_; |
295 | 299 |
296 blink::WebMediaPlayerClient* client_; | 300 blink::WebMediaPlayerClient* client_; |
297 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_; | 301 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_; |
298 | 302 |
299 base::WeakPtr<WebMediaPlayerDelegate> delegate_; | 303 base::WeakPtr<WebMediaPlayerDelegate> delegate_; |
300 | 304 |
301 WebMediaPlayerParams::DeferLoadCB defer_load_cb_; | 305 WebMediaPlayerParams::DeferLoadCB defer_load_cb_; |
302 WebMediaPlayerParams::Context3DCB context_3d_cb_; | 306 WebMediaPlayerParams::Context3DCB context_3d_cb_; |
303 | 307 |
| 308 // Members for notifying upstream clients about internal memory usage. The |
| 309 // |adjust_allocated_memory_cb_| must only be called on |main_task_runner_|. |
| 310 base::RepeatingTimer memory_usage_reporting_timer_; |
| 311 WebMediaPlayerParams::AdjustAllocatedMemoryCB adjust_allocated_memory_cb_; |
| 312 int64_t last_reported_memory_usage_; |
| 313 |
304 // Routes audio playback to either AudioRendererSink or WebAudio. | 314 // Routes audio playback to either AudioRendererSink or WebAudio. |
305 scoped_refptr<WebAudioSourceProviderImpl> audio_source_provider_; | 315 scoped_refptr<WebAudioSourceProviderImpl> audio_source_provider_; |
306 | 316 |
307 bool supports_save_; | 317 bool supports_save_; |
308 | 318 |
309 // These two are mutually exclusive: | 319 // These two are mutually exclusive: |
310 // |data_source_| is used for regular resource loads. | 320 // |data_source_| is used for regular resource loads. |
311 // |chunk_demuxer_| is used for Media Source resource loads. | 321 // |chunk_demuxer_| is used for Media Source resource loads. |
312 // | 322 // |
313 // |demuxer_| will contain the appropriate demuxer based on which resource | 323 // |demuxer_| will contain the appropriate demuxer based on which resource |
(...skipping 18 matching lines...) Expand all Loading... |
332 scoped_ptr<blink::WebContentDecryptionModuleResult> set_cdm_result_; | 342 scoped_ptr<blink::WebContentDecryptionModuleResult> set_cdm_result_; |
333 | 343 |
334 scoped_ptr<RendererFactory> renderer_factory_; | 344 scoped_ptr<RendererFactory> renderer_factory_; |
335 | 345 |
336 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 346 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
337 }; | 347 }; |
338 | 348 |
339 } // namespace media | 349 } // namespace media |
340 | 350 |
341 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 351 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |