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 #include <string> | 10 #include <string> |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 | 1222 |
1223 RangeList::iterator itr = ranges_.end(); | 1223 RangeList::iterator itr = ranges_.end(); |
1224 for (itr = ranges_.begin(); itr != ranges_.end(); ++itr) { | 1224 for (itr = ranges_.begin(); itr != ranges_.end(); ++itr) { |
1225 if ((*itr)->CanSeekTo(seek_dts)) | 1225 if ((*itr)->CanSeekTo(seek_dts)) |
1226 break; | 1226 break; |
1227 } | 1227 } |
1228 | 1228 |
1229 if (itr == ranges_.end()) | 1229 if (itr == ranges_.end()) |
1230 return; | 1230 return; |
1231 | 1231 |
| 1232 if (!audio_configs_.empty()) { |
| 1233 const auto& config = audio_configs_[(*itr)->GetConfigIdAtTime(seek_dts)]; |
| 1234 if (config.codec() == kCodecOpus) { |
| 1235 DecodeTimestamp preroll_dts = std::max(seek_dts - config.seek_preroll(), |
| 1236 (*itr)->GetStartTimestamp()); |
| 1237 if ((*itr)->CanSeekTo(preroll_dts) && |
| 1238 (*itr)->SameConfigThruRange(preroll_dts, seek_dts)) { |
| 1239 seek_dts = preroll_dts; |
| 1240 } |
| 1241 } |
| 1242 } |
| 1243 |
1232 SeekAndSetSelectedRange(*itr, seek_dts); | 1244 SeekAndSetSelectedRange(*itr, seek_dts); |
1233 seek_pending_ = false; | 1245 seek_pending_ = false; |
1234 } | 1246 } |
1235 | 1247 |
1236 bool SourceBufferStream::IsSeekPending() const { | 1248 bool SourceBufferStream::IsSeekPending() const { |
1237 return seek_pending_ && !IsEndOfStreamReached(); | 1249 return seek_pending_ && !IsEndOfStreamReached(); |
1238 } | 1250 } |
1239 | 1251 |
1240 void SourceBufferStream::OnSetDuration(base::TimeDelta duration) { | 1252 void SourceBufferStream::OnSetDuration(base::TimeDelta duration) { |
1241 DVLOG(1) << __func__ << " " << GetStreamTypeName() << " (" | 1253 DVLOG(1) << __func__ << " " << GetStreamTypeName() << " (" |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 | 1757 |
1746 if (!have_preroll_buffer) | 1758 if (!have_preroll_buffer) |
1747 return false; | 1759 return false; |
1748 | 1760 |
1749 pending_buffer_.swap(*out_buffer); | 1761 pending_buffer_.swap(*out_buffer); |
1750 pending_buffers_complete_ = false; | 1762 pending_buffers_complete_ = false; |
1751 return true; | 1763 return true; |
1752 } | 1764 } |
1753 | 1765 |
1754 } // namespace media | 1766 } // namespace media |
OLD | NEW |