osmux: Avoid duplicated RTP msg trigger Tx of osmux frame

The RTP msg will be dropped, so it makes no sense to signal the caller
to deliver the batchbeing built, since it may still have space for next
non-duplicated message.

The exception is the case where the new packet has the M marker bit set,
since the sequence numbers can be reset or jump in those scenarios.

Change-Id: Idc457bc3b26bed68796d714bc3f37a2d016ba5c3
This commit is contained in:
Pau Espin 2022-09-27 17:26:52 +02:00
parent 3de07cf481
commit 414b34e713
1 changed files with 10 additions and 10 deletions

View File

@ -691,22 +691,12 @@ osmux_batch_add(struct osmux_batch *batch, uint32_t batch_factor, struct msgb *m
return -1;
}
/* First check if there is room for this message in the batch */
bytes += amr_payload_len;
if (circuit->nmsgs == 0)
bytes += sizeof(struct osmux_hdr);
/* No room, sorry. You'll have to retry */
if (bytes > batch->remaining_bytes)
return 1;
/* Init of talkspurt (RTP M marker bit) needs to be in the first AMR slot
* of the OSMUX packet, enforce sending previous batch if required:
*/
if (rtph->marker && circuit->nmsgs != 0)
return 1;
/* Extra validation: check if this message already exists, should not
* happen but make sure we don't propagate duplicated messages.
*/
@ -723,6 +713,16 @@ osmux_batch_add(struct osmux_batch *batch, uint32_t batch_factor, struct msgb *m
return -1;
}
}
/* First check if there is room for this message in the batch */
bytes += amr_payload_len;
if (circuit->nmsgs == 0)
bytes += sizeof(struct osmux_hdr);
/* No room, sorry. You'll have to retry */
if (bytes > batch->remaining_bytes)
return 1;
/* Handle RTP packet loss scenario */
osmux_replay_lost_packets(circuit, rtph, batch_factor);