Quoting Luca Barbato (2014-10-14 18:07:17)
> On 14/10/14 17:46, Vittorio Giovara wrote:
> > From: Luca Barbato <[email protected]>
> >
> > CC: [email protected]
> > Bug-Id: CID 739869
> > ---
> >   avplay.c | 10 +++++-----
> >   1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/avplay.c b/avplay.c
> > index 58da984..1326a67 100644
> > --- a/avplay.c
> > +++ b/avplay.c
> > @@ -1911,7 +1911,7 @@ static int audio_decode_frame(VideoState *is, double 
> > *pts_ptr)
> >               }
> >
> >               if (audio_resample) {
> > -                void *tmp_out;
> > +                uint8_t *out_data[1];
> >                   int out_samples, out_size, out_linesize;
> >                   int osize      = 
> > av_get_bytes_per_sample(is->sdl_sample_fmt);
> >                   int nb_samples = is->frame->nb_samples;
> > @@ -1920,13 +1920,13 @@ static int audio_decode_frame(VideoState *is, 
> > double *pts_ptr)
> >                                                         is->sdl_channels,
> >                                                         nb_samples,
> >                                                         is->sdl_sample_fmt, 
> > 0);
> > -                tmp_out = av_realloc(is->audio_buf1, out_size);
> > -                if (!tmp_out)
> > +                out_data[0] = av_realloc(is->audio_buf1, out_size);
> > +                if (!out_data[0])
> >                       return AVERROR(ENOMEM);
> > -                is->audio_buf1 = tmp_out;
> > +                is->audio_buf1 = out_data[0];
> >
> >                   out_samples = avresample_convert(is->avr,
> > -                                                 &is->audio_buf1,
> > +                                                 out_data,
> >                                                    out_linesize, nb_samples,
> >                                                    is->frame->data,
> >                                                    is->frame->linesize[0],
> >
> 
> To be noted, the previous code works as bad/well as the new code and 
> assumes (correctly) that sdl doesn't have planar audio, the new one is 
> just less confusing.
> 

I really do not see how the new code is any better than the old one. If
I'm reading it correctly, it just does the exact same thing in a more
roundabout way.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to