| 322 | } |
| 323 | |
| 324 | void VideoCacheThread::handleUserSeekWithPreroll(int64_t playhead, |
| 325 | int dir, |
| 326 | int64_t timeline_end, |
| 327 | int64_t preroll_frames) |
| 328 | { |
| 329 | int64_t preroll_start = playhead; |
| 330 | if (preroll_frames > 0) { |
| 331 | if (dir > 0) { |
| 332 | preroll_start = std::max<int64_t>(1, playhead - preroll_frames); |
| 333 | } |
| 334 | else { |
| 335 | preroll_start = std::min<int64_t>(timeline_end, playhead + preroll_frames); |
| 336 | } |
| 337 | } |
| 338 | last_cached_index.store(preroll_start - dir); |
| 339 | } |
| 340 | |
| 341 | int64_t VideoCacheThread::computePrerollFrames(const Settings* settings) const |
| 342 | { |