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 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 DVLOG(1) << "SetDuration(" << duration << ")"; | 1516 DVLOG(1) << "SetDuration(" << duration << ")"; |
1517 DCHECK_GE(duration, 0); | 1517 DCHECK_GE(duration, 0); |
1518 | 1518 |
1519 if (duration == GetDuration_Locked()) | 1519 if (duration == GetDuration_Locked()) |
1520 return; | 1520 return; |
1521 | 1521 |
1522 // Compute & bounds check the TimeDelta representation of duration. | 1522 // Compute & bounds check the TimeDelta representation of duration. |
1523 // This can be different if the value of |duration| doesn't fit the range or | 1523 // This can be different if the value of |duration| doesn't fit the range or |
1524 // precision of TimeDelta. | 1524 // precision of TimeDelta. |
1525 TimeDelta min_duration = TimeDelta::FromInternalValue(1); | 1525 TimeDelta min_duration = TimeDelta::FromInternalValue(1); |
| 1526 // Don't use TimeDelta::Max() here, as we want the largest finite time delta. |
1526 TimeDelta max_duration = TimeDelta::FromInternalValue(kint64max - 1); | 1527 TimeDelta max_duration = TimeDelta::FromInternalValue(kint64max - 1); |
1527 double min_duration_in_seconds = min_duration.InSecondsF(); | 1528 double min_duration_in_seconds = min_duration.InSecondsF(); |
1528 double max_duration_in_seconds = max_duration.InSecondsF(); | 1529 double max_duration_in_seconds = max_duration.InSecondsF(); |
1529 | 1530 |
1530 TimeDelta duration_td; | 1531 TimeDelta duration_td; |
1531 if (duration == std::numeric_limits<double>::infinity()) { | 1532 if (duration == std::numeric_limits<double>::infinity()) { |
1532 duration_td = media::kInfiniteDuration(); | 1533 duration_td = media::kInfiniteDuration(); |
1533 } else if (duration < min_duration_in_seconds) { | 1534 } else if (duration < min_duration_in_seconds) { |
1534 duration_td = min_duration; | 1535 duration_td = min_duration; |
1535 } else if (duration > max_duration_in_seconds) { | 1536 } else if (duration > max_duration_in_seconds) { |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 } | 1866 } |
1866 | 1867 |
1867 void ChunkDemuxer::ShutdownAllStreams() { | 1868 void ChunkDemuxer::ShutdownAllStreams() { |
1868 for (SourceStateMap::iterator itr = source_state_map_.begin(); | 1869 for (SourceStateMap::iterator itr = source_state_map_.begin(); |
1869 itr != source_state_map_.end(); ++itr) { | 1870 itr != source_state_map_.end(); ++itr) { |
1870 itr->second->Shutdown(); | 1871 itr->second->Shutdown(); |
1871 } | 1872 } |
1872 } | 1873 } |
1873 | 1874 |
1874 } // namespace media | 1875 } // namespace media |
OLD | NEW |