| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/cancelable_callback.h" | 14 #include "base/cancelable_callback.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
| 18 #include "base/memory/memory_pressure_listener.h" |
| 18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 20 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
| 21 #include "base/time/default_tick_clock.h" | 22 #include "base/time/default_tick_clock.h" |
| 22 #include "base/timer/elapsed_timer.h" | 23 #include "base/timer/elapsed_timer.h" |
| 23 #include "base/timer/timer.h" | 24 #include "base/timer/timer.h" |
| 24 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 25 #include "media/base/media_observer.h" | 26 #include "media/base/media_observer.h" |
| 26 #include "media/base/media_tracks.h" | 27 #include "media/base/media_tracks.h" |
| 27 #include "media/base/pipeline_impl.h" | 28 #include "media/base/pipeline_impl.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 void SetMemoryReportingState(bool is_memory_reporting_enabled); | 348 void SetMemoryReportingState(bool is_memory_reporting_enabled); |
| 348 void SetSuspendState(bool is_suspended); | 349 void SetSuspendState(bool is_suspended); |
| 349 | 350 |
| 350 // Called at low frequency to tell external observers how much memory we're | 351 // Called at low frequency to tell external observers how much memory we're |
| 351 // using for video playback. Called by |memory_usage_reporting_timer_|. | 352 // using for video playback. Called by |memory_usage_reporting_timer_|. |
| 352 // Memory usage reporting is done in two steps, because |demuxer_| must be | 353 // Memory usage reporting is done in two steps, because |demuxer_| must be |
| 353 // accessed on the media thread. | 354 // accessed on the media thread. |
| 354 void ReportMemoryUsage(); | 355 void ReportMemoryUsage(); |
| 355 void FinishMemoryUsageReport(int64_t demuxer_memory_usage); | 356 void FinishMemoryUsageReport(int64_t demuxer_memory_usage); |
| 356 | 357 |
| 358 void OnMemoryPressure( |
| 359 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); |
| 360 |
| 357 // Called during OnHidden() when we want a suspended player to enter the | 361 // Called during OnHidden() when we want a suspended player to enter the |
| 358 // paused state after some idle timeout. | 362 // paused state after some idle timeout. |
| 359 void ScheduleIdlePauseTimer(); | 363 void ScheduleIdlePauseTimer(); |
| 360 | 364 |
| 361 void CreateWatchTimeReporter(); | 365 void CreateWatchTimeReporter(); |
| 362 | 366 |
| 363 // Returns true if the player is hidden. | 367 // Returns true if the player is hidden. |
| 364 bool IsHidden() const; | 368 bool IsHidden() const; |
| 365 | 369 |
| 366 // Return whether |pipeline_metadata_| is compatible with an overlay. This | 370 // Return whether |pipeline_metadata_| is compatible with an overlay. This |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 // These two are mutually exclusive: | 486 // These two are mutually exclusive: |
| 483 // |data_source_| is used for regular resource loads. | 487 // |data_source_| is used for regular resource loads. |
| 484 // |chunk_demuxer_| is used for Media Source resource loads. | 488 // |chunk_demuxer_| is used for Media Source resource loads. |
| 485 // | 489 // |
| 486 // |demuxer_| will contain the appropriate demuxer based on which resource | 490 // |demuxer_| will contain the appropriate demuxer based on which resource |
| 487 // load strategy we're using. | 491 // load strategy we're using. |
| 488 std::unique_ptr<MultibufferDataSource> data_source_; | 492 std::unique_ptr<MultibufferDataSource> data_source_; |
| 489 std::unique_ptr<Demuxer> demuxer_; | 493 std::unique_ptr<Demuxer> demuxer_; |
| 490 ChunkDemuxer* chunk_demuxer_; | 494 ChunkDemuxer* chunk_demuxer_; |
| 491 | 495 |
| 496 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
| 497 |
| 492 BufferedDataSourceHostImpl buffered_data_source_host_; | 498 BufferedDataSourceHostImpl buffered_data_source_host_; |
| 493 linked_ptr<UrlIndex> url_index_; | 499 linked_ptr<UrlIndex> url_index_; |
| 494 | 500 |
| 495 // Video rendering members. | 501 // Video rendering members. |
| 496 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 502 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
| 497 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|. | 503 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|. |
| 498 SkCanvasVideoRenderer skcanvas_video_renderer_; | 504 SkCanvasVideoRenderer skcanvas_video_renderer_; |
| 499 | 505 |
| 500 // The compositor layer for displaying the video content when using composited | 506 // The compositor layer for displaying the video content when using composited |
| 501 // playback. | 507 // playback. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 | 596 |
| 591 // Whether the player is currently in autoplay muted state. | 597 // Whether the player is currently in autoplay muted state. |
| 592 bool autoplay_muted_ = false; | 598 bool autoplay_muted_ = false; |
| 593 | 599 |
| 594 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 600 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 595 }; | 601 }; |
| 596 | 602 |
| 597 } // namespace media | 603 } // namespace media |
| 598 | 604 |
| 599 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 605 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |