Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Unified Diff: webkit/media/webmediaplayer_impl.cc

Issue 8786013: Replace media::Limits struct with media::limits namespace and update documentation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix logic Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/media/audio_decoder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/media/webmediaplayer_impl.cc
diff --git a/webkit/media/webmediaplayer_impl.cc b/webkit/media/webmediaplayer_impl.cc
index e2d01e3f3a6f21968929179630ad2d36fbcfce55..a246945cd4c04d42d25ec2584757bfb25bcd1f04 100644
--- a/webkit/media/webmediaplayer_impl.cc
+++ b/webkit/media/webmediaplayer_impl.cc
@@ -498,8 +498,12 @@ float WebMediaPlayerImpl::duration() const {
DCHECK_EQ(main_loop_, MessageLoop::current());
base::TimeDelta duration = pipeline_->GetMediaDuration();
- if (duration.InMicroseconds() == media::Limits::kMaxTimeInMicroseconds)
+
+ // Return positive infinity if the resource is unbounded.
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-media-duration
+ if (duration == media::kInfiniteDuration)
return std::numeric_limits<float>::infinity();
+
return static_cast<float>(duration.InSecondsF());
}
@@ -588,10 +592,10 @@ void WebMediaPlayerImpl::paint(WebCanvas* canvas,
// Make sure we don't create a huge canvas.
// TODO(hclam): Respect the aspect ratio.
- if (scaled_width > static_cast<int>(media::Limits::kMaxCanvas))
- scaled_width = media::Limits::kMaxCanvas;
- if (scaled_height > static_cast<int>(media::Limits::kMaxCanvas))
- scaled_height = media::Limits::kMaxCanvas;
+ if (scaled_width > static_cast<int>(media::limits::kMaxCanvas))
+ scaled_width = media::limits::kMaxCanvas;
+ if (scaled_height > static_cast<int>(media::limits::kMaxCanvas))
+ scaled_height = media::limits::kMaxCanvas;
// If there is no preexisting platform canvas, or if the size has
// changed, recreate the canvas. This is to avoid recreating the bitmap
« no previous file with comments | « webkit/media/audio_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698