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>
pull/391/head
James Almer 4 weeks ago
parent 658a645e18
commit 1446e37d3d
  1. 5
      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};

Loading…
Cancel
Save