Hi Zhendong,
Thanks for reporting this. Turns out there was indeed a bug. Not dead
code, but a missing "else" in the chain. It's fixed in master now.
Cheers,
Jean-Marc
On 05/12/16 08:14 AM, Zhendong Wu wrote:> Hi,
>
> I downloaded the source code of opus-1.1.3.tar.gz, and statically
> analyzed the code by a static analysis tool. Many potential false alarms
> are reported. I checked manually and selected a potential error which is
> described as follow. Could you please check it?
>
> In file ‘src/opus_encoder.c’, function ‘opus_encode_native’, the piece
> of code is:
>
> …
> Line 1802: if (frame_size == 2*st->Fs/25) /* 80 ms -> 2x 40 ms */
> Line 1803: enc_frame_size = st->Fs/25;
> Line 1804: if (frame_size == 3*st->Fs/25) /* 120 ms -> 2x 60 ms */
> Line 1805: enc_frame_size = 3*st->Fs/50;
> Line 1806: else /* 100 ms -> 5x 20 ms */
> Line 1807: enc_frame_size = st->Fs/50;
> …
>
> In the above code, Line 1802 and 1803 may be not useful. Because the
> result of variable ‘enc_frame_size’ is not read and used. After
> executing Line 1805 or Line 1807, the value of ‘enc_frame_size’ is
> overwritten.
>
> Looking forward to your reply.
>
> Best,
> Zhendong
>
>
> _______________________________________________
> opus mailing list
> opus at xiph.org
> http://lists.xiph.org/mailman/listinfo/opus
>