Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1326 // operations. | 1326 // operations. |
| 1327 if (!pipeline_controller_.IsStable()) | 1327 if (!pipeline_controller_.IsStable()) |
| 1328 return; | 1328 return; |
| 1329 | 1329 |
| 1330 media_log_->AddEvent(media_log_->CreateBufferingStateChangedEvent( | 1330 media_log_->AddEvent(media_log_->CreateBufferingStateChangedEvent( |
| 1331 "pipeline_buffering_state", state)); | 1331 "pipeline_buffering_state", state)); |
| 1332 | 1332 |
| 1333 if (state == BUFFERING_HAVE_ENOUGH) { | 1333 if (state == BUFFERING_HAVE_ENOUGH) { |
| 1334 if (highest_ready_state_ < WebMediaPlayer::kReadyStateHaveEnoughData) { | 1334 if (highest_ready_state_ < WebMediaPlayer::kReadyStateHaveEnoughData) { |
| 1335 // Record a zero value for underflow histogram so that the histogram | 1335 // Record a zero value for underflow histogram so that the histogram |
| 1336 // includes playbacks which never encounter an underflow event. | 1336 // includes playbacks which never encounter an underflow event. |
|
xhwang
2017/05/17 04:51:38
What's the purpose of this logic? Are we using the
| |
| 1337 RecordUnderflowDuration(base::TimeDelta()); | 1337 RecordUnderflowDuration(base::TimeDelta()); |
| 1338 } | 1338 } |
| 1339 | 1339 |
| 1340 SetReadyState(CanPlayThrough() ? WebMediaPlayer::kReadyStateHaveEnoughData | 1340 SetReadyState(CanPlayThrough() ? WebMediaPlayer::kReadyStateHaveEnoughData |
| 1341 : WebMediaPlayer::kReadyStateHaveFutureData); | 1341 : WebMediaPlayer::kReadyStateHaveFutureData); |
| 1342 | 1342 |
| 1343 // Let the DataSource know we have enough data. It may use this information | 1343 // Let the DataSource know we have enough data. It may use this information |
| 1344 // to release unused network connections. | 1344 // to release unused network connections. |
| 1345 if (data_source_) | 1345 if (data_source_) |
| 1346 data_source_->OnBufferingHaveEnough(false); | 1346 data_source_->OnBufferingHaveEnough(false); |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2383 if (client_) { | 2383 if (client_) { |
| 2384 if (is_rendered_remotely) | 2384 if (is_rendered_remotely) |
| 2385 client_->MediaRemotingStarted(); | 2385 client_->MediaRemotingStarted(); |
| 2386 else | 2386 else |
| 2387 client_->MediaRemotingStopped(); | 2387 client_->MediaRemotingStopped(); |
| 2388 } | 2388 } |
| 2389 } | 2389 } |
| 2390 | 2390 |
| 2391 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { | 2391 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { |
| 2392 DCHECK(data_source_ || chunk_demuxer_); | 2392 DCHECK(data_source_ || chunk_demuxer_); |
| 2393 | |
| 2393 if (data_source_) | 2394 if (data_source_) |
| 2394 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); | 2395 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); |
| 2395 else | 2396 else |
| 2396 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); | 2397 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); |
| 2398 | |
| 2399 if (is_encrypted_) | |
| 2400 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.EME", duration); | |
| 2397 } | 2401 } |
| 2398 | 2402 |
| 2399 #define UMA_HISTOGRAM_VIDEO_HEIGHT(name, sample) \ | 2403 #define UMA_HISTOGRAM_VIDEO_HEIGHT(name, sample) \ |
| 2400 UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, 100, 10000, 50) | 2404 UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, 100, 10000, 50) |
| 2401 | 2405 |
| 2402 void WebMediaPlayerImpl::RecordVideoNaturalSize(const gfx::Size& natural_size) { | 2406 void WebMediaPlayerImpl::RecordVideoNaturalSize(const gfx::Size& natural_size) { |
| 2403 // Always report video natural size to MediaLog. | 2407 // Always report video natural size to MediaLog. |
| 2404 media_log_->AddEvent(media_log_->CreateVideoSizeSetEvent( | 2408 media_log_->AddEvent(media_log_->CreateVideoSizeSetEvent( |
| 2405 natural_size.width(), natural_size.height())); | 2409 natural_size.width(), natural_size.height())); |
| 2406 | 2410 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 2423 } | 2427 } |
| 2424 | 2428 |
| 2425 #undef UMA_HISTOGRAM_VIDEO_HEIGHT | 2429 #undef UMA_HISTOGRAM_VIDEO_HEIGHT |
| 2426 | 2430 |
| 2427 void WebMediaPlayerImpl::SetTickClockForTest(base::TickClock* tick_clock) { | 2431 void WebMediaPlayerImpl::SetTickClockForTest(base::TickClock* tick_clock) { |
| 2428 tick_clock_.reset(tick_clock); | 2432 tick_clock_.reset(tick_clock); |
| 2429 buffered_data_source_host_.SetTickClockForTest(tick_clock); | 2433 buffered_data_source_host_.SetTickClockForTest(tick_clock); |
| 2430 } | 2434 } |
| 2431 | 2435 |
| 2432 } // namespace media | 2436 } // namespace media |
| OLD | NEW |