diff options
-rw-r--r-- | webkit/media/android/webmediaplayer_android.cc | 18 | ||||
-rw-r--r-- | webkit/media/android/webmediaplayer_android.h | 20 | ||||
-rw-r--r-- | webkit/media/android/webmediaplayer_impl_android.cc | 4 | ||||
-rw-r--r-- | webkit/media/android/webmediaplayer_impl_android.h | 4 | ||||
-rw-r--r-- | webkit/media/webmediaplayer_impl.cc | 82 | ||||
-rw-r--r-- | webkit/media/webmediaplayer_impl.h | 20 | ||||
-rw-r--r-- | webkit/media/webmediaplayer_ms.cc | 22 | ||||
-rw-r--r-- | webkit/media/webmediaplayer_ms.h | 16 | ||||
-rw-r--r-- | webkit/media/webmediaplayer_util.cc | 17 | ||||
-rw-r--r-- | webkit/media/webmediaplayer_util.h | 2 | ||||
-rw-r--r-- | webkit/media/webmediasourceclient_impl.cc | 17 |
11 files changed, 104 insertions, 118 deletions
diff --git a/webkit/media/android/webmediaplayer_android.cc b/webkit/media/android/webmediaplayer_android.cc index 7c52472..5a03822 100644 --- a/webkit/media/android/webmediaplayer_android.cc +++ b/webkit/media/android/webmediaplayer_android.cc @@ -114,7 +114,7 @@ void WebMediaPlayerAndroid::seekFloat(float seconds) { seek(seconds); } -void WebMediaPlayerAndroid::seek(float seconds) { +void WebMediaPlayerAndroid::seek(double seconds) { pending_seek_ = seconds; seeking_ = true; @@ -133,7 +133,7 @@ void WebMediaPlayerAndroid::setEndTimeFloat(float seconds) { setEndTime(seconds); } -void WebMediaPlayerAndroid::setEndTime(float seconds) { +void WebMediaPlayerAndroid::setEndTime(double seconds) { // Deprecated. // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. } @@ -142,7 +142,7 @@ void WebMediaPlayerAndroid::setRateFloat(float rate) { setRate(rate); } -void WebMediaPlayerAndroid::setRate(float rate) { +void WebMediaPlayerAndroid::setRate(double rate) { NOTIMPLEMENTED(); } @@ -150,7 +150,7 @@ void WebMediaPlayerAndroid::setVolumeFloat(float volume) { setVolume(volume); } -void WebMediaPlayerAndroid::setVolume(float volume) { +void WebMediaPlayerAndroid::setVolume(double volume) { NOTIMPLEMENTED(); } @@ -202,15 +202,15 @@ float WebMediaPlayerAndroid::durationFloat() const { return duration(); } -float WebMediaPlayerAndroid::duration() const { - return static_cast<float>(duration_.InSecondsF()); +double WebMediaPlayerAndroid::duration() const { + return duration_.InSecondsF(); } float WebMediaPlayerAndroid::currentTimeFloat() const { return currentTime(); } -float WebMediaPlayerAndroid::currentTime() const { +double WebMediaPlayerAndroid::currentTime() const { // If the player is pending for a seek, return the seek time. if (seeking()) return pending_seek_; @@ -244,7 +244,7 @@ float WebMediaPlayerAndroid::maxTimeSeekableFloat() const { return maxTimeSeekable(); } -float WebMediaPlayerAndroid::maxTimeSeekable() const { +double WebMediaPlayerAndroid::maxTimeSeekable() const { // TODO(hclam): If this stream is not seekable this should return 0. return duration(); } @@ -288,7 +288,7 @@ float WebMediaPlayerAndroid::mediaTimeForTimeValueFloat(float timeValue) const { return mediaTimeForTimeValue(timeValue); } -float WebMediaPlayerAndroid::mediaTimeForTimeValue(float timeValue) const { +double WebMediaPlayerAndroid::mediaTimeForTimeValue(double timeValue) const { return ConvertSecondsToTimestamp(timeValue).InSecondsF(); } diff --git a/webkit/media/android/webmediaplayer_android.h b/webkit/media/android/webmediaplayer_android.h index 79fa6b8..371513c 100644 --- a/webkit/media/android/webmediaplayer_android.h +++ b/webkit/media/android/webmediaplayer_android.h @@ -44,20 +44,20 @@ class WebMediaPlayerAndroid virtual void play(); virtual void pause(); virtual void seekFloat(float seconds); - virtual void seek(float seconds); + virtual void seek(double seconds); virtual bool supportsFullscreen() const; virtual bool supportsSave() const; virtual void setEndTimeFloat(float seconds); - virtual void setEndTime(float seconds); + virtual void setEndTime(double seconds); virtual void setRateFloat(float rate); - virtual void setRate(float rate); + virtual void setRate(double rate); virtual void setVolumeFloat(float volume); - virtual void setVolume(float volume); + virtual void setVolume(double volume); virtual void setVisible(bool visible); virtual bool totalBytesKnown(); virtual const WebKit::WebTimeRanges& buffered(); virtual float maxTimeSeekableFloat() const; - virtual float maxTimeSeekable() const; + virtual double maxTimeSeekable() const; // Methods for painting. virtual void setSize(const WebKit::WebSize& size); @@ -76,9 +76,9 @@ class WebMediaPlayerAndroid virtual bool paused() const; virtual bool seeking() const; virtual float durationFloat() const; - virtual float duration() const; + virtual double duration() const; virtual float currentTimeFloat() const; - virtual float currentTime() const; + virtual double currentTime() const; // Get rate of loading the resource. virtual int32 dataRate() const; @@ -95,7 +95,7 @@ class WebMediaPlayerAndroid virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const; virtual float mediaTimeForTimeValueFloat(float timeValue) const; - virtual float mediaTimeForTimeValue(float timeValue) const; + virtual double mediaTimeForTimeValue(double timeValue) const; // Provide statistics. virtual unsigned decodedFrameCount() const; @@ -176,7 +176,7 @@ class WebMediaPlayerAndroid virtual void SeekInternal(base::TimeDelta time) = 0; // Get the current time from the media player. - virtual float GetCurrentTimeInternal() const = 0; + virtual double GetCurrentTimeInternal() const = 0; // Release the Android Media player. virtual void ReleaseResourcesInternal() = 0; @@ -217,7 +217,7 @@ class WebMediaPlayerAndroid base::TimeDelta duration_; // The time android media player is trying to seek. - float pending_seek_; + double pending_seek_; // Internal seek state. bool seeking_; diff --git a/webkit/media/android/webmediaplayer_impl_android.cc b/webkit/media/android/webmediaplayer_impl_android.cc index d2ee78d..083edd7 100644 --- a/webkit/media/android/webmediaplayer_impl_android.cc +++ b/webkit/media/android/webmediaplayer_impl_android.cc @@ -81,7 +81,7 @@ void WebMediaPlayerImplAndroid::SeekInternal(base::TimeDelta time) { proxy_->Seek(player_id(), time); } -float WebMediaPlayerImplAndroid::GetCurrentTimeInternal() const { +double WebMediaPlayerImplAndroid::GetCurrentTimeInternal() const { return current_time_; } @@ -91,7 +91,7 @@ void WebMediaPlayerImplAndroid::ReleaseResourcesInternal() { } void WebMediaPlayerImplAndroid::OnTimeUpdate(base::TimeDelta current_time) { - current_time_ = static_cast<float>(current_time.InSecondsF()); + current_time_ = current_time.InSecondsF(); } void WebMediaPlayerImplAndroid::OnDidEnterFullscreen() { diff --git a/webkit/media/android/webmediaplayer_impl_android.h b/webkit/media/android/webmediaplayer_impl_android.h index 27a5f47..aef6db4 100644 --- a/webkit/media/android/webmediaplayer_impl_android.h +++ b/webkit/media/android/webmediaplayer_impl_android.h @@ -65,7 +65,7 @@ class WebMediaPlayerImplAndroid : public WebMediaPlayerAndroid { virtual void PlayInternal() OVERRIDE; virtual void PauseInternal() OVERRIDE; virtual void SeekInternal(base::TimeDelta time) OVERRIDE; - virtual float GetCurrentTimeInternal() const OVERRIDE; + virtual double GetCurrentTimeInternal() const OVERRIDE; virtual void ReleaseResourcesInternal() OVERRIDE; virtual void Destroy() OVERRIDE; virtual void RequestExternalSurface() OVERRIDE; @@ -80,7 +80,7 @@ class WebMediaPlayerImplAndroid : public WebMediaPlayerAndroid { // The current playing time. Because the mediaplayer is in the browser // process, it will regularly update the |current_time_| by calling // OnTimeUpdate(). - float current_time_; + double current_time_; DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImplAndroid); }; diff --git a/webkit/media/webmediaplayer_impl.cc b/webkit/media/webmediaplayer_impl.cc index 6c3612b..4c47acd 100644 --- a/webkit/media/webmediaplayer_impl.cc +++ b/webkit/media/webmediaplayer_impl.cc @@ -81,8 +81,8 @@ const int kPlayerExtraMemory = 1024 * 1024; // Also our timers are not very accurate (especially for ogg), which becomes // evident at low speeds and on Vista. Since other speeds are risky and outside // the norms, we think 1/16x to 16x is a safe and useful range for now. -const float kMinRate = 0.0625f; -const float kMaxRate = 16.0f; +const double kMinRate = 0.0625; +const double kMaxRate = 16.0; // Prefix for histograms related to Encrypted Media Extensions. const char* kMediaEme = "Media.EME."; @@ -375,7 +375,7 @@ void WebMediaPlayerImpl::seekFloat(float seconds) { seek(seconds); } -void WebMediaPlayerImpl::seek(float seconds) { +void WebMediaPlayerImpl::seek(double seconds) { DCHECK(main_loop_->BelongsToCurrentThread()); if (starting_ || seeking_) { @@ -409,7 +409,7 @@ void WebMediaPlayerImpl::setEndTimeFloat(float seconds) { setEndTime(seconds); } -void WebMediaPlayerImpl::setEndTime(float seconds) { +void WebMediaPlayerImpl::setEndTime(double seconds) { DCHECK(main_loop_->BelongsToCurrentThread()); // TODO(hclam): add method call when it has been implemented. @@ -420,16 +420,16 @@ void WebMediaPlayerImpl::setRateFloat(float rate) { setRate(rate); } -void WebMediaPlayerImpl::setRate(float rate) { +void WebMediaPlayerImpl::setRate(double rate) { DCHECK(main_loop_->BelongsToCurrentThread()); // TODO(kylep): Remove when support for negatives is added. Also, modify the // following checks so rewind uses reasonable values also. - if (rate < 0.0f) + if (rate < 0.0) return; // Limit rates to reasonable values by clamping. - if (rate != 0.0f) { + if (rate != 0.0) { if (rate < kMinRate) rate = kMinRate; else if (rate > kMaxRate) @@ -446,7 +446,7 @@ void WebMediaPlayerImpl::setVolumeFloat(float volume) { setVolume(volume); } -void WebMediaPlayerImpl::setVolume(float volume) { +void WebMediaPlayerImpl::setVolume(double volume) { DCHECK(main_loop_->BelongsToCurrentThread()); pipeline_->SetVolume(volume); @@ -517,21 +517,10 @@ bool WebMediaPlayerImpl::seeking() const { } float WebMediaPlayerImpl::durationFloat() const { - return duration(); -} - -float WebMediaPlayerImpl::duration() const { - DCHECK(main_loop_->BelongsToCurrentThread()); - if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) return std::numeric_limits<float>::quiet_NaN(); - double duration; - if (chunk_demuxer_) { - duration = chunk_demuxer_->GetDuration(); - } else { - duration = GetPipelineDuration(); - } + double result = duration(); // Make sure super small durations don't get truncated to 0 and // large durations don't get converted to infinity by the double -> float @@ -539,25 +528,36 @@ float WebMediaPlayerImpl::duration() const { // // TODO(acolwell): Remove when WebKit is changed to report duration as a // double. - if (duration > 0.0 && duration < std::numeric_limits<double>::infinity()) { - duration = std::max(duration, - static_cast<double>(std::numeric_limits<float>::min())); - duration = std::min(duration, - static_cast<double>(std::numeric_limits<float>::max())); + if (result > 0.0 && result < std::numeric_limits<double>::infinity()) { + result = std::max(result, + static_cast<double>(std::numeric_limits<float>::min())); + result = std::min(result, + static_cast<double>(std::numeric_limits<float>::max())); } - return static_cast<float>(duration); + return static_cast<float>(result); + +} + +double WebMediaPlayerImpl::duration() const { + DCHECK(main_loop_->BelongsToCurrentThread()); + + if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) + return std::numeric_limits<double>::quiet_NaN(); + + if (chunk_demuxer_) + return chunk_demuxer_->GetDuration(); + + return GetPipelineDuration(); } float WebMediaPlayerImpl::currentTimeFloat() const { - return currentTime(); + return static_cast<float>(currentTime()); } -float WebMediaPlayerImpl::currentTime() const { +double WebMediaPlayerImpl::currentTime() const { DCHECK(main_loop_->BelongsToCurrentThread()); - if (paused_) - return static_cast<float>(paused_time_.InSecondsF()); - return static_cast<float>(pipeline_->GetMediaTime().InSecondsF()); + return (paused_ ? paused_time_ : pipeline_->GetMediaTime()).InSecondsF(); } int WebMediaPlayerImpl::dataRate() const { @@ -586,10 +586,6 @@ const WebKit::WebTimeRanges& WebMediaPlayerImpl::buffered() { } float WebMediaPlayerImpl::maxTimeSeekableFloat() const { - return maxTimeSeekable(); -} - -float WebMediaPlayerImpl::maxTimeSeekable() const { DCHECK(main_loop_->BelongsToCurrentThread()); // If we haven't even gotten to ReadyStateHaveMetadata yet then just @@ -600,6 +596,20 @@ float WebMediaPlayerImpl::maxTimeSeekable() const { // We don't support seeking in streaming media. if (data_source_ && data_source_->IsStreaming()) return 0.0f; + return durationFloat(); +} + +double WebMediaPlayerImpl::maxTimeSeekable() const { + DCHECK(main_loop_->BelongsToCurrentThread()); + + // If we haven't even gotten to ReadyStateHaveMetadata yet then just + // return 0 so that the seekable range is empty. + if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata) + return 0.0; + + // We don't support seeking in streaming media. + if (data_source_ && data_source_->IsStreaming()) + return 0.0; return duration(); } @@ -671,7 +681,7 @@ float WebMediaPlayerImpl::mediaTimeForTimeValueFloat(float timeValue) const { return mediaTimeForTimeValue(timeValue); } -float WebMediaPlayerImpl::mediaTimeForTimeValue(float timeValue) const { +double WebMediaPlayerImpl::mediaTimeForTimeValue(double timeValue) const { return ConvertSecondsToTimestamp(timeValue).InSecondsF(); } diff --git a/webkit/media/webmediaplayer_impl.h b/webkit/media/webmediaplayer_impl.h index 591272e..f733e6f 100644 --- a/webkit/media/webmediaplayer_impl.h +++ b/webkit/media/webmediaplayer_impl.h @@ -96,19 +96,19 @@ class WebMediaPlayerImpl virtual bool supportsFullscreen() const; virtual bool supportsSave() const; virtual void seekFloat(float seconds); - virtual void seek(float seconds); + virtual void seek(double seconds); virtual void setEndTimeFloat(float seconds); - virtual void setEndTime(float seconds); + virtual void setEndTime(double seconds); virtual void setRateFloat(float rate); - virtual void setRate(float rate); + virtual void setRate(double rate); virtual void setVolumeFloat(float volume); - virtual void setVolume(float volume); + virtual void setVolume(double volume); virtual void setVisible(bool visible); virtual void setPreload(WebKit::WebMediaPlayer::Preload preload); virtual bool totalBytesKnown(); virtual const WebKit::WebTimeRanges& buffered(); virtual float maxTimeSeekableFloat() const; - virtual float maxTimeSeekable() const; + virtual double maxTimeSeekable() const; // Methods for painting. virtual void setSize(const WebKit::WebSize& size); @@ -128,9 +128,9 @@ class WebMediaPlayerImpl virtual bool paused() const; virtual bool seeking() const; virtual float durationFloat() const; - virtual float duration() const; + virtual double duration() const; virtual float currentTimeFloat() const; - virtual float currentTime() const; + virtual double currentTime() const; // Get rate of loading the resource. virtual int32 dataRate() const; @@ -149,7 +149,7 @@ class WebMediaPlayerImpl virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const; virtual float mediaTimeForTimeValueFloat(float timeValue) const; - virtual float mediaTimeForTimeValue(float timeValue) const; + virtual double mediaTimeForTimeValue(double timeValue) const; virtual unsigned decodedFrameCount() const; virtual unsigned droppedFrameCount() const; @@ -307,13 +307,13 @@ class WebMediaPlayerImpl // SetPlaybackRate(0) is being executed. bool paused_; bool seeking_; - float playback_rate_; + double playback_rate_; base::TimeDelta paused_time_; // Seek gets pending if another seek is in progress. Only last pending seek // will have effect. bool pending_seek_; - float pending_seek_seconds_; + double pending_seek_seconds_; WebKit::WebMediaPlayerClient* client_; diff --git a/webkit/media/webmediaplayer_ms.cc b/webkit/media/webmediaplayer_ms.cc index 23bc638..377bbb7 100644 --- a/webkit/media/webmediaplayer_ms.cc +++ b/webkit/media/webmediaplayer_ms.cc @@ -188,7 +188,7 @@ void WebMediaPlayerMS::seekFloat(float seconds) { seek(seconds); } -void WebMediaPlayerMS::seek(float seconds) { +void WebMediaPlayerMS::seek(double seconds) { DCHECK(thread_checker_.CalledOnValidThread()); } @@ -196,7 +196,7 @@ void WebMediaPlayerMS::setEndTimeFloat(float seconds) { setEndTime(seconds); } -void WebMediaPlayerMS::setEndTime(float seconds) { +void WebMediaPlayerMS::setEndTime(double seconds) { DCHECK(thread_checker_.CalledOnValidThread()); } @@ -204,7 +204,7 @@ void WebMediaPlayerMS::setRateFloat(float rate) { setRate(rate); } -void WebMediaPlayerMS::setRate(float rate) { +void WebMediaPlayerMS::setRate(double rate) { DCHECK(thread_checker_.CalledOnValidThread()); } @@ -212,7 +212,7 @@ void WebMediaPlayerMS::setVolumeFloat(float volume) { setVolume(volume); } -void WebMediaPlayerMS::setVolume(float volume) { +void WebMediaPlayerMS::setVolume(double volume) { DCHECK(thread_checker_.CalledOnValidThread()); if (!audio_renderer_) return; @@ -267,23 +267,23 @@ float WebMediaPlayerMS::durationFloat() const { return duration(); } -float WebMediaPlayerMS::duration() const { +double WebMediaPlayerMS::duration() const { DCHECK(thread_checker_.CalledOnValidThread()); - return std::numeric_limits<float>::infinity(); + return std::numeric_limits<double>::infinity(); } float WebMediaPlayerMS::currentTimeFloat() const { return currentTime(); } -float WebMediaPlayerMS::currentTime() const { +double WebMediaPlayerMS::currentTime() const { DCHECK(thread_checker_.CalledOnValidThread()); if (current_frame_.get()) { return current_frame_->GetTimestamp().InSecondsF(); } else if (audio_renderer_) { return audio_renderer_->GetCurrentRenderTime().InSecondsF(); } - return 0.0f; + return 0.0; } int WebMediaPlayerMS::dataRate() const { @@ -312,9 +312,9 @@ float WebMediaPlayerMS::maxTimeSeekableFloat() const { return maxTimeSeekable(); } -float WebMediaPlayerMS::maxTimeSeekable() const { +double WebMediaPlayerMS::maxTimeSeekable() const { DCHECK(thread_checker_.CalledOnValidThread()); - return 0.0f; + return 0.0; } bool WebMediaPlayerMS::didLoadingProgress() const { @@ -367,7 +367,7 @@ float WebMediaPlayerMS::mediaTimeForTimeValueFloat(float timeValue) const { return mediaTimeForTimeValue(timeValue); } -float WebMediaPlayerMS::mediaTimeForTimeValue(float timeValue) const { +double WebMediaPlayerMS::mediaTimeForTimeValue(double timeValue) const { return ConvertSecondsToTimestamp(timeValue).InSecondsF(); } diff --git a/webkit/media/webmediaplayer_ms.h b/webkit/media/webmediaplayer_ms.h index 3140a52..5036db1 100644 --- a/webkit/media/webmediaplayer_ms.h +++ b/webkit/media/webmediaplayer_ms.h @@ -75,19 +75,19 @@ class WebMediaPlayerMS virtual bool supportsFullscreen() const OVERRIDE; virtual bool supportsSave() const OVERRIDE; virtual void seekFloat(float seconds); - virtual void seek(float seconds); + virtual void seek(double seconds); virtual void setEndTimeFloat(float seconds); - virtual void setEndTime(float seconds); + virtual void setEndTime(double seconds); virtual void setRateFloat(float rate); - virtual void setRate(float rate); + virtual void setRate(double rate); virtual void setVolumeFloat(float volume); - virtual void setVolume(float volume); + virtual void setVolume(double volume); virtual void setVisible(bool visible) OVERRIDE; virtual void setPreload(WebKit::WebMediaPlayer::Preload preload) OVERRIDE; virtual bool totalBytesKnown() OVERRIDE; virtual const WebKit::WebTimeRanges& buffered() OVERRIDE; virtual float maxTimeSeekableFloat() const; - virtual float maxTimeSeekable() const; + virtual double maxTimeSeekable() const; // Methods for painting. virtual void setSize(const WebKit::WebSize& size) OVERRIDE; @@ -107,9 +107,9 @@ class WebMediaPlayerMS virtual bool paused() const OVERRIDE; virtual bool seeking() const OVERRIDE; virtual float durationFloat() const; - virtual float duration() const; + virtual double duration() const; virtual float currentTimeFloat() const; - virtual float currentTime() const; + virtual double currentTime() const; // Get rate of loading the resource. virtual int32 dataRate() const OVERRIDE; @@ -126,7 +126,7 @@ class WebMediaPlayerMS virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const OVERRIDE; virtual float mediaTimeForTimeValueFloat(float timeValue) const; - virtual float mediaTimeForTimeValue(float timeValue) const; + virtual double mediaTimeForTimeValue(double timeValue) const; virtual unsigned decodedFrameCount() const OVERRIDE; virtual unsigned droppedFrameCount() const OVERRIDE; diff --git a/webkit/media/webmediaplayer_util.cc b/webkit/media/webmediaplayer_util.cc index e2d5ef8..17e603e 100644 --- a/webkit/media/webmediaplayer_util.cc +++ b/webkit/media/webmediaplayer_util.cc @@ -8,19 +8,10 @@ namespace webkit_media { -base::TimeDelta ConvertSecondsToTimestamp(float seconds) { - float microseconds = seconds * base::Time::kMicrosecondsPerSecond; - float integer = ceilf(microseconds); - float difference = integer - microseconds; - - // Round down if difference is large enough. - if ((microseconds > 0 && difference > 0.5f) || - (microseconds <= 0 && difference >= 0.5f)) { - integer -= 1.0f; - } - - // Now we can safely cast to int64 microseconds. - return base::TimeDelta::FromMicroseconds(static_cast<int64>(integer)); +base::TimeDelta ConvertSecondsToTimestamp(double seconds) { + double microseconds = seconds * base::Time::kMicrosecondsPerSecond; + return base::TimeDelta::FromMicroseconds( + microseconds > 0 ? microseconds + 0.5 : ceil(microseconds - 0.5)); } } // namespace webkit_media diff --git a/webkit/media/webmediaplayer_util.h b/webkit/media/webmediaplayer_util.h index 8225354..27888db 100644 --- a/webkit/media/webmediaplayer_util.h +++ b/webkit/media/webmediaplayer_util.h @@ -13,7 +13,7 @@ namespace webkit_media { // seconds to an int64 timestamp. // // Refer to https://bugs.webkit.org/show_bug.cgi?id=52697 for details. -base::TimeDelta ConvertSecondsToTimestamp(float seconds); +base::TimeDelta ConvertSecondsToTimestamp(double seconds); } // namespace webkit_media diff --git a/webkit/media/webmediasourceclient_impl.cc b/webkit/media/webmediasourceclient_impl.cc index a0024f6..204f0d0 100644 --- a/webkit/media/webmediasourceclient_impl.cc +++ b/webkit/media/webmediasourceclient_impl.cc @@ -53,22 +53,7 @@ WebMediaSourceClient::AddStatus WebMediaSourceClientImpl::addSourceBuffer( } double WebMediaSourceClientImpl::duration() { - double duration = demuxer_->GetDuration(); - - // Make sure super small durations don't get truncated to 0 and - // large durations don't get converted to infinity by the double -> float - // conversion. - // - // TODO(acolwell): Remove when WebKit is changed to report duration as a - // double. - if (duration > 0.0 && duration < std::numeric_limits<double>::infinity()) { - duration = std::max(duration, - static_cast<double>(std::numeric_limits<float>::min())); - duration = std::min(duration, - static_cast<double>(std::numeric_limits<float>::max())); - } - - return static_cast<float>(duration); + return demuxer_->GetDuration(); } void WebMediaSourceClientImpl::setDuration(double new_duration) { |