Commit e4317c11 authored by Mikhail Karpenko's avatar Mikhail Karpenko

Wait for writer to finish last frame before stopping

parent 54bbff55
......@@ -365,6 +365,9 @@ int camogm_end_jpeg(camogm_state *state)
if (state->rawdev_op) {
// write any remaining data, do not use writer thread as there can be only one block left CHUNK_REM buffer
while (state->writer_params.data_ready)
// wait for previous frame to be recorded first if it has not be recorded by the moment
pthread_cond_wait(&state->writer_params.main_cond, &state->writer_params.writer_mutex);
bytes = prep_last_block(state);
if (bytes > 0) {
D6(fprintf(debug_file, "Write last block of data, size = %d\n", bytes));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment