mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-01-05 21:55:37 +01:00
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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user