fftools/ffmpeg: use a mutex for enc_stats_write()

It may be called concurrently from different threads to write into the
same file.
This commit is contained in:
Anton Khirnov
2023-12-14 20:15:02 +01:00
parent 244d2fcc49
commit 2ad0b8e0ea
4 changed files with 16 additions and 0 deletions

View File

@@ -402,6 +402,11 @@ fail:
return ret;
}
ret = pthread_mutex_init(&es->lock, NULL);
if (ret)
return AVERROR(ret);
es->lock_initialized = 1;
ret = enc_stats_get_file(&es->io, path);
if (ret < 0)
return ret;