Implementing bit-stream padding
This commit is contained in:
parent
940931e49b
commit
43c260ba54
1 changed files with 16 additions and 0 deletions
|
@ -398,6 +398,22 @@ int opus_decode(OpusDecoder *st, const unsigned char *data,
|
||||||
if (st->frame_size*count*25 > 3*st->Fs)
|
if (st->frame_size*count*25 > 3*st->Fs)
|
||||||
return OPUS_CORRUPTED_DATA;
|
return OPUS_CORRUPTED_DATA;
|
||||||
len--;
|
len--;
|
||||||
|
/* Padding bit */
|
||||||
|
if (ch&0x40)
|
||||||
|
{
|
||||||
|
int padding=0;
|
||||||
|
int p;
|
||||||
|
do {
|
||||||
|
if (len<=0)
|
||||||
|
return OPUS_CORRUPTED_DATA;
|
||||||
|
p = *data++;
|
||||||
|
len--;
|
||||||
|
padding += p==255 ? 254: p;
|
||||||
|
} while (p==255);
|
||||||
|
len -= padding;
|
||||||
|
}
|
||||||
|
if (len<0)
|
||||||
|
return OPUS_CORRUPTED_DATA;
|
||||||
/* Bit 7 is VBR flag (bit 6 is ignored) */
|
/* Bit 7 is VBR flag (bit 6 is ignored) */
|
||||||
if (ch&0x80)
|
if (ch&0x80)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue