| 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 #include "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 if (isRemote()) { | 852 if (isRemote()) { |
| 853 scoped_refptr<VideoFrame> frame = cast_impl_.GetCastingBanner(); | 853 scoped_refptr<VideoFrame> frame = cast_impl_.GetCastingBanner(); |
| 854 if (frame) { | 854 if (frame) { |
| 855 compositor_->PaintFrameUsingOldRenderingPath(frame); | 855 compositor_->PaintFrameUsingOldRenderingPath(frame); |
| 856 } | 856 } |
| 857 } | 857 } |
| 858 #endif | 858 #endif |
| 859 | 859 |
| 860 if (delegate_) | 860 if (delegate_) |
| 861 delegate_->PlayerGone(delegate_id_); | 861 delegate_->PlayerGone(delegate_id_); |
| 862 memory_usage_reporting_timer_.Stop(); |
| 863 ReportMemoryUsage(); |
| 862 | 864 |
| 863 if (pending_suspend_resume_cycle_) { | 865 if (pending_suspend_resume_cycle_) { |
| 864 pending_suspend_resume_cycle_ = false; | 866 pending_suspend_resume_cycle_ = false; |
| 865 pipeline_controller_.Resume(); | 867 pipeline_controller_.Resume(); |
| 866 return; | 868 return; |
| 867 } | 869 } |
| 868 } | 870 } |
| 869 | 871 |
| 870 void WebMediaPlayerImpl::OnPipelineResumed() { | 872 void WebMediaPlayerImpl::OnPipelineResumed() { |
| 871 if (playback_rate_ > 0 && !paused_) | 873 if (playback_rate_ > 0 && !paused_) |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 | 1404 |
| 1403 void WebMediaPlayerImpl::FinishMemoryUsageReport(int64_t demuxer_memory_usage) { | 1405 void WebMediaPlayerImpl::FinishMemoryUsageReport(int64_t demuxer_memory_usage) { |
| 1404 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1406 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 1405 | 1407 |
| 1406 const PipelineStatistics stats = pipeline_.GetStatistics(); | 1408 const PipelineStatistics stats = pipeline_.GetStatistics(); |
| 1407 const int64_t current_memory_usage = | 1409 const int64_t current_memory_usage = |
| 1408 stats.audio_memory_usage + stats.video_memory_usage + | 1410 stats.audio_memory_usage + stats.video_memory_usage + |
| 1409 (data_source_ ? data_source_->GetMemoryUsage() : 0) + | 1411 (data_source_ ? data_source_->GetMemoryUsage() : 0) + |
| 1410 demuxer_memory_usage; | 1412 demuxer_memory_usage; |
| 1411 | 1413 |
| 1414 // Note, this isn't entirely accurate, there may be VideoFrames held by the |
| 1415 // compositor or other resources that we're unaware of. |
| 1416 |
| 1412 DVLOG(2) << "Memory Usage -- Audio: " << stats.audio_memory_usage | 1417 DVLOG(2) << "Memory Usage -- Audio: " << stats.audio_memory_usage |
| 1413 << ", Video: " << stats.video_memory_usage << ", DataSource: " | 1418 << ", Video: " << stats.video_memory_usage << ", DataSource: " |
| 1414 << (data_source_ ? data_source_->GetMemoryUsage() : 0) | 1419 << (data_source_ ? data_source_->GetMemoryUsage() : 0) |
| 1415 << ", Demuxer: " << demuxer_memory_usage; | 1420 << ", Demuxer: " << demuxer_memory_usage; |
| 1416 | 1421 |
| 1417 const int64_t delta = current_memory_usage - last_reported_memory_usage_; | 1422 const int64_t delta = current_memory_usage - last_reported_memory_usage_; |
| 1418 last_reported_memory_usage_ = current_memory_usage; | 1423 last_reported_memory_usage_ = current_memory_usage; |
| 1419 adjust_allocated_memory_cb_.Run(delta); | 1424 adjust_allocated_memory_cb_.Run(delta); |
| 1420 } | 1425 } |
| 1421 | 1426 |
| 1422 } // namespace media | 1427 } // namespace media |
| OLD | NEW |