| 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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 695 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 696 | 696 |
| 697 base::Optional<MediaTrack::Id> selected_video_track_id; | 697 base::Optional<MediaTrack::Id> selected_video_track_id; |
| 698 if (selectedTrackId && !video_track_disabled_) | 698 if (selectedTrackId && !video_track_disabled_) |
| 699 selected_video_track_id = MediaTrack::Id(selectedTrackId->utf8().data()); | 699 selected_video_track_id = MediaTrack::Id(selectedTrackId->utf8().data()); |
| 700 MEDIA_LOG(INFO, media_log_) << "Selected video track: [" | 700 MEDIA_LOG(INFO, media_log_) << "Selected video track: [" |
| 701 << selected_video_track_id.value_or("") << "]"; | 701 << selected_video_track_id.value_or("") << "]"; |
| 702 pipeline_controller_.OnSelectedVideoTrackChanged(selected_video_track_id); | 702 pipeline_controller_.OnSelectedVideoTrackChanged(selected_video_track_id); |
| 703 } | 703 } |
| 704 | 704 |
| 705 bool WebMediaPlayerImpl::getLastUploadedFrameInfo(unsigned* width, |
| 706 unsigned* height, |
| 707 double* timestamp) { |
| 708 *width = last_uploaded_frame_size_.width(); |
| 709 *height = last_uploaded_frame_size_.height(); |
| 710 *timestamp = last_uploaded_frame_timestamp_.InSecondsF(); |
| 711 return true; |
| 712 } |
| 713 |
| 705 blink::WebSize WebMediaPlayerImpl::naturalSize() const { | 714 blink::WebSize WebMediaPlayerImpl::naturalSize() const { |
| 706 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 715 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 707 | 716 |
| 708 return blink::WebSize(pipeline_metadata_.natural_size); | 717 return blink::WebSize(pipeline_metadata_.natural_size); |
| 709 } | 718 } |
| 710 | 719 |
| 711 bool WebMediaPlayerImpl::paused() const { | 720 bool WebMediaPlayerImpl::paused() const { |
| 712 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 721 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 713 | 722 |
| 714 #if defined(OS_ANDROID) // WMPI_CAST | 723 #if defined(OS_ANDROID) // WMPI_CAST |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1834 // Use a posted task and waitable event instead of a lock otherwise | 1843 // Use a posted task and waitable event instead of a lock otherwise |
| 1835 // WebGL/Canvas can see different content than what the compositor is seeing. | 1844 // WebGL/Canvas can see different content than what the compositor is seeing. |
| 1836 scoped_refptr<VideoFrame> video_frame; | 1845 scoped_refptr<VideoFrame> video_frame; |
| 1837 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 1846 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 1838 base::WaitableEvent::InitialState::NOT_SIGNALED); | 1847 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 1839 compositor_task_runner_->PostTask( | 1848 compositor_task_runner_->PostTask( |
| 1840 FROM_HERE, | 1849 FROM_HERE, |
| 1841 base::Bind(&GetCurrentFrameAndSignal, base::Unretained(compositor_), | 1850 base::Bind(&GetCurrentFrameAndSignal, base::Unretained(compositor_), |
| 1842 &video_frame, &event)); | 1851 &video_frame, &event)); |
| 1843 event.Wait(); | 1852 event.Wait(); |
| 1853 |
| 1854 last_uploaded_frame_size_ = video_frame->natural_size(); |
| 1855 last_uploaded_frame_timestamp_ = video_frame->timestamp(); |
| 1844 return video_frame; | 1856 return video_frame; |
| 1845 } | 1857 } |
| 1846 | 1858 |
| 1847 void WebMediaPlayerImpl::UpdatePlayState() { | 1859 void WebMediaPlayerImpl::UpdatePlayState() { |
| 1848 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1860 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 1849 | 1861 |
| 1850 #if defined(OS_ANDROID) // WMPI_CAST | 1862 #if defined(OS_ANDROID) // WMPI_CAST |
| 1851 bool is_remote = isRemote(); | 1863 bool is_remote = isRemote(); |
| 1852 bool can_auto_suspend = true; | 1864 bool can_auto_suspend = true; |
| 1853 #else | 1865 #else |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2320 | 2332 |
| 2321 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { | 2333 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { |
| 2322 DCHECK(data_source_ || chunk_demuxer_); | 2334 DCHECK(data_source_ || chunk_demuxer_); |
| 2323 if (data_source_) | 2335 if (data_source_) |
| 2324 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); | 2336 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); |
| 2325 else | 2337 else |
| 2326 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); | 2338 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); |
| 2327 } | 2339 } |
| 2328 | 2340 |
| 2329 } // namespace media | 2341 } // namespace media |
| OLD | NEW |