Chromium Code Reviews| 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/source_buffer_stream.h" | 5 #include "media/filters/source_buffer_stream.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1098 | 1098 |
| 1099 RangeList::iterator itr = ranges_.end(); | 1099 RangeList::iterator itr = ranges_.end(); |
| 1100 for (itr = ranges_.begin(); itr != ranges_.end(); ++itr) { | 1100 for (itr = ranges_.begin(); itr != ranges_.end(); ++itr) { |
| 1101 if ((*itr)->CanSeekTo(seek_dts)) | 1101 if ((*itr)->CanSeekTo(seek_dts)) |
| 1102 break; | 1102 break; |
| 1103 } | 1103 } |
| 1104 | 1104 |
| 1105 if (itr == ranges_.end()) | 1105 if (itr == ranges_.end()) |
| 1106 return; | 1106 return; |
| 1107 | 1107 |
| 1108 if (!audio_configs_.empty()) { | |
| 1109 const auto& config = audio_configs_[(*itr)->GetConfigIdAtTime(seek_dts)]; | |
| 1110 if (config.codec() == kCodecOpus) { | |
| 1111 DecodeTimestamp preroll_dts = std::max(seek_dts - config.seek_preroll(), | |
| 1112 (*itr)->GetStartTimestamp()); | |
| 1113 if ((*itr)->CanSeekTo(preroll_dts) && | |
|
chcunningham
2016/07/22 01:50:28
FYI: I've taken a conservative approach here. If w
wolenetz
2016/12/02 00:18:49
Acknowledged.
| |
| 1114 (*itr)->SameConfigThruRange(preroll_dts, seek_dts)) { | |
| 1115 seek_dts = preroll_dts; | |
| 1116 } | |
| 1117 } | |
| 1118 } | |
| 1119 | |
| 1108 SeekAndSetSelectedRange(*itr, seek_dts); | 1120 SeekAndSetSelectedRange(*itr, seek_dts); |
| 1109 seek_pending_ = false; | 1121 seek_pending_ = false; |
| 1110 } | 1122 } |
| 1111 | 1123 |
| 1112 bool SourceBufferStream::IsSeekPending() const { | 1124 bool SourceBufferStream::IsSeekPending() const { |
| 1113 return seek_pending_ && !IsEndOfStreamReached(); | 1125 return seek_pending_ && !IsEndOfStreamReached(); |
| 1114 } | 1126 } |
| 1115 | 1127 |
| 1116 void SourceBufferStream::OnSetDuration(base::TimeDelta duration) { | 1128 void SourceBufferStream::OnSetDuration(base::TimeDelta duration) { |
| 1117 DecodeTimestamp duration_dts = | 1129 DecodeTimestamp duration_dts = |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1813 return false; | 1825 return false; |
| 1814 | 1826 |
| 1815 DCHECK_NE(have_splice_buffers, have_preroll_buffer); | 1827 DCHECK_NE(have_splice_buffers, have_preroll_buffer); |
| 1816 splice_buffers_index_ = 0; | 1828 splice_buffers_index_ = 0; |
| 1817 pending_buffer_.swap(*out_buffer); | 1829 pending_buffer_.swap(*out_buffer); |
| 1818 pending_buffers_complete_ = false; | 1830 pending_buffers_complete_ = false; |
| 1819 return true; | 1831 return true; |
| 1820 } | 1832 } |
| 1821 | 1833 |
| 1822 } // namespace media | 1834 } // namespace media |
| OLD | NEW |