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

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

Issue 2716813003: Merge M57: "Fix underflow duration calculation for MSE." (Closed)
Patch Set: 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 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 1294
1295 // Report the amount of time it took to leave the underflow state. 1295 // Report the amount of time it took to leave the underflow state.
1296 if (underflow_timer_) { 1296 if (underflow_timer_) {
1297 RecordUnderflowDuration(underflow_timer_->Elapsed()); 1297 RecordUnderflowDuration(underflow_timer_->Elapsed());
1298 underflow_timer_.reset(); 1298 underflow_timer_.reset();
1299 } 1299 }
1300 } else { 1300 } else {
1301 // Buffering has underflowed. 1301 // Buffering has underflowed.
1302 DCHECK_EQ(state, BUFFERING_HAVE_NOTHING); 1302 DCHECK_EQ(state, BUFFERING_HAVE_NOTHING);
1303 1303
1304 // Report the number of times we've entered the underflow state. Only report 1304 // Report the number of times we've entered the underflow state. Ensure we
1305 // for src= playback since for MSE it's out of our control. Ensure we only 1305 // only report the value when transitioning from HAVE_ENOUGH to
1306 // report the value when transitioning from HAVE_ENOUGH to HAVE_NOTHING. 1306 // HAVE_NOTHING.
1307 if (data_source_ && 1307 if (ready_state_ == WebMediaPlayer::ReadyStateHaveEnoughData)
1308 ready_state_ == WebMediaPlayer::ReadyStateHaveEnoughData) {
1309 underflow_timer_.reset(new base::ElapsedTimer()); 1308 underflow_timer_.reset(new base::ElapsedTimer());
1310 }
1311 1309
1312 // It shouldn't be possible to underflow if we've not advanced past 1310 // It shouldn't be possible to underflow if we've not advanced past
1313 // HAVE_CURRENT_DATA. 1311 // HAVE_CURRENT_DATA.
1314 DCHECK_GT(highest_ready_state_, WebMediaPlayer::ReadyStateHaveCurrentData); 1312 DCHECK_GT(highest_ready_state_, WebMediaPlayer::ReadyStateHaveCurrentData);
1315 SetReadyState(WebMediaPlayer::ReadyStateHaveCurrentData); 1313 SetReadyState(WebMediaPlayer::ReadyStateHaveCurrentData);
1316 } 1314 }
1317 1315
1318 UpdatePlayState(); 1316 UpdatePlayState();
1319 } 1317 }
1320 1318
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 } 2275 }
2278 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { 2276 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) {
2279 DCHECK(data_source_ || chunk_demuxer_); 2277 DCHECK(data_source_ || chunk_demuxer_);
2280 if (data_source_) 2278 if (data_source_)
2281 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); 2279 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration);
2282 else 2280 else
2283 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); 2281 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration);
2284 } 2282 }
2285 2283
2286 } // namespace media 2284 } // 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