Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 1815883002: Merge M50: "Fix media memory usage reporting after a pipeline suspend." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/pipeline_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 950
951 #if defined(OS_ANDROID) 951 #if defined(OS_ANDROID)
952 if (isRemote()) { 952 if (isRemote()) {
953 scoped_refptr<VideoFrame> frame = cast_impl_.GetCastingBanner(); 953 scoped_refptr<VideoFrame> frame = cast_impl_.GetCastingBanner();
954 if (frame) { 954 if (frame) {
955 compositor_->PaintFrameUsingOldRenderingPath(frame); 955 compositor_->PaintFrameUsingOldRenderingPath(frame);
956 } 956 }
957 } 957 }
958 #endif 958 #endif
959 959
960 if (pending_resume_ || pending_suspend_resume_cycle_) { 960 if (delegate_)
961 pending_resume_ = false; 961 delegate_->PlayerGone(delegate_id_);
962 memory_usage_reporting_timer_.Stop();
963 ReportMemoryUsage();
964
965 if (pending_suspend_resume_cycle_) {
966 » pending_resume_ = false;
962 pending_suspend_resume_cycle_ = false; 967 pending_suspend_resume_cycle_ = false;
963 Resume(); 968 Resume();
964 return; 969 return;
965 } 970 }
966 } 971 }
967 972
968 void WebMediaPlayerImpl::OnPipelineEnded() { 973 void WebMediaPlayerImpl::OnPipelineEnded() {
969 DVLOG(1) << __FUNCTION__; 974 DVLOG(1) << __FUNCTION__;
970 DCHECK(main_task_runner_->BelongsToCurrentThread()); 975 DCHECK(main_task_runner_->BelongsToCurrentThread());
971 976
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 1600
1596 void WebMediaPlayerImpl::FinishMemoryUsageReport(int64_t demuxer_memory_usage) { 1601 void WebMediaPlayerImpl::FinishMemoryUsageReport(int64_t demuxer_memory_usage) {
1597 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1602 DCHECK(main_task_runner_->BelongsToCurrentThread());
1598 1603
1599 const PipelineStatistics stats = pipeline_.GetStatistics(); 1604 const PipelineStatistics stats = pipeline_.GetStatistics();
1600 const int64_t current_memory_usage = 1605 const int64_t current_memory_usage =
1601 stats.audio_memory_usage + stats.video_memory_usage + 1606 stats.audio_memory_usage + stats.video_memory_usage +
1602 (data_source_ ? data_source_->GetMemoryUsage() : 0) + 1607 (data_source_ ? data_source_->GetMemoryUsage() : 0) +
1603 demuxer_memory_usage; 1608 demuxer_memory_usage;
1604 1609
1610 // Note, this isn't entirely accurate, there may be VideoFrames held by the
1611 // compositor or other resources that we're unaware of.
1612
1605 DVLOG(2) << "Memory Usage -- Audio: " << stats.audio_memory_usage 1613 DVLOG(2) << "Memory Usage -- Audio: " << stats.audio_memory_usage
1606 << ", Video: " << stats.video_memory_usage << ", DataSource: " 1614 << ", Video: " << stats.video_memory_usage << ", DataSource: "
1607 << (data_source_ ? data_source_->GetMemoryUsage() : 0) 1615 << (data_source_ ? data_source_->GetMemoryUsage() : 0)
1608 << ", Demuxer: " << demuxer_memory_usage; 1616 << ", Demuxer: " << demuxer_memory_usage;
1609 1617
1610 const int64_t delta = current_memory_usage - last_reported_memory_usage_; 1618 const int64_t delta = current_memory_usage - last_reported_memory_usage_;
1611 last_reported_memory_usage_ = current_memory_usage; 1619 last_reported_memory_usage_ = current_memory_usage;
1612 adjust_allocated_memory_cb_.Run(delta); 1620 adjust_allocated_memory_cb_.Run(delta);
1613 } 1621 }
1614 1622
1615 } // namespace media 1623 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698