| 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/optional.h" | 21 #include "base/optional.h" |
| 21 #include "base/threading/thread.h" | 22 #include "base/threading/thread.h" |
| 22 #include "base/time/default_tick_clock.h" | 23 #include "base/time/default_tick_clock.h" |
| 23 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 24 #include "base/timer/elapsed_timer.h" | 25 #include "base/timer/elapsed_timer.h" |
| 25 #include "base/timer/timer.h" | 26 #include "base/timer/timer.h" |
| 26 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 27 #include "media/base/media_observer.h" | 28 #include "media/base/media_observer.h" |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 void SetMemoryReportingState(bool is_memory_reporting_enabled); | 350 void SetMemoryReportingState(bool is_memory_reporting_enabled); |
| 350 void SetSuspendState(bool is_suspended); | 351 void SetSuspendState(bool is_suspended); |
| 351 | 352 |
| 352 // Called at low frequency to tell external observers how much memory we're | 353 // Called at low frequency to tell external observers how much memory we're |
| 353 // using for video playback. Called by |memory_usage_reporting_timer_|. | 354 // using for video playback. Called by |memory_usage_reporting_timer_|. |
| 354 // Memory usage reporting is done in two steps, because |demuxer_| must be | 355 // Memory usage reporting is done in two steps, because |demuxer_| must be |
| 355 // accessed on the media thread. | 356 // accessed on the media thread. |
| 356 void ReportMemoryUsage(); | 357 void ReportMemoryUsage(); |
| 357 void FinishMemoryUsageReport(int64_t demuxer_memory_usage); | 358 void FinishMemoryUsageReport(int64_t demuxer_memory_usage); |
| 358 | 359 |
| 360 void OnMemoryPressure( |
| 361 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); |
| 362 |
| 359 // Called during OnHidden() when we want a suspended player to enter the | 363 // Called during OnHidden() when we want a suspended player to enter the |
| 360 // paused state after some idle timeout. | 364 // paused state after some idle timeout. |
| 361 void ScheduleIdlePauseTimer(); | 365 void ScheduleIdlePauseTimer(); |
| 362 | 366 |
| 363 // Returns |true| before HaveFutureData whenever there has been loading | 367 // Returns |true| before HaveFutureData whenever there has been loading |
| 364 // progress and we have not been resumed for at least kLoadingToIdleTimeout | 368 // progress and we have not been resumed for at least kLoadingToIdleTimeout |
| 365 // since then. | 369 // since then. |
| 366 // | 370 // |
| 367 // This is used to delay suspension long enough for preroll to complete, which | 371 // This is used to delay suspension long enough for preroll to complete, which |
| 368 // is necessay because play() will not be called before HaveFutureData (and | 372 // is necessay because play() will not be called before HaveFutureData (and |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 // These two are mutually exclusive: | 530 // These two are mutually exclusive: |
| 527 // |data_source_| is used for regular resource loads. | 531 // |data_source_| is used for regular resource loads. |
| 528 // |chunk_demuxer_| is used for Media Source resource loads. | 532 // |chunk_demuxer_| is used for Media Source resource loads. |
| 529 // | 533 // |
| 530 // |demuxer_| will contain the appropriate demuxer based on which resource | 534 // |demuxer_| will contain the appropriate demuxer based on which resource |
| 531 // load strategy we're using. | 535 // load strategy we're using. |
| 532 std::unique_ptr<MultibufferDataSource> data_source_; | 536 std::unique_ptr<MultibufferDataSource> data_source_; |
| 533 std::unique_ptr<Demuxer> demuxer_; | 537 std::unique_ptr<Demuxer> demuxer_; |
| 534 ChunkDemuxer* chunk_demuxer_; | 538 ChunkDemuxer* chunk_demuxer_; |
| 535 | 539 |
| 540 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
| 541 |
| 536 BufferedDataSourceHostImpl buffered_data_source_host_; | 542 BufferedDataSourceHostImpl buffered_data_source_host_; |
| 537 linked_ptr<UrlIndex> url_index_; | 543 linked_ptr<UrlIndex> url_index_; |
| 538 | 544 |
| 539 // Video rendering members. | 545 // Video rendering members. |
| 540 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 546 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
| 541 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|. | 547 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|. |
| 542 SkCanvasVideoRenderer skcanvas_video_renderer_; | 548 SkCanvasVideoRenderer skcanvas_video_renderer_; |
| 543 | 549 |
| 544 // The compositor layer for displaying the video content when using composited | 550 // The compositor layer for displaying the video content when using composited |
| 545 // playback. | 551 // playback. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 | 656 |
| 651 // Pipeline statistics overridden by tests. | 657 // Pipeline statistics overridden by tests. |
| 652 base::Optional<PipelineStatistics> pipeline_statistics_for_test_; | 658 base::Optional<PipelineStatistics> pipeline_statistics_for_test_; |
| 653 | 659 |
| 654 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 660 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 655 }; | 661 }; |
| 656 | 662 |
| 657 } // namespace media | 663 } // namespace media |
| 658 | 664 |
| 659 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 665 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |