| 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 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 if (rotated_size == pipeline_metadata_.natural_size) | 1305 if (rotated_size == pipeline_metadata_.natural_size) |
| 1306 return; | 1306 return; |
| 1307 | 1307 |
| 1308 TRACE_EVENT0("media", "WebMediaPlayerImpl::OnNaturalSizeChanged"); | 1308 TRACE_EVENT0("media", "WebMediaPlayerImpl::OnNaturalSizeChanged"); |
| 1309 media_log_->AddEvent(media_log_->CreateVideoSizeSetEvent( | 1309 media_log_->AddEvent(media_log_->CreateVideoSizeSetEvent( |
| 1310 rotated_size.width(), rotated_size.height())); | 1310 rotated_size.width(), rotated_size.height())); |
| 1311 | 1311 |
| 1312 if (overlay_enabled_ && surface_manager_) | 1312 if (overlay_enabled_ && surface_manager_) |
| 1313 surface_manager_->NaturalSizeChanged(rotated_size); | 1313 surface_manager_->NaturalSizeChanged(rotated_size); |
| 1314 | 1314 |
| 1315 if (pipeline_metadata_.natural_size.IsEmpty()) { | 1315 gfx::Size old_size = pipeline_metadata_.natural_size; |
| 1316 pipeline_metadata_.natural_size = rotated_size; |
| 1317 if (old_size.IsEmpty()) { |
| 1316 // WatchTimeReporter doesn't report metrics for empty videos. Re-create | 1318 // WatchTimeReporter doesn't report metrics for empty videos. Re-create |
| 1317 // |watch_time_reporter_| if we didn't originally know the video size. | 1319 // |watch_time_reporter_| if we didn't originally know the video size. |
| 1318 CreateWatchTimeReporter(); | 1320 CreateWatchTimeReporter(); |
| 1319 } | 1321 } |
| 1322 client_->sizeChanged(); |
| 1320 | 1323 |
| 1321 pipeline_metadata_.natural_size = rotated_size; | 1324 if (observer_) { |
| 1322 client_->sizeChanged(); | 1325 PipelineMetadata metadata = pipeline_metadata_; |
| 1326 metadata.natural_size = size; |
| 1327 observer_->OnMetadataChanged(metadata); |
| 1328 } |
| 1323 } | 1329 } |
| 1324 | 1330 |
| 1325 void WebMediaPlayerImpl::OnVideoOpacityChange(bool opaque) { | 1331 void WebMediaPlayerImpl::OnVideoOpacityChange(bool opaque) { |
| 1326 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1332 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 1327 DCHECK_NE(ready_state_, WebMediaPlayer::ReadyStateHaveNothing); | 1333 DCHECK_NE(ready_state_, WebMediaPlayer::ReadyStateHaveNothing); |
| 1328 | 1334 |
| 1329 opaque_ = opaque; | 1335 opaque_ = opaque; |
| 1330 // Modify content opaqueness of cc::Layer directly so that | 1336 // Modify content opaqueness of cc::Layer directly so that |
| 1331 // SetContentsOpaqueIsFixed is ignored. | 1337 // SetContentsOpaqueIsFixed is ignored. |
| 1332 if (video_weblayer_) | 1338 if (video_weblayer_) |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2034 return pipeline_metadata_.video_rotation == VIDEO_ROTATION_0; | 2040 return pipeline_metadata_.video_rotation == VIDEO_ROTATION_0; |
| 2035 } | 2041 } |
| 2036 | 2042 |
| 2037 void WebMediaPlayerImpl::ActivateViewportIntersectionMonitoring(bool activate) { | 2043 void WebMediaPlayerImpl::ActivateViewportIntersectionMonitoring(bool activate) { |
| 2038 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 2044 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 2039 | 2045 |
| 2040 client_->activateViewportIntersectionMonitoring(activate); | 2046 client_->activateViewportIntersectionMonitoring(activate); |
| 2041 } | 2047 } |
| 2042 | 2048 |
| 2043 } // namespace media | 2049 } // namespace media |
| OLD | NEW |