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

Side by Side Diff: content/renderer/media/websourcebuffer_impl.cc

Issue 179813009: Revert of Reland "Add base::TimeDelta::Max()" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | « cc/resources/picture_pile_impl.cc ('k') | media/base/buffers.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/websourcebuffer_impl.h" 5 #include "content/renderer/media/websourcebuffer_impl.h"
6 6
7 #include "base/float_util.h" 7 #include "base/float_util.h"
8 #include "media/filters/chunk_demuxer.h" 8 #include "media/filters/chunk_demuxer.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 static base::TimeDelta DoubleToTimeDelta(double time) { 12 static base::TimeDelta DoubleToTimeDelta(double time) {
13 DCHECK(!base::IsNaN(time)); 13 DCHECK(!base::IsNaN(time));
14 DCHECK_GE(time, 0); 14 DCHECK_GE(time, 0);
15 if (time == std::numeric_limits<double>::infinity()) 15 if (time == std::numeric_limits<double>::infinity())
16 return media::kInfiniteDuration(); 16 return media::kInfiniteDuration();
17 17
18 // Don't use base::TimeDelta::Max() here, as we want the largest finite time
19 // delta.
20 base::TimeDelta max_time = base::TimeDelta::FromInternalValue(kint64max - 1); 18 base::TimeDelta max_time = base::TimeDelta::FromInternalValue(kint64max - 1);
21 double max_time_in_seconds = max_time.InSecondsF(); 19 double max_time_in_seconds = max_time.InSecondsF();
22 20
23 if (time >= max_time_in_seconds) 21 if (time >= max_time_in_seconds)
24 return max_time; 22 return max_time;
25 23
26 return base::TimeDelta::FromMicroseconds( 24 return base::TimeDelta::FromMicroseconds(
27 time * base::Time::kMicrosecondsPerSecond); 25 time * base::Time::kMicrosecondsPerSecond);
28 } 26 }
29 27
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 void WebSourceBufferImpl::setAppendWindowEnd(double end) { 91 void WebSourceBufferImpl::setAppendWindowEnd(double end) {
94 demuxer_->SetAppendWindowEnd(id_, DoubleToTimeDelta(end)); 92 demuxer_->SetAppendWindowEnd(id_, DoubleToTimeDelta(end));
95 } 93 }
96 94
97 void WebSourceBufferImpl::removedFromMediaSource() { 95 void WebSourceBufferImpl::removedFromMediaSource() {
98 demuxer_->RemoveId(id_); 96 demuxer_->RemoveId(id_);
99 demuxer_ = NULL; 97 demuxer_ = NULL;
100 } 98 }
101 99
102 } // namespace content 100 } // namespace content
OLDNEW
« no previous file with comments | « cc/resources/picture_pile_impl.cc ('k') | media/base/buffers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698