| 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 "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 bool WebMediaPlayerAndroid::paused() const { | 534 bool WebMediaPlayerAndroid::paused() const { |
| 535 return !is_playing_; | 535 return !is_playing_; |
| 536 } | 536 } |
| 537 | 537 |
| 538 bool WebMediaPlayerAndroid::seeking() const { | 538 bool WebMediaPlayerAndroid::seeking() const { |
| 539 return seeking_; | 539 return seeking_; |
| 540 } | 540 } |
| 541 | 541 |
| 542 double WebMediaPlayerAndroid::duration() const { | 542 double WebMediaPlayerAndroid::duration() const { |
| 543 DCHECK(main_thread_checker_.CalledOnValidThread()); | 543 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 544 if (duration_ == media::kInfiniteDuration()) | 544 if (duration_ == media::kInfiniteDuration) |
| 545 return std::numeric_limits<double>::infinity(); | 545 return std::numeric_limits<double>::infinity(); |
| 546 | 546 |
| 547 return duration_.InSecondsF(); | 547 return duration_.InSecondsF(); |
| 548 } | 548 } |
| 549 | 549 |
| 550 double WebMediaPlayerAndroid::timelineOffset() const { | 550 double WebMediaPlayerAndroid::timelineOffset() const { |
| 551 DCHECK(main_thread_checker_.CalledOnValidThread()); | 551 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 552 base::Time timeline_offset; | 552 base::Time timeline_offset; |
| 553 if (media_source_delegate_) | 553 if (media_source_delegate_) |
| 554 timeline_offset = media_source_delegate_->GetTimelineOffset(); | 554 timeline_offset = media_source_delegate_->GetTimelineOffset(); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 base::TimeDelta duration, int width, int height, bool success) { | 797 base::TimeDelta duration, int width, int height, bool success) { |
| 798 DCHECK(main_thread_checker_.CalledOnValidThread()); | 798 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 799 bool need_to_signal_duration_changed = false; | 799 bool need_to_signal_duration_changed = false; |
| 800 | 800 |
| 801 if (is_local_resource_) | 801 if (is_local_resource_) |
| 802 UpdateNetworkState(WebMediaPlayer::NetworkStateLoaded); | 802 UpdateNetworkState(WebMediaPlayer::NetworkStateLoaded); |
| 803 | 803 |
| 804 // For HLS streams, the reported duration may be zero for infinite streams. | 804 // For HLS streams, the reported duration may be zero for infinite streams. |
| 805 // See http://crbug.com/501213. | 805 // See http://crbug.com/501213. |
| 806 if (duration.is_zero() && IsHLSStream()) | 806 if (duration.is_zero() && IsHLSStream()) |
| 807 duration = media::kInfiniteDuration(); | 807 duration = media::kInfiniteDuration; |
| 808 | 808 |
| 809 // Update duration, if necessary, prior to ready state updates that may | 809 // Update duration, if necessary, prior to ready state updates that may |
| 810 // cause duration() query. | 810 // cause duration() query. |
| 811 if (!ignore_metadata_duration_change_ && duration_ != duration) { | 811 if (!ignore_metadata_duration_change_ && duration_ != duration) { |
| 812 duration_ = duration; | 812 duration_ = duration; |
| 813 if (is_local_resource_) | 813 if (is_local_resource_) |
| 814 buffered_[0].end = duration_.InSecondsF(); | 814 buffered_[0].end = duration_.InSecondsF(); |
| 815 // Client readyState transition from HAVE_NOTHING to HAVE_METADATA | 815 // Client readyState transition from HAVE_NOTHING to HAVE_METADATA |
| 816 // already triggers a durationchanged event. If this is a different | 816 // already triggers a durationchanged event. If this is a different |
| 817 // transition, remember to signal durationchanged. | 817 // transition, remember to signal durationchanged. |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1662 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; | 1662 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; |
| 1663 } else if (is_hls_url == is_hls) { | 1663 } else if (is_hls_url == is_hls) { |
| 1664 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; | 1664 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; |
| 1665 } | 1665 } |
| 1666 UMA_HISTOGRAM_ENUMERATION( | 1666 UMA_HISTOGRAM_ENUMERATION( |
| 1667 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", | 1667 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", |
| 1668 result, PREDICTION_RESULT_MAX); | 1668 result, PREDICTION_RESULT_MAX); |
| 1669 } | 1669 } |
| 1670 | 1670 |
| 1671 } // namespace content | 1671 } // namespace content |
| OLD | NEW |