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.
Unified · Split
| @@ -421,6 +421,11 @@ static av_cold int init_audio(AVFilterContext *ctx) · 420 unmodified lines | |||
| 421 | av_channel_layout_describe(&s->ch_layout, buf, sizeof(buf)); | 421 | av_channel_layout_describe(&s->ch_layout, buf, sizeof(buf)); |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | if (s->sample_rate <= 0) { | ||
| 425 | av_log(ctx, AV_LOG_ERROR, "Sample rate not set\n"); | ||
| 426 | return AVERROR(EINVAL); | ||
| 427 | } | ||
| 428 | |||
| 424 | if (!s->time_base.num) | 429 | if (!s->time_base.num) |
| 425 | s->time_base = (AVRational){1, s->sample_rate}; | 430 | s->time_base = (AVRational){1, s->sample_rate}; |
| 426 | 431 | ||