diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-04-18 19:10:20 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-04-19 18:24:25 +0200 |
commit | e259c8ab18ce53bd58d022b2c6a193b4a2ec5b1b (patch) | |
tree | cd66c19f91d9b031b454f2cfdca25bc5f739dfa8 /tests/osmux/osmux_test.c | |
parent | 9452adcc33fe3daec6a2be25d4327203e4dee587 (diff) |
osmux: Set Marker bit on osmux frame loss detected
Until this patch, we didn't notify in any way to the RTP reader when an
Osmux frame was lost. Instead, we updated the seq×tamp as if there
was no lost, and as a result the RTP reader would only see a steady
increase of delay every time an osmux frame was lost.
As the batch_factor for the lost packet is unknown, we cannot assume any
number of amr payloads lost, and thus we cannot simply increment seq and
timestamp for a specific amount. Instead, the only viable solution seems
to set the M marker bit in the first rtp packet generated after a
non-consecutive osmux frame is received.
The implementation may act differently with the first generated RTP
packet based on the first osmux seq number used for the stream. In case
0 it's used as first osmux seq number, M will be set depending on
request from original RTP packet having the M bit set. If it's not 0,
the first RTP packer will unconditionally have the M bit. That's not an
issue because it's anyway expect for receiver to sync on the first
packet.
Related: OS#3185
Change-Id: I2efed6d726a1b8e77e686c7a5fe1940d3f4901a7
Diffstat (limited to 'tests/osmux/osmux_test.c')
-rw-r--r-- | tests/osmux/osmux_test.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/osmux/osmux_test.c b/tests/osmux/osmux_test.c index 01ce2d1..631ade8 100644 --- a/tests/osmux/osmux_test.c +++ b/tests/osmux/osmux_test.c @@ -152,7 +152,8 @@ static void osmux_test_marker(int ccid) { memcpy(msg->data, rtp_pkt, sizeof(rtp_pkt)); cpy_rtph = (struct rtp_hdr *) msgb_put(msg, sizeof(rtp_pkt)); - if ((i+j) % 7 == 0) { + /* first condition guarantees that 1st packet per stream contains M bit set. */ + if (i == 0 || (i+j) % 7 == 0) { cpy_rtph->marker = 1; mark_pkts++; } @@ -175,7 +176,7 @@ static void osmux_test_marker(int ccid) { } if (mark_pkts) { - fprintf(stdout, "RTP M bit (marker) mismatch! %d\n", mark_pkts); + fprintf(stdout, "osmux_test_marker: RTP M bit (marker) mismatch! %d\n", mark_pkts); exit(EXIT_FAILURE); } } @@ -183,6 +184,7 @@ static void osmux_test_marker(int ccid) { static void osmux_test_loop(int ccid) { struct rtp_hdr *rtph = (struct rtp_hdr *)rtp_pkt; + struct rtp_hdr *cpy_rtph; struct msgb *msg; int i, j, k = 0; char buf[1024]; @@ -194,11 +196,16 @@ static void osmux_test_loop(int ccid) exit(EXIT_FAILURE); memcpy(msg->data, rtp_pkt, sizeof(rtp_pkt)); - msgb_put(msg, sizeof(rtp_pkt)); + cpy_rtph = (struct rtp_hdr *) msgb_put(msg, sizeof(rtp_pkt)); seq = ntohs(rtph->sequence); seq++; rtph->sequence = htons(seq); + if (i < 3) { + /* Mark 1 rtp packet of each stream */ + cpy_rtph->marker = 1; + mark_pkts++; + } osmo_rtp_snprintf(buf, sizeof(buf), msg); fprintf(stderr, "adding to ccid=%u %s\n", (i % 2) + ccid, buf); @@ -239,7 +246,7 @@ static void osmux_test_loop(int ccid) } if (mark_pkts) { - fprintf(stdout, "RTP M bit (marker) mismatch! %d\n", mark_pkts); + fprintf(stdout, "osmux_test_loop: RTP M bit (marker) mismatch! %d\n", mark_pkts); exit(EXIT_FAILURE); } } |