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

Unified Diff: chromecast/media/cma/pipeline/media_pipeline_impl.cc

Issue 2032813002: [Chromecast] Log playback stall event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « chromecast/media/cma/pipeline/media_pipeline_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/media/cma/pipeline/media_pipeline_impl.cc
diff --git a/chromecast/media/cma/pipeline/media_pipeline_impl.cc b/chromecast/media/cma/pipeline/media_pipeline_impl.cc
index 68fcaa72e67c5834f50f1e1f40019f885e26603d..6b6e4b9f67788ced81b70825499b2cdc54f07509 100644
--- a/chromecast/media/cma/pipeline/media_pipeline_impl.cc
+++ b/chromecast/media/cma/pipeline/media_pipeline_impl.cc
@@ -87,6 +87,8 @@ MediaPipelineImpl::MediaPipelineImpl()
statistics_rolling_counter_(0),
audio_bytes_for_bitrate_estimation_(0),
video_bytes_for_bitrate_estimation_(0),
+ playback_stalled_(false),
+ playback_stalled_notification_sent_(false),
weak_factory_(this) {
CMALOG(kLogControl) << __FUNCTION__;
weak_this_ = weak_factory_.GetWeakPtr();
@@ -423,6 +425,44 @@ void MediaPipelineImpl::OnBufferingNotification(bool is_buffering) {
}
}
+void MediaPipelineImpl::CheckForPlaybackStall(base::TimeDelta media_time,
+ base::TimeTicks current_stc) {
alokp 2016/06/02 00:09:33 DCHECK(media_time >= last_media_time)
ejason 2016/06/03 16:48:47 I added this DCHECK but during my local longevity
+ // Check to see if a stall condition exists. If not, check to see if we need
+ // to transition out of the previous stall condition.
+ if (media_time != last_media_time_) {
+ if (playback_stalled_) {
+ // Transition out of the stalled condition.
+ base::TimeDelta stall_duration = current_stc - playback_stalled_time_;
+ LOG(INFO) << "Transitioning out of stalled state. Stall duration was "
alokp 2016/06/02 00:09:33 LOG(INFO) -> CMALOG
ejason 2016/06/03 16:48:47 Done.
+ << stall_duration.InMilliseconds() << " ms";
+ playback_stalled_ = false;
+ playback_stalled_notification_sent_ = false;
+ }
+ return;
+ }
+
+ // Check to see if this is a new stall condition.
+ if (!playback_stalled_) {
+ playback_stalled_ = true;
+ playback_stalled_time_ = current_stc;
+ return;
+ }
+
+ // If we are in an existing stall, check to see if we've been stalled for more
+ // than 2.5 s. If so, send a single notification of the stall event.
+ if (!playback_stalled_notification_sent_) {
+ base::TimeDelta current_stall_duration =
+ current_stc - playback_stalled_time_;
+ if (current_stall_duration.InMilliseconds() >= 2500) {
alokp 2016/06/02 00:09:33 move 2500 into a constant.
ejason 2016/06/03 16:48:47 Done.
+ LOG(INFO) << "Playback stalled";
+ metrics::CastMetricsHelper::GetInstance()->RecordApplicationEvent(
+ "Cast.Platform.PlaybackStall");
+ playback_stalled_notification_sent_ = true;
+ }
+ return;
+ }
+}
+
void MediaPipelineImpl::UpdateMediaTime() {
alokp 2016/06/02 00:09:33 verify that this is not scheduled when playback_ra
ejason 2016/06/03 16:48:47 I reviewed the code and it appears to be the case.
pending_time_update_task_ = false;
if ((backend_state_ != BACKEND_STATE_PLAYING) &&
@@ -473,6 +513,8 @@ void MediaPipelineImpl::UpdateMediaTime() {
}
base::TimeTicks stc = base::TimeTicks::Now();
+ CheckForPlaybackStall(media_time, stc);
+
base::TimeDelta max_rendering_time = media_time;
if (buffering_controller_) {
buffering_controller_->SetMediaTime(media_time);
« no previous file with comments | « chromecast/media/cma/pipeline/media_pipeline_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698