1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-10-06 05:47:18 +02:00

avfilter/buffersrc: check for valid sample rate

A sample rate <= 0 is invalid.

Fixes an assert in ffmpeg_enc.c that assumed a valid sample rate would be set.
Fixes ticket #11385.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 1446e37d3d)
This commit is contained in:
James Almer
2024-12-30 00:25:41 -03:00
committed by Michael Niedermayer
parent 954e05e1a7
commit e2b20632b8

View File

@@ -402,6 +402,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_channel_layout_describe(&s->ch_layout, buf, sizeof(buf));
}
if (s->sample_rate <= 0) {
av_log(ctx, AV_LOG_ERROR, "Sample rate not set\n");
return AVERROR(EINVAL);
}
if (!s->time_base.num)
s->time_base = (AVRational){1, s->sample_rate};