TT#91003 handle NO_DATA frames from AMR encoder

Change-Id: I437ae1a8b2ee440a12caccf8cfae486b90aa00c3
pull/1083/head
Richard Fuchs 6 years ago
parent a69a27ec32
commit 0222936981

@ -1994,9 +1994,20 @@ static int packetizer_amr(AVPacket *pkt, GString *buf, str *output, encoder_t *e
unsigned char toc = pkt->data[0];
unsigned char ft = (toc >> 3) & 0xf;
assert(ft <= 13);
if (ft > 15) {
ilog(LOG_WARN | LOG_FLAG_LIMIT, "Received bogus AMR FT %u from encoder", ft);
return -1;
}
if (ft >= 14) {
// NO_DATA or SPEECH_LOST
return -1;
}
assert(ft < AMR_FT_TYPES); // internal bug
unsigned int bits = enc->codec_options.amr.bits_per_frame[ft];
assert(bits != 0);
if (bits == 0) {
ilog(LOG_WARN | LOG_FLAG_LIMIT, "Received bogus AMR FT %u from encoder", ft);
return -1;
}
unsigned char *s = (unsigned char *) output->s; // for safe bit shifting

Loading…
Cancel
Save