[FFmpeg-devel] [PATCH] ac3enc: check snr_offset of 0 before failing in cbr_bit_allocation().

Justin Ruggles justin.ruggles
Sat Mar 5 22:26:36 CET 2011


On 03/05/2011 06:18 AM, Reimar D?ffinger wrote:

> On Fri, Mar 04, 2011 at 03:25:15PM -0500, Justin Ruggles wrote:
>> -    if (snr_offset < 0)
>> -        return AVERROR(EINVAL);
>> +    if (snr_offset < 0) {
>> +        snr_offset = 0;
>> +        if (bit_alloc(s, snr_offset) > bits_left)
> 
> You just assigned it 0, so why use the variable instead of 0 directly?


Because the variable needs to be zero if it succeeds so it is saved to
the AC3EncodeContext and written to the bitstream.  Using zero directly
then setting to 0 on success would work too...

-Justin



More information about the ffmpeg-devel mailing list