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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 return blink::WebString::fromUTF8(media_log_->GetLastErrorMessage()); | 680 return blink::WebString::fromUTF8(media_log_->GetLastErrorMessage()); |
681 } | 681 } |
682 | 682 |
683 blink::WebTimeRanges WebMediaPlayerImpl::buffered() const { | 683 blink::WebTimeRanges WebMediaPlayerImpl::buffered() const { |
684 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 684 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
685 | 685 |
686 Ranges<base::TimeDelta> buffered_time_ranges = | 686 Ranges<base::TimeDelta> buffered_time_ranges = |
687 pipeline_.GetBufferedTimeRanges(); | 687 pipeline_.GetBufferedTimeRanges(); |
688 | 688 |
689 const base::TimeDelta duration = pipeline_.GetMediaDuration(); | 689 const base::TimeDelta duration = pipeline_.GetMediaDuration(); |
690 if (duration != kInfiniteDuration()) { | 690 if (duration != kInfiniteDuration) { |
691 buffered_data_source_host_.AddBufferedTimeRanges( | 691 buffered_data_source_host_.AddBufferedTimeRanges( |
692 &buffered_time_ranges, duration); | 692 &buffered_time_ranges, duration); |
693 } | 693 } |
694 return ConvertToWebTimeRanges(buffered_time_ranges); | 694 return ConvertToWebTimeRanges(buffered_time_ranges); |
695 } | 695 } |
696 | 696 |
697 blink::WebTimeRanges WebMediaPlayerImpl::seekable() const { | 697 blink::WebTimeRanges WebMediaPlayerImpl::seekable() const { |
698 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 698 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
699 | 699 |
700 if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata) | 700 if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata) |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 | 1417 |
1418 blink::WebAudioSourceProvider* WebMediaPlayerImpl::getAudioSourceProvider() { | 1418 blink::WebAudioSourceProvider* WebMediaPlayerImpl::getAudioSourceProvider() { |
1419 return audio_source_provider_.get(); | 1419 return audio_source_provider_.get(); |
1420 } | 1420 } |
1421 | 1421 |
1422 double WebMediaPlayerImpl::GetPipelineDuration() const { | 1422 double WebMediaPlayerImpl::GetPipelineDuration() const { |
1423 base::TimeDelta duration = pipeline_.GetMediaDuration(); | 1423 base::TimeDelta duration = pipeline_.GetMediaDuration(); |
1424 | 1424 |
1425 // Return positive infinity if the resource is unbounded. | 1425 // Return positive infinity if the resource is unbounded. |
1426 // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-
media-duration | 1426 // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-
media-duration |
1427 if (duration == kInfiniteDuration()) | 1427 if (duration == kInfiniteDuration) |
1428 return std::numeric_limits<double>::infinity(); | 1428 return std::numeric_limits<double>::infinity(); |
1429 | 1429 |
1430 return duration.InSecondsF(); | 1430 return duration.InSecondsF(); |
1431 } | 1431 } |
1432 | 1432 |
1433 static void GetCurrentFrameAndSignal( | 1433 static void GetCurrentFrameAndSignal( |
1434 VideoFrameCompositor* compositor, | 1434 VideoFrameCompositor* compositor, |
1435 scoped_refptr<VideoFrame>* video_frame_out, | 1435 scoped_refptr<VideoFrame>* video_frame_out, |
1436 base::WaitableEvent* event) { | 1436 base::WaitableEvent* event) { |
1437 TRACE_EVENT0("media", "GetCurrentFrameAndSignal"); | 1437 TRACE_EVENT0("media", "GetCurrentFrameAndSignal"); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 if (isRemote()) | 1698 if (isRemote()) |
1699 return; | 1699 return; |
1700 #endif | 1700 #endif |
1701 | 1701 |
1702 // Idle timeout chosen arbitrarily. | 1702 // Idle timeout chosen arbitrarily. |
1703 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), | 1703 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), |
1704 this, &WebMediaPlayerImpl::OnPause); | 1704 this, &WebMediaPlayerImpl::OnPause); |
1705 } | 1705 } |
1706 | 1706 |
1707 } // namespace media | 1707 } // namespace media |
OLD | NEW |