MT#55283 fix missing EVS size collision avoidance

With hf-only=0 set and cmr=1 also set, we send a blank CMR with each
packet, which forces use of HF format packets. This in turn can lead to
size collisions (e.g. mode 1 = 18 bytes, + CMR + TOC = 20 bytes, which
is the same as mode 2) which can confuse the decoder. Add the required
size collision logic.

Change-Id: Icd540cfb321b4eaf77a0ed7d08be06d8681b6214
pull/1819/head
Richard Fuchs 1 year ago
parent 88f09f9b02
commit 2d39b967a0

@ -4572,6 +4572,15 @@ static int evs_encoder_input(encoder_t *enc, AVFrame **frame) {
bytes += (out - enc->avpkt->data);
assert(bytes <= enc->avpkt->size);
if (toc && !enc->format_options.evs.amr_io && !enc->format_options.evs.hf_only) {
// hf-only=0 but HF packet, check for size collisions and zero-pad if needed
while (evs_mode_from_bytes(bytes) != -1) {
enc->avpkt->data[bytes] = '\0';
bytes++;
}
}
enc->avpkt->size = bytes;
enc->avpkt->pts = (*frame)->pts;
enc->avpkt->duration = (*frame)->nb_samples;

Loading…
Cancel
Save