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 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 | 1097 |
1098 void WebMediaPlayerImpl::OnEnded() { | 1098 void WebMediaPlayerImpl::OnEnded() { |
1099 DVLOG(1) << __func__; | 1099 DVLOG(1) << __func__; |
1100 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1100 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
1101 | 1101 |
1102 // Ignore state changes until we've completed all outstanding operations. | 1102 // Ignore state changes until we've completed all outstanding operations. |
1103 if (!pipeline_controller_.IsStable()) | 1103 if (!pipeline_controller_.IsStable()) |
1104 return; | 1104 return; |
1105 | 1105 |
1106 ended_ = true; | 1106 ended_ = true; |
1107 client_->timeChanged(); | 1107 client_->timeChanged(ended_); |
1108 | 1108 |
1109 // We don't actually want this to run until |client_| calls seek() or pause(), | 1109 // We don't actually want this to run until |client_| calls seek() or pause(), |
1110 // but that should have already happened in timeChanged() and so this is | 1110 // but that should have already happened in timeChanged() and so this is |
1111 // expected to be a no-op. | 1111 // expected to be a no-op. |
1112 UpdatePlayState(); | 1112 UpdatePlayState(); |
1113 } | 1113 } |
1114 | 1114 |
1115 void WebMediaPlayerImpl::OnMetadata(PipelineMetadata metadata) { | 1115 void WebMediaPlayerImpl::OnMetadata(PipelineMetadata metadata) { |
1116 DVLOG(1) << __func__; | 1116 DVLOG(1) << __func__; |
1117 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1117 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 // transition to HAVE_FUTURE_DATA here if not enough is buffered. | 1167 // transition to HAVE_FUTURE_DATA here if not enough is buffered. |
1168 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); | 1168 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); |
1169 | 1169 |
1170 // Let the DataSource know we have enough data. It may use this information | 1170 // Let the DataSource know we have enough data. It may use this information |
1171 // to release unused network connections. | 1171 // to release unused network connections. |
1172 if (data_source_) | 1172 if (data_source_) |
1173 data_source_->OnBufferingHaveEnough(false); | 1173 data_source_->OnBufferingHaveEnough(false); |
1174 | 1174 |
1175 // Blink expects a timeChanged() in response to a seek(). | 1175 // Blink expects a timeChanged() in response to a seek(). |
1176 if (should_notify_time_changed_) | 1176 if (should_notify_time_changed_) |
1177 client_->timeChanged(); | 1177 client_->timeChanged(ended_); |
1178 | 1178 |
1179 // Once we have enough, start reporting the total memory usage. We'll also | 1179 // Once we have enough, start reporting the total memory usage. We'll also |
1180 // report once playback starts. | 1180 // report once playback starts. |
1181 ReportMemoryUsage(); | 1181 ReportMemoryUsage(); |
1182 | 1182 |
1183 // Report the amount of time it took to leave the underflow state. Don't | 1183 // Report the amount of time it took to leave the underflow state. Don't |
1184 // bother to report this for MSE playbacks since it's out of our control. | 1184 // bother to report this for MSE playbacks since it's out of our control. |
1185 if (underflow_timer_ && data_source_) { | 1185 if (underflow_timer_ && data_source_) { |
1186 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", | 1186 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", |
1187 underflow_timer_->Elapsed()); | 1187 underflow_timer_->Elapsed()); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 | 1357 |
1358 void WebMediaPlayerImpl::requestRemotePlaybackControl() { | 1358 void WebMediaPlayerImpl::requestRemotePlaybackControl() { |
1359 cast_impl_.requestRemotePlaybackControl(); | 1359 cast_impl_.requestRemotePlaybackControl(); |
1360 } | 1360 } |
1361 | 1361 |
1362 void WebMediaPlayerImpl::OnRemotePlaybackEnded() { | 1362 void WebMediaPlayerImpl::OnRemotePlaybackEnded() { |
1363 DVLOG(1) << __func__; | 1363 DVLOG(1) << __func__; |
1364 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1364 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
1365 | 1365 |
1366 ended_ = true; | 1366 ended_ = true; |
1367 client_->timeChanged(); | 1367 client_->timeChanged(ended_); |
1368 } | 1368 } |
1369 | 1369 |
1370 void WebMediaPlayerImpl::OnDisconnectedFromRemoteDevice(double t) { | 1370 void WebMediaPlayerImpl::OnDisconnectedFromRemoteDevice(double t) { |
1371 DoSeek(base::TimeDelta::FromSecondsD(t), false); | 1371 DoSeek(base::TimeDelta::FromSecondsD(t), false); |
1372 | 1372 |
1373 // We already told the delegate we're paused when remoting started. | 1373 // We already told the delegate we're paused when remoting started. |
1374 client_->playbackStateChanged(); | 1374 client_->playbackStateChanged(); |
1375 client_->disconnectedFromRemoteDevice(); | 1375 client_->disconnectedFromRemoteDevice(); |
1376 | 1376 |
1377 UpdatePlayState(); | 1377 UpdatePlayState(); |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 pipeline_metadata_.natural_size, | 1884 pipeline_metadata_.natural_size, |
1885 base::Bind(&GetCurrentTimeInternal, this))); | 1885 base::Bind(&GetCurrentTimeInternal, this))); |
1886 watch_time_reporter_->OnVolumeChange(volume_); | 1886 watch_time_reporter_->OnVolumeChange(volume_); |
1887 if (delegate_ && delegate_->IsHidden()) | 1887 if (delegate_ && delegate_->IsHidden()) |
1888 watch_time_reporter_->OnHidden(); | 1888 watch_time_reporter_->OnHidden(); |
1889 else | 1889 else |
1890 watch_time_reporter_->OnShown(); | 1890 watch_time_reporter_->OnShown(); |
1891 } | 1891 } |
1892 | 1892 |
1893 } // namespace media | 1893 } // namespace media |
OLD | NEW |