+ deque<QueuedFrame> q;
+
+ {
+ unique_lock<mutex> lock(queue_lock);
+ q = move(frame_queue);
+ }
+
+ // These are not RAII-ed, unfortunately, so we'll need to clean them ourselves.
+ // Note that release_texture() is thread-safe.
+ for (const QueuedFrame &qf : q) {
+ if (qf.type == QueuedFrame::INTERPOLATED ||
+ qf.type == QueuedFrame::FADED_INTERPOLATED) {
+ compute_flow->release_texture(qf.flow_tex);
+ }
+ if (qf.type == QueuedFrame::INTERPOLATED) {
+ interpolate->release_texture(qf.output_tex);
+ interpolate->release_texture(qf.cbcr_tex);
+ }
+ }
+
+ // Destroy q outside the mutex, as that would be a double-lock.
+}
+
+void VideoStream::schedule_original_frame(steady_clock::time_point local_pts,
+ int64_t output_pts, function<void()> &&display_func,
+ QueueSpotHolder &&queue_spot_holder,
+ FrameOnDisk frame)
+{
+ fprintf(stderr, "output_pts=%ld original input_pts=%ld\n", output_pts, frame.pts);
+
+ // Preload the file from disk, so that the encoder thread does not get stalled.
+ // TODO: Consider sending it through the queue instead.
+ (void)read_frame(frame);