X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=futatabi%2Fvideo_stream.cpp;h=a820411064234bef2d29aa9c7a95f91a1cd0771d;hb=8e88294902b4b6f43c8db83dbf04830b5b9d2bfd;hp=8b29794abe2ff7aca21eff8267b8e6a76092c13c;hpb=d3aaa6449bc96989cb435b65c30199772d7ba353;p=nageru diff --git a/futatabi/video_stream.cpp b/futatabi/video_stream.cpp index 8b29794..a820411 100644 --- a/futatabi/video_stream.cpp +++ b/futatabi/video_stream.cpp @@ -335,18 +335,14 @@ void VideoStream::schedule_original_frame(steady_clock::time_point local_pts, { 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)frame_reader.read_frame(frame); - QueuedFrame qf; qf.local_pts = local_pts; qf.type = QueuedFrame::ORIGINAL; qf.output_pts = output_pts; - qf.frame1 = frame; qf.display_func = move(display_func); qf.queue_spot_holder = move(queue_spot_holder); qf.subtitle = subtitle; + qf.encoded_jpeg.reset(new string(frame_reader.read_frame(frame))); lock_guard lock(queue_lock); frame_queue.push_back(move(qf)); @@ -655,7 +651,7 @@ void VideoStream::encode_thread_func() if (qf.type == QueuedFrame::ORIGINAL) { // Send the JPEG frame on, unchanged. - string jpeg = frame_reader.read_frame(qf.frame1); + string jpeg = move(*qf.encoded_jpeg); AVPacket pkt; av_init_packet(&pkt); pkt.stream_index = 0;