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

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

Issue 2713323002: Fix underflow duration calculation for MSE. (Closed)
Patch Set: Fix comment. Created 3 years, 10 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 | « no previous file | 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 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 1329
1330 // Report the amount of time it took to leave the underflow state. 1330 // Report the amount of time it took to leave the underflow state.
1331 if (underflow_timer_) { 1331 if (underflow_timer_) {
1332 RecordUnderflowDuration(underflow_timer_->Elapsed()); 1332 RecordUnderflowDuration(underflow_timer_->Elapsed());
1333 underflow_timer_.reset(); 1333 underflow_timer_.reset();
1334 } 1334 }
1335 } else { 1335 } else {
1336 // Buffering has underflowed. 1336 // Buffering has underflowed.
1337 DCHECK_EQ(state, BUFFERING_HAVE_NOTHING); 1337 DCHECK_EQ(state, BUFFERING_HAVE_NOTHING);
1338 1338
1339 // Report the number of times we've entered the underflow state. Only report 1339 // Report the number of times we've entered the underflow state. Ensure we
1340 // for src= playback since for MSE it's out of our control. Ensure we only 1340 // only report the value when transitioning from HAVE_ENOUGH to
1341 // report the value when transitioning from HAVE_ENOUGH to HAVE_NOTHING. 1341 // HAVE_NOTHING.
1342 if (data_source_ && 1342 if (ready_state_ == WebMediaPlayer::ReadyStateHaveEnoughData)
1343 ready_state_ == WebMediaPlayer::ReadyStateHaveEnoughData) {
1344 underflow_timer_.reset(new base::ElapsedTimer()); 1343 underflow_timer_.reset(new base::ElapsedTimer());
1345 }
1346 1344
1347 // It shouldn't be possible to underflow if we've not advanced past 1345 // It shouldn't be possible to underflow if we've not advanced past
1348 // HAVE_CURRENT_DATA. 1346 // HAVE_CURRENT_DATA.
1349 DCHECK_GT(highest_ready_state_, WebMediaPlayer::ReadyStateHaveCurrentData); 1347 DCHECK_GT(highest_ready_state_, WebMediaPlayer::ReadyStateHaveCurrentData);
1350 SetReadyState(WebMediaPlayer::ReadyStateHaveCurrentData); 1348 SetReadyState(WebMediaPlayer::ReadyStateHaveCurrentData);
1351 } 1349 }
1352 1350
1353 UpdatePlayState(); 1351 UpdatePlayState();
1354 } 1352 }
1355 1353
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 2312
2315 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { 2313 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) {
2316 DCHECK(data_source_ || chunk_demuxer_); 2314 DCHECK(data_source_ || chunk_demuxer_);
2317 if (data_source_) 2315 if (data_source_)
2318 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); 2316 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration);
2319 else 2317 else
2320 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); 2318 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration);
2321 } 2319 }
2322 2320
2323 } // namespace media 2321 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698