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

Side by Side Diff: webkit/media/webmediaplayer_util.cc

Issue 10073016: Upstream WebMediaPlayerAndroid as WebKit::WebMediaPlayer implementation on android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: small changes to address comments Created 8 years, 8 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/media/webmediaplayer_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "webkit/media/webmediaplayer_util.h"
6
7 #include <math.h>
8
9 namespace webkit_media {
10
11 base::TimeDelta ConvertSecondsToTimestamp(float seconds) {
12 float microseconds = seconds * base::Time::kMicrosecondsPerSecond;
13 float integer = ceilf(microseconds);
14 float difference = integer - microseconds;
15
16 // Round down if difference is large enough.
17 if ((microseconds > 0 && difference > 0.5f) ||
18 (microseconds <= 0 && difference >= 0.5f)) {
19 integer -= 1.0f;
20 }
21
22 // Now we can safely cast to int64 microseconds.
23 return base::TimeDelta::FromMicroseconds(static_cast<int64>(integer));
24 }
25
26 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/webmediaplayer_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698