tests/osmux: Test rx of osmux seqnum wrap around

This test shows that there's a bug where the first RTP packet extracted
from the received osmux batch with seqnum=0 has the M bit marked for no
good reason.

Related: SYS#5987
Change-Id: Ida658c681e84878f209ab4965d8aa821a570a580
This commit is contained in:
Pau Espin 2022-09-28 18:58:50 +02:00
parent e486efa264
commit dc4e8747e9
2 changed files with 42 additions and 0 deletions

View File

@ -390,6 +390,36 @@ static void test_output_flush(void)
talloc_free(h_output);
}
/* Test how the osmux_out_handle behaves when seqnum 0xff->0x00 is received */
static void test_output_seqnum_wraparound(void)
{
struct osmux_out_handle *h_output;
printf("===test_output_seqnum_wraparound===\n");
clock_override_enable(true);
clock_override_set(0, 0);
osmux_init(0xff);
h_output = osmux_xfrm_output_alloc(NULL);
osmux_xfrm_output_set_rtp_ssrc(h_output, 0x7000000);
osmux_xfrm_output_set_rtp_pl_type(h_output, 98);
osmux_xfrm_output_set_tx_cb(h_output, tx_cb, h_output);
h_output->rtp_seq = (uint16_t)50;
h_output->rtp_timestamp = (uint32_t)500;
h_output->osmux_seq_ack = 0xff;
clock_debug("Sending osmux frame with seqnum=0");
PULL_NEXT(h_output);
clock_override_add(0, 2*TIME_RTP_PKT_MS*1000);
osmo_select_main(0);
clock_debug("flushing other RTP packets");
osmux_xfrm_output_flush(h_output);
talloc_free(h_output);
}
int main(int argc, char **argv)
{
@ -412,6 +442,7 @@ int main(int argc, char **argv)
test_output_2together();
test_output_frame_lost();
test_output_flush();
test_output_seqnum_wraparound();
fprintf(stdout, "OK: Test passed\n");
return EXIT_SUCCESS;

View File

@ -105,4 +105,15 @@ sys={0.040000}, mono={0.040000}: dequeue: seq=58 ts=1780 enqueued=3
sys={0.040000}, mono={0.040000}: dequeue: seq=59 ts=1940 enqueued=2
sys={0.040000}, mono={0.040000}: dequeue: seq=60 ts=2100 enqueued=1
sys={0.040000}, mono={0.040000}: dequeue: seq=61 ts=2260 enqueued=0
===test_output_seqnum_wraparound===
sys={0.000000}, mono={0.000000}: clock_override_set
sys={0.000000}, mono={0.000000}: Sending osmux frame with seqnum=0
sys={0.000000}, mono={0.000000}: dequeue: seq=50 ts=500 M enqueued=5
sys={0.040000}, mono={0.040000}: clock_override_add
sys={0.040000}, mono={0.040000}: dequeue: seq=51 ts=660 enqueued=4
sys={0.040000}, mono={0.040000}: dequeue: seq=52 ts=820 enqueued=3
sys={0.040000}, mono={0.040000}: flushing other RTP packets
sys={0.040000}, mono={0.040000}: dequeue: seq=53 ts=980 enqueued=2
sys={0.040000}, mono={0.040000}: dequeue: seq=54 ts=1140 enqueued=1
sys={0.040000}, mono={0.040000}: dequeue: seq=55 ts=1300 enqueued=0
OK: Test passed