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

Unified Diff: media/renderers/audio_renderer_impl.cc

Issue 1409123005: Add methods for telling V8 how much memory audio/video is using. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix html viewer. Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/renderers/audio_renderer_impl.h ('k') | media/renderers/audio_renderer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/renderers/audio_renderer_impl.cc
diff --git a/media/renderers/audio_renderer_impl.cc b/media/renderers/audio_renderer_impl.cc
index 2d9879b64b814f8fa6c91dbdec925ded880d69a9..deb8dfe2111ce7f7f670d0907e9e813d45600370 100644
--- a/media/renderers/audio_renderer_impl.cc
+++ b/media/renderers/audio_renderer_impl.cc
@@ -57,6 +57,7 @@ AudioRendererImpl::AudioRendererImpl(
hardware_config_(hardware_config),
media_log_(media_log),
tick_clock_(new base::DefaultTickClock()),
+ last_audio_memory_usage_(0),
playback_rate_(0.0),
state_(kUninitialized),
buffering_state_(BUFFERING_HAVE_NOTHING),
@@ -334,6 +335,7 @@ void AudioRendererImpl::Initialize(
buffering_state_cb_ = buffering_state_cb;
ended_cb_ = ended_cb;
error_cb_ = error_cb;
+ statistics_cb_ = statistics_cb;
const AudioParameters& hw_params = hardware_config_.GetOutputConfig();
expecting_config_changes_ = stream->SupportsConfigChanges();
@@ -514,6 +516,12 @@ bool AudioRendererImpl::HandleSplicerBuffer_Locked(
if (first_packet_timestamp_ == kNoTimestamp())
first_packet_timestamp_ = buffer->timestamp();
+ const size_t memory_usage = algorithm_->GetMemoryUsage();
+ PipelineStatistics stats;
+ stats.audio_memory_usage = memory_usage - last_audio_memory_usage_;
+ last_audio_memory_usage_ = memory_usage;
+ task_runner_->PostTask(FROM_HERE, base::Bind(statistics_cb_, stats));
+
switch (state_) {
case kUninitialized:
case kInitializing:
« no previous file with comments | « media/renderers/audio_renderer_impl.h ('k') | media/renderers/audio_renderer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698