comparison src/rtp_tx.c @ 25:e67b3bb87d1b

RTP Tx: network byte order
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 07 Jul 2024 17:41:19 +0000
parents 84d427017d2f
children f71efdd08c33
comparison
equal deleted inserted replaced
24:84d427017d2f 25:e67b3bb87d1b
4 4
5 #include <stdint.h> 5 #include <stdint.h>
6 #include <stdbool.h> 6 #include <stdbool.h>
7 #include <string.h> 7 #include <string.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <arpa/inet.h> /* for network byte order functions */
9 10
10 #include <osmocom/core/msgb.h> 11 #include <osmocom/core/msgb.h>
11 #include <osmocom/core/osmo_io.h> 12 #include <osmocom/core/osmo_io.h>
12 #include <osmocom/core/timer.h> 13 #include <osmocom/core/timer.h>
13 14
69 msgb_put(msg, sizeof(struct rtp_basic_hdr)); 70 msgb_put(msg, sizeof(struct rtp_basic_hdr));
70 rtph->v_p_x_cc = 0x80; 71 rtph->v_p_x_cc = 0x80;
71 rtph->m_pt = payload_type; 72 rtph->m_pt = payload_type;
72 if (marker) 73 if (marker)
73 rtph->m_pt |= 0x80; 74 rtph->m_pt |= 0x80;
74 rtph->ssrc = endp->tx.ssrc; 75 rtph->ssrc = htonl(endp->tx.ssrc);
75 rtph->seq = endp->tx.seq; 76 rtph->seq = htons(endp->tx.seq);
76 rtph->tstamp = endp->tx.ts; 77 rtph->tstamp = htonl(endp->tx.ts);
77 pl_out = msgb_put(msg, payload_len); 78 pl_out = msgb_put(msg, payload_len);
78 memcpy(pl_out, payload, payload_len); 79 memcpy(pl_out, payload, payload_len);
79 endp->tx.seq++; 80 endp->tx.seq++;
80 endp->tx.ts += ts_quantum; 81 endp->tx.ts += ts_quantum;
81 82