summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg_opt.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-08-13 17:03:39 +0200
committerAnton Khirnov <anton@khirnov.net>2022-08-16 11:09:09 +0200
commitab3147383006f1a31978efce23c6bad38a754e05 (patch)
tree379dc0de3405d1ba2d96d887086ab8cd39b1a116 /fftools/ffmpeg_opt.c
parent75ffca7eef557bcc714d924048a6e184b39fa470 (diff)
fftools/ffmpeg: store a separate copy of input codec parameters
Use it instead of AVStream.codecpar in the main thread. While AVStream.codecpar is documented to only be updated when the stream is added or avformat_find_stream_info(), it is actually updated during demuxing. Accessing it from a different thread then constitutes a race. Ideally, some mechanism should eventually be provided for signalling parameter updates to the user. Then the demuxing thread could pick up the changes and propagate them to the decoder.
Diffstat (limited to 'fftools/ffmpeg_opt.c')
-rw-r--r--fftools/ffmpeg_opt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 97f14b2a5b..30ca5cd609 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1090,7 +1090,11 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
abort();
}
- ret = avcodec_parameters_from_context(par, ist->dec_ctx);
+ ist->par = avcodec_parameters_alloc();
+ if (!ist->par)
+ exit_program(1);
+
+ ret = avcodec_parameters_from_context(ist->par, ist->dec_ctx);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error initializing the decoder context.\n");
exit_program(1);