diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-08-18 11:13:08 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-08-29 15:42:11 +0200 |
commit | 8d26a21bf63514cc566bf8c9de940a786bb33167 (patch) | |
tree | 83908ac26d0305fc1abe1e9d3e38202e483758af /fftools/ffmpeg.c | |
parent | 47b85c5a7642b6ec942c052bbe7d163b70e017a8 (diff) |
fftools/ffmpeg: stop accessing av_stream_get_parser() from the main thread
It races with the demuxing thread. Instead, send the information along
with the demuxed packets.
Ideally, the code should stop using the stream-internal parsing
completely, but that requires considerably more effort.
Fixes races, e.g. in:
- fate-h264-brokensps-2580
- fate-h264-extradata-reload
- fate-iv8-demux
- fate-m4v-cfr
- fate-m4v
Diffstat (limited to 'fftools/ffmpeg.c')
-rw-r--r-- | fftools/ffmpeg.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index ef7177fc33..ff74534ad0 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2452,7 +2452,9 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo if (pkt && pkt->duration) { duration_dts = av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); } else if(ist->dec_ctx->framerate.num != 0 && ist->dec_ctx->framerate.den != 0) { - int ticks= av_stream_get_parser(ist->st) ? av_stream_get_parser(ist->st)->repeat_pict+1 : ist->dec_ctx->ticks_per_frame; + int ticks = ist->last_pkt_repeat_pict >= 0 ? + ist->last_pkt_repeat_pict + 1 : + ist->dec_ctx->ticks_per_frame; duration_dts = ((int64_t)AV_TIME_BASE * ist->dec_ctx->framerate.den * ticks) / ist->dec_ctx->framerate.num / ist->dec_ctx->ticks_per_frame; @@ -2555,7 +2557,9 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo } else if (pkt->duration) { ist->next_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); } else if(ist->dec_ctx->framerate.num != 0) { - int ticks= av_stream_get_parser(ist->st) ? av_stream_get_parser(ist->st)->repeat_pict + 1 : ist->dec_ctx->ticks_per_frame; + int ticks = ist->last_pkt_repeat_pict >= 0 ? + ist->last_pkt_repeat_pict + 1 : + ist->dec_ctx->ticks_per_frame; ist->next_dts += ((int64_t)AV_TIME_BASE * ist->dec_ctx->framerate.den * ticks) / ist->dec_ctx->framerate.num / ist->dec_ctx->ticks_per_frame; |