OLD | NEW |
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 Loading... |
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. | |
1541 TimeDelta max_duration = TimeDelta::FromInternalValue(kint64max - 1); | 1540 TimeDelta max_duration = TimeDelta::FromInternalValue(kint64max - 1); |
1542 double min_duration_in_seconds = min_duration.InSecondsF(); | 1541 double min_duration_in_seconds = min_duration.InSecondsF(); |
1543 double max_duration_in_seconds = max_duration.InSecondsF(); | 1542 double max_duration_in_seconds = max_duration.InSecondsF(); |
1544 | 1543 |
1545 TimeDelta duration_td; | 1544 TimeDelta duration_td; |
1546 if (duration == std::numeric_limits<double>::infinity()) { | 1545 if (duration == std::numeric_limits<double>::infinity()) { |
1547 duration_td = media::kInfiniteDuration(); | 1546 duration_td = media::kInfiniteDuration(); |
1548 } else if (duration < min_duration_in_seconds) { | 1547 } else if (duration < min_duration_in_seconds) { |
1549 duration_td = min_duration; | 1548 duration_td = min_duration; |
1550 } else if (duration > max_duration_in_seconds) { | 1549 } else if (duration > max_duration_in_seconds) { |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 } | 1879 } |
1881 | 1880 |
1882 void ChunkDemuxer::ShutdownAllStreams() { | 1881 void ChunkDemuxer::ShutdownAllStreams() { |
1883 for (SourceStateMap::iterator itr = source_state_map_.begin(); | 1882 for (SourceStateMap::iterator itr = source_state_map_.begin(); |
1884 itr != source_state_map_.end(); ++itr) { | 1883 itr != source_state_map_.end(); ++itr) { |
1885 itr->second->Shutdown(); | 1884 itr->second->Shutdown(); |
1886 } | 1885 } |
1887 } | 1886 } |
1888 | 1887 |
1889 } // namespace media | 1888 } // namespace media |
OLD | NEW |