Commit 9d638a1e authored by dalecurtis's avatar dalecurtis Committed by Commit bot

Add metrics for tracking underflow during src= playback.

I'm surprised we didn't already have these metrics, they are pretty
key to evaluating improvements to our pipeline. Possibly they were
harder to add prior to chcunningham@'s recent work to expose the
BUFFERING_HAVE_NOTHING state to WMPI.

BUG=641633
TEST=manual.

Review-Url: https://codereview.chromium.org/2286843003
Cr-Commit-Position: refs/heads/master@{#415215}
parent 04e85bf7
...@@ -226,7 +226,8 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( ...@@ -226,7 +226,8 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
overlay_surface_id_(SurfaceManager::kNoSurfaceID), overlay_surface_id_(SurfaceManager::kNoSurfaceID),
suppress_destruction_errors_(false), suppress_destruction_errors_(false),
can_suspend_state_(CanSuspendState::UNKNOWN), can_suspend_state_(CanSuspendState::UNKNOWN),
is_encrypted_(false) { is_encrypted_(false),
underflow_count_(0) {
DCHECK(!adjust_allocated_memory_cb_.is_null()); DCHECK(!adjust_allocated_memory_cb_.is_null());
DCHECK(renderer_factory_); DCHECK(renderer_factory_);
DCHECK(client_); DCHECK(client_);
...@@ -1099,6 +1100,14 @@ void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) { ...@@ -1099,6 +1100,14 @@ void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) {
// Once we have enough, start reporting the total memory usage. We'll also // Once we have enough, start reporting the total memory usage. We'll also
// report once playback starts. // report once playback starts.
ReportMemoryUsage(); ReportMemoryUsage();
// Report the amount of time it took to leave the underflow state. Don't
// bother to report this for MSE playbacks since it's out of our control.
if (underflow_timer_ && data_source_) {
UMA_HISTOGRAM_TIMES("Media.UnderflowDuration",
underflow_timer_->Elapsed());
underflow_timer_.reset();
}
} else { } else {
// Buffering has underflowed. // Buffering has underflowed.
DCHECK_EQ(state, BUFFERING_HAVE_NOTHING); DCHECK_EQ(state, BUFFERING_HAVE_NOTHING);
...@@ -1106,6 +1115,13 @@ void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) { ...@@ -1106,6 +1115,13 @@ void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) {
// HAVE_CURRENT_DATA. // HAVE_CURRENT_DATA.
DCHECK_GT(highest_ready_state_, WebMediaPlayer::ReadyStateHaveCurrentData); DCHECK_GT(highest_ready_state_, WebMediaPlayer::ReadyStateHaveCurrentData);
SetReadyState(WebMediaPlayer::ReadyStateHaveCurrentData); SetReadyState(WebMediaPlayer::ReadyStateHaveCurrentData);
// Report the number of times we've entered the underflow state. Only report
// for src= playback since for MSE it's out of our control.
if (data_source_) {
UMA_HISTOGRAM_COUNTS_100("Media.UnderflowCount", ++underflow_count_);
underflow_timer_.reset(new base::ElapsedTimer());
}
} }
UpdatePlayState(); UpdatePlayState();
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "base/timer/elapsed_timer.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "media/base/media_tracks.h" #include "media/base/media_tracks.h"
...@@ -541,6 +542,10 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl ...@@ -541,6 +542,10 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
std::unique_ptr<WatchTimeReporter> watch_time_reporter_; std::unique_ptr<WatchTimeReporter> watch_time_reporter_;
bool is_encrypted_; bool is_encrypted_;
// Number of times we've reached BUFFERING_HAVE_NOTHING during playback.
int underflow_count_;
std::unique_ptr<base::ElapsedTimer> underflow_timer_;
DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
}; };
......
...@@ -23471,6 +23471,20 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. ...@@ -23471,6 +23471,20 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary> </summary>
</histogram> </histogram>
<histogram name="Media.UnderflowCount">
<owner>dalecurtis@chromium.org</owner>
<summary>
The number of times a src= playback has underflowed; i.e. ran out of data.
</summary>
</histogram>
<histogram name="Media.UnderflowDuration" units="ms">
<owner>dalecurtis@chromium.org</owner>
<summary>
The amount of time taken to leave the underflow state; i.e. resume playback.
</summary>
</histogram>
<histogram name="Media.URLScheme" enum="URLSchemeForHistogram"> <histogram name="Media.URLScheme" enum="URLSchemeForHistogram">
<owner>scherkus@chromium.org</owner> <owner>scherkus@chromium.org</owner>
<summary> <summary>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment