On 01/10/2012 12:55 PM, Ronald S. Bultje wrote:

> Hi,
> 
> On Mon, Jan 9, 2012 at 1:50 PM, Aneesh Dogra <[email protected]> wrote:
>> +static int get_nb_samples(AVCodecContext *avctx, GetByteContext *g,
>> +                          int *coded_samples)
>>  {
>>     ADPCMDecodeContext *s = avctx->priv_data;
> 
> Add GetByteContext to ADPCMDecodeContext, so we don't need extra
> function arguments.
> 
>>     int nb_samples        = 0;
>>     int ch                = avctx->channels;
>>     int has_coded_samples = 0;
>>     int header_size;
>> +    int buf_size          = bytestream2_get_bytes_left(g);
> 
> Why do you need to know buf_size here? Ideally all these buf_size
> checks can now disappear.


I recommended this to Aneesh because the full buffer size is used for
nearly every codec in calculating the number of samples. Otherwise it'll
have a lot of unnecessary bytestream2_get_bytes_left(), and we would
likely complain that they can be factored out.

-Justin

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

Reply via email to