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 "media/blink/websourcebuffer_impl.h" | 5 #include "media/blink/websourcebuffer_impl.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include <cmath> | 9 #include <cmath> |
8 #include <limits> | 10 #include <limits> |
9 | 11 |
10 #include "base/bind.h" | 12 #include "base/bind.h" |
11 #include "base/callback.h" | 13 #include "base/callback.h" |
12 #include "base/callback_helpers.h" | 14 #include "base/callback_helpers.h" |
13 #include "media/base/timestamp_constants.h" | 15 #include "media/base/timestamp_constants.h" |
14 #include "media/filters/chunk_demuxer.h" | 16 #include "media/filters/chunk_demuxer.h" |
15 #include "third_party/WebKit/public/platform/WebSourceBufferClient.h" | 17 #include "third_party/WebKit/public/platform/WebSourceBufferClient.h" |
16 | 18 |
17 namespace media { | 19 namespace media { |
18 | 20 |
19 static base::TimeDelta DoubleToTimeDelta(double time) { | 21 static base::TimeDelta DoubleToTimeDelta(double time) { |
20 DCHECK(!std::isnan(time)); | 22 DCHECK(!std::isnan(time)); |
21 DCHECK_NE(time, -std::numeric_limits<double>::infinity()); | 23 DCHECK_NE(time, -std::numeric_limits<double>::infinity()); |
22 | 24 |
23 if (time == std::numeric_limits<double>::infinity()) | 25 if (time == std::numeric_limits<double>::infinity()) |
24 return kInfiniteDuration(); | 26 return kInfiniteDuration(); |
25 | 27 |
26 // Don't use base::TimeDelta::Max() here, as we want the largest finite time | 28 // Don't use base::TimeDelta::Max() here, as we want the largest finite time |
27 // delta. | 29 // delta. |
28 base::TimeDelta max_time = base::TimeDelta::FromInternalValue(kint64max - 1); | 30 base::TimeDelta max_time = base::TimeDelta::FromInternalValue( |
| 31 std::numeric_limits<int64_t>::max() - 1); |
29 double max_time_in_seconds = max_time.InSecondsF(); | 32 double max_time_in_seconds = max_time.InSecondsF(); |
30 | 33 |
31 if (time >= max_time_in_seconds) | 34 if (time >= max_time_in_seconds) |
32 return max_time; | 35 return max_time; |
33 | 36 |
34 return base::TimeDelta::FromMicroseconds( | 37 return base::TimeDelta::FromMicroseconds( |
35 time * base::Time::kMicrosecondsPerSecond); | 38 time * base::Time::kMicrosecondsPerSecond); |
36 } | 39 } |
37 | 40 |
38 WebSourceBufferImpl::WebSourceBufferImpl( | 41 WebSourceBufferImpl::WebSourceBufferImpl( |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 demuxer_ = NULL; | 157 demuxer_ = NULL; |
155 client_ = NULL; | 158 client_ = NULL; |
156 } | 159 } |
157 | 160 |
158 void WebSourceBufferImpl::InitSegmentReceived() { | 161 void WebSourceBufferImpl::InitSegmentReceived() { |
159 DVLOG(1) << __FUNCTION__; | 162 DVLOG(1) << __FUNCTION__; |
160 client_->initializationSegmentReceived(); | 163 client_->initializationSegmentReceived(); |
161 } | 164 } |
162 | 165 |
163 } // namespace media | 166 } // namespace media |
OLD | NEW |