X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=futatabi%2Fmain.cpp;h=6dc50649c2c22d723f3e01b46686e95c694e844f;hb=3630741c0d8c1d73fb7d888e1eb772e53f117105;hp=0ef51be546de44cc3e27ab78ec9cb657deee11ef;hpb=f16a3d114562ca32e9416948a245905ca34465ee;p=nageru diff --git a/futatabi/main.cpp b/futatabi/main.cpp index 0ef51be..6dc5064 100644 --- a/futatabi/main.cpp +++ b/futatabi/main.cpp @@ -79,7 +79,7 @@ FrameOnDisk write_frame(int stream_idx, int64_t pts, const uint8_t *data, size_t { if (open_frame_files.count(stream_idx) == 0) { char filename[256]; - snprintf(filename, sizeof(filename), "%s/frames/cam%d-pts%09ld.frames", + snprintf(filename, sizeof(filename), "%s/frames/cam%d-pts%09" PRId64 ".frames", global_flags.working_directory.c_str(), stream_idx, pts); FILE *fp = fopen(filename, "wb"); if (fp == nullptr) { @@ -255,6 +255,12 @@ int main(int argc, char **argv) load_existing_frames(); + for (int stream_idx = 0; stream_idx < MAX_STREAMS; ++stream_idx) { + if (!frames[stream_idx].empty()) { + assert(start_pts > frames[stream_idx].back().pts); + } + } + MainWindow main_window; main_window.show(); @@ -269,7 +275,6 @@ int main(int argc, char **argv) should_quit = true; record_thread.join(); - JPEGFrameView::shutdown(); return ret; } @@ -529,8 +534,10 @@ void record_thread_func() current_pts = pts; } - fprintf(stderr, "%s: Hit EOF. Waiting one second and trying again...\n", global_flags.stream_source.c_str()); - sleep(1); + if (!should_quit.load()) { + fprintf(stderr, "%s: Hit EOF. Waiting one second and trying again...\n", global_flags.stream_source.c_str()); + sleep(1); + } start_pts = last_pts + TIMEBASE; }