[FFmpeg-devel] [PATCH] avfilter/buffersrc: check for valid sample rate
Lynne
dev at lynne.ee
Fri Jan 3 00:20:18 EET 2025
On 31/12/2024 23:31, James Almer wrote:
> 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 at gmail.com>
> ---
> libavfilter/buffersrc.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
> index bdf8b14451..c921803c67 100644
> --- a/libavfilter/buffersrc.c
> +++ b/libavfilter/buffersrc.c
> @@ -421,6 +421,11 @@ static av_cold int init_audio(AVFilterContext *ctx)
> 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};
>
LGTM
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xA2FEA5F03F034464.asc
Type: application/pgp-keys
Size: 624 bytes
Desc: OpenPGP public key
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250103/5bac626d/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250103/5bac626d/attachment.sig>
More information about the ffmpeg-devel
mailing list