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/webmediaplayer_util.h" | 5 #include "content/renderer/media/webmediaplayer_util.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "media/base/media_keys.h" | 9 #include "media/base/media_keys.h" |
10 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 10 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 | 24 |
25 base::TimeDelta ConvertSecondsToTimestamp(double seconds) { | 25 base::TimeDelta ConvertSecondsToTimestamp(double seconds) { |
26 double microseconds = seconds * base::Time::kMicrosecondsPerSecond; | 26 double microseconds = seconds * base::Time::kMicrosecondsPerSecond; |
27 return base::TimeDelta::FromMicroseconds( | 27 return base::TimeDelta::FromMicroseconds( |
28 microseconds > 0 ? microseconds + 0.5 : ceil(microseconds - 0.5)); | 28 microseconds > 0 ? microseconds + 0.5 : ceil(microseconds - 0.5)); |
29 } | 29 } |
30 | 30 |
31 blink::WebTimeRanges ConvertToWebTimeRanges( | 31 blink::WebTimeRanges ConvertToWebTimeRanges( |
32 const media::Ranges<base::TimeDelta>& ranges) { | 32 const media::Ranges<base::TimeDelta>& ranges) { |
33 blink::WebTimeRanges result(ranges.size()); | 33 blink::WebTimeRanges result(ranges.size()); |
34 for (size_t i = 0; i < ranges.size(); i++) { | 34 for (size_t i = 0; i < ranges.size(); ++i) { |
Ami GONE FROM CHROMIUM
2013/12/19 21:21:01
CL description says "to improve efficiency" but AF
| |
35 result[i].start = ranges.start(i).InSecondsF(); | 35 result[i].start = ranges.start(i).InSecondsF(); |
36 result[i].end = ranges.end(i).InSecondsF(); | 36 result[i].end = ranges.end(i).InSecondsF(); |
37 } | 37 } |
38 return result; | 38 return result; |
39 } | 39 } |
40 | 40 |
41 blink::WebMediaPlayer::NetworkState PipelineErrorToNetworkState( | 41 blink::WebMediaPlayer::NetworkState PipelineErrorToNetworkState( |
42 media::PipelineStatus error) { | 42 media::PipelineStatus error) { |
43 DCHECK_NE(error, media::PIPELINE_OK); | 43 DCHECK_NE(error, media::PIPELINE_OK); |
44 | 44 |
(...skipping 26 matching lines...) Expand all Loading... | |
71 return blink::WebMediaPlayer::NetworkStateDecodeError; | 71 return blink::WebMediaPlayer::NetworkStateDecodeError; |
72 | 72 |
73 case media::PIPELINE_OK: | 73 case media::PIPELINE_OK: |
74 case media::PIPELINE_STATUS_MAX: | 74 case media::PIPELINE_STATUS_MAX: |
75 NOTREACHED() << "Unexpected status! " << error; | 75 NOTREACHED() << "Unexpected status! " << error; |
76 } | 76 } |
77 return blink::WebMediaPlayer::NetworkStateFormatError; | 77 return blink::WebMediaPlayer::NetworkStateFormatError; |
78 } | 78 } |
79 | 79 |
80 } // namespace content | 80 } // namespace content |
OLD | NEW |