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 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 if (rotated_size == pipeline_metadata_.natural_size) | 1414 if (rotated_size == pipeline_metadata_.natural_size) |
1415 return; | 1415 return; |
1416 | 1416 |
1417 TRACE_EVENT0("media", "WebMediaPlayerImpl::OnNaturalSizeChanged"); | 1417 TRACE_EVENT0("media", "WebMediaPlayerImpl::OnNaturalSizeChanged"); |
1418 media_log_->AddEvent(media_log_->CreateVideoSizeSetEvent( | 1418 media_log_->AddEvent(media_log_->CreateVideoSizeSetEvent( |
1419 rotated_size.width(), rotated_size.height())); | 1419 rotated_size.width(), rotated_size.height())); |
1420 | 1420 |
1421 if (overlay_enabled_ && surface_manager_) | 1421 if (overlay_enabled_ && surface_manager_) |
1422 surface_manager_->NaturalSizeChanged(rotated_size); | 1422 surface_manager_->NaturalSizeChanged(rotated_size); |
1423 | 1423 |
1424 gfx::Size old_size = pipeline_metadata_.natural_size; | |
1425 pipeline_metadata_.natural_size = rotated_size; | 1424 pipeline_metadata_.natural_size = rotated_size; |
1426 if (old_size.IsEmpty()) { | 1425 |
1427 // WatchTimeReporter doesn't report metrics for empty videos. Re-create | 1426 // Re-create |watch_time_reporter_| if we didn't originally know the video |
1428 // |watch_time_reporter_| if we didn't originally know the video size. | 1427 // size or the previous size was too small for reporting. |
| 1428 if (!watch_time_reporter_->IsSizeLargeEnoughToReportWatchTime()) |
1429 CreateWatchTimeReporter(); | 1429 CreateWatchTimeReporter(); |
1430 } | 1430 |
1431 client_->SizeChanged(); | 1431 client_->SizeChanged(); |
1432 | 1432 |
1433 if (observer_) | 1433 if (observer_) |
1434 observer_->OnMetadataChanged(pipeline_metadata_); | 1434 observer_->OnMetadataChanged(pipeline_metadata_); |
1435 } | 1435 } |
1436 | 1436 |
1437 void WebMediaPlayerImpl::OnVideoOpacityChange(bool opaque) { | 1437 void WebMediaPlayerImpl::OnVideoOpacityChange(bool opaque) { |
1438 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1438 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
1439 DCHECK_NE(ready_state_, WebMediaPlayer::kReadyStateHaveNothing); | 1439 DCHECK_NE(ready_state_, WebMediaPlayer::kReadyStateHaveNothing); |
1440 | 1440 |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2359 | 2359 |
2360 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { | 2360 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { |
2361 DCHECK(data_source_ || chunk_demuxer_); | 2361 DCHECK(data_source_ || chunk_demuxer_); |
2362 if (data_source_) | 2362 if (data_source_) |
2363 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); | 2363 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); |
2364 else | 2364 else |
2365 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); | 2365 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); |
2366 } | 2366 } |
2367 | 2367 |
2368 } // namespace media | 2368 } // namespace media |
OLD | NEW |