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

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

Issue 179763006: Revert 253502 "Add base::TimeDelta::Max()." (Closed) Base URL: svn://svn.chromium.org/chrome/
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 | « trunk/src/cc/resources/picture_pile_impl.cc ('k') | trunk/src/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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 void WebSourceBufferImpl::setAppendWindowEnd(double end) { 84 void WebSourceBufferImpl::setAppendWindowEnd(double end) {
87 demuxer_->SetAppendWindowEnd(id_, DoubleToTimeDelta(end)); 85 demuxer_->SetAppendWindowEnd(id_, DoubleToTimeDelta(end));
88 } 86 }
89 87
90 void WebSourceBufferImpl::removedFromMediaSource() { 88 void WebSourceBufferImpl::removedFromMediaSource() {
91 demuxer_->RemoveId(id_); 89 demuxer_->RemoveId(id_);
92 demuxer_ = NULL; 90 demuxer_ = NULL;
93 } 91 }
94 92
95 } // namespace content 93 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/cc/resources/picture_pile_impl.cc ('k') | trunk/src/media/base/buffers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698