diff mbox series

[FFmpeg-devel] avfilter/avf_concat: nb_samples got from delta pts must be > 0

Message ID 20200913113658.21659-1-onemda@gmail.com
State New
Headers show
Series [FFmpeg-devel] avfilter/avf_concat: nb_samples got from delta pts must be > 0
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Paul B Mahol Sept. 13, 2020, 11:36 a.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavfilter/avf_concat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nicolas George Sept. 13, 2020, 11:38 a.m. UTC | #1
Paul B Mahol (12020-09-13):
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavfilter/avf_concat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c
> index 5608ed9ac6..0b10b738a4 100644
> --- a/libavfilter/avf_concat.c
> +++ b/libavfilter/avf_concat.c
> @@ -254,7 +254,7 @@ static int send_silence(AVFilterContext *ctx, unsigned in_no, unsigned out_no,
>      nb_samples = av_rescale_q(seg_delta - cat->in[in_no].pts,
>                                outlink->time_base, rate_tb);
>      frame_nb_samples = FFMAX(9600, rate_tb.den / 5); /* arbitrary */
> -    while (nb_samples) {
> +    while (nb_samples > 0) {
>          frame_nb_samples = FFMIN(frame_nb_samples, nb_samples);
>          buf = ff_get_audio_buffer(outlink, frame_nb_samples);
>          if (!buf)

No. nb_samples should not be negative at this point. If it is, something
was wrong earlier and needs fixing.
diff mbox series

Patch

diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c
index 5608ed9ac6..0b10b738a4 100644
--- a/libavfilter/avf_concat.c
+++ b/libavfilter/avf_concat.c
@@ -254,7 +254,7 @@  static int send_silence(AVFilterContext *ctx, unsigned in_no, unsigned out_no,
     nb_samples = av_rescale_q(seg_delta - cat->in[in_no].pts,
                               outlink->time_base, rate_tb);
     frame_nb_samples = FFMAX(9600, rate_tb.den / 5); /* arbitrary */
-    while (nb_samples) {
+    while (nb_samples > 0) {
         frame_nb_samples = FFMIN(frame_nb_samples, nb_samples);
         buf = ff_get_audio_buffer(outlink, frame_nb_samples);
         if (!buf)