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

Side by Side Diff: media/filters/chunk_demuxer.cc

Issue 183763011: Reland "Add base::TimeDelta::Max()" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: print "unknown" 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 | « media/base/media_log.cc ('k') | net/http/http_response_headers.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 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 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/filters/chunk_demuxer.h" 5 #include "media/filters/chunk_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 #include <limits> 9 #include <limits>
10 #include <list> 10 #include <list>
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 DVLOG(1) << "SetDuration(" << duration << ")"; 1530 DVLOG(1) << "SetDuration(" << duration << ")";
1531 DCHECK_GE(duration, 0); 1531 DCHECK_GE(duration, 0);
1532 1532
1533 if (duration == GetDuration_Locked()) 1533 if (duration == GetDuration_Locked())
1534 return; 1534 return;
1535 1535
1536 // Compute & bounds check the TimeDelta representation of duration. 1536 // Compute & bounds check the TimeDelta representation of duration.
1537 // This can be different if the value of |duration| doesn't fit the range or 1537 // This can be different if the value of |duration| doesn't fit the range or
1538 // precision of TimeDelta. 1538 // precision of TimeDelta.
1539 TimeDelta min_duration = TimeDelta::FromInternalValue(1); 1539 TimeDelta min_duration = TimeDelta::FromInternalValue(1);
1540 // Don't use TimeDelta::Max() here, as we want the largest finite time delta.
1540 TimeDelta max_duration = TimeDelta::FromInternalValue(kint64max - 1); 1541 TimeDelta max_duration = TimeDelta::FromInternalValue(kint64max - 1);
1541 double min_duration_in_seconds = min_duration.InSecondsF(); 1542 double min_duration_in_seconds = min_duration.InSecondsF();
1542 double max_duration_in_seconds = max_duration.InSecondsF(); 1543 double max_duration_in_seconds = max_duration.InSecondsF();
1543 1544
1544 TimeDelta duration_td; 1545 TimeDelta duration_td;
1545 if (duration == std::numeric_limits<double>::infinity()) { 1546 if (duration == std::numeric_limits<double>::infinity()) {
1546 duration_td = media::kInfiniteDuration(); 1547 duration_td = media::kInfiniteDuration();
1547 } else if (duration < min_duration_in_seconds) { 1548 } else if (duration < min_duration_in_seconds) {
1548 duration_td = min_duration; 1549 duration_td = min_duration;
1549 } else if (duration > max_duration_in_seconds) { 1550 } else if (duration > max_duration_in_seconds) {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 } 1880 }
1880 1881
1881 void ChunkDemuxer::ShutdownAllStreams() { 1882 void ChunkDemuxer::ShutdownAllStreams() {
1882 for (SourceStateMap::iterator itr = source_state_map_.begin(); 1883 for (SourceStateMap::iterator itr = source_state_map_.begin();
1883 itr != source_state_map_.end(); ++itr) { 1884 itr != source_state_map_.end(); ++itr) {
1884 itr->second->Shutdown(); 1885 itr->second->Shutdown();
1885 } 1886 }
1886 } 1887 }
1887 1888
1888 } // namespace media 1889 } // namespace media
OLDNEW
« no previous file with comments | « media/base/media_log.cc ('k') | net/http/http_response_headers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698