osmux: Extend osmux_out_handle and add new API to set rtp payload_type
Previously payload_type was always hardcoded to 98 for generated rtp packets from incoming osmux frame. Change-Id: I5cbeb494a8932953d9fd2dc24dacf8cd97fd84e4
This commit is contained in:
parent
fd339712c4
commit
f0f1ebf70e
|
@ -7,3 +7,5 @@
|
||||||
# If any interfaces have been added since the last public release: c:r:a + 1.
|
# If any interfaces have been added since the last public release: c:r:a + 1.
|
||||||
# If any interfaces have been removed or changed since the last public release: c:r:0.
|
# If any interfaces have been removed or changed since the last public release: c:r:0.
|
||||||
#library what description / commit summary line
|
#library what description / commit summary line
|
||||||
|
libosmo-netif Add new field to struct osmux_out_handle Breaks ABI with older versions
|
||||||
|
libosmo-netif Add new API osmux_xfrm_output_init2 Deprecates old osmux_xfrm_output_init
|
||||||
|
|
|
@ -80,6 +80,7 @@ struct osmux_out_handle {
|
||||||
uint16_t rtp_seq;
|
uint16_t rtp_seq;
|
||||||
uint32_t rtp_timestamp;
|
uint32_t rtp_timestamp;
|
||||||
uint32_t rtp_ssrc;
|
uint32_t rtp_ssrc;
|
||||||
|
uint8_t rtp_payload_type;
|
||||||
uint8_t osmux_seq_ack; /* Latest received seq num */
|
uint8_t osmux_seq_ack; /* Latest received seq num */
|
||||||
struct osmo_timer_list timer;
|
struct osmo_timer_list timer;
|
||||||
struct llist_head list;
|
struct llist_head list;
|
||||||
|
@ -106,7 +107,8 @@ void osmux_xfrm_input_close_circuit(struct osmux_in_handle *h, int ccid);
|
||||||
int osmux_xfrm_input(struct osmux_in_handle *h, struct msgb *msg, int ccid);
|
int osmux_xfrm_input(struct osmux_in_handle *h, struct msgb *msg, int ccid);
|
||||||
void osmux_xfrm_input_deliver(struct osmux_in_handle *h);
|
void osmux_xfrm_input_deliver(struct osmux_in_handle *h);
|
||||||
|
|
||||||
void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc);
|
void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc) OSMO_DEPRECATED("Use osmux_xfrm_output_init2() instead");
|
||||||
|
void osmux_xfrm_output_init2(struct osmux_out_handle *h, uint32_t rtp_ssrc, uint8_t rtp_payload_type);
|
||||||
void osmux_xfrm_output_set_tx_cb(struct osmux_out_handle *h, void (*tx_cb)(struct msgb *msg, void *data), void *data);
|
void osmux_xfrm_output_set_tx_cb(struct osmux_out_handle *h, void (*tx_cb)(struct msgb *msg, void *data), void *data);
|
||||||
int osmux_xfrm_output(struct osmux_hdr *osmuxh, struct osmux_out_handle *h, struct llist_head *list) OSMO_DEPRECATED("Use osmux_xfrm_output_sched() instead");
|
int osmux_xfrm_output(struct osmux_hdr *osmuxh, struct osmux_out_handle *h, struct llist_head *list) OSMO_DEPRECATED("Use osmux_xfrm_output_sched() instead");
|
||||||
int osmux_xfrm_output_sched(struct osmux_out_handle *h, struct osmux_hdr *osmuxh);
|
int osmux_xfrm_output_sched(struct osmux_out_handle *h, struct osmux_hdr *osmuxh);
|
||||||
|
|
11
src/osmux.c
11
src/osmux.c
|
@ -146,7 +146,7 @@ osmux_rebuild_rtp(struct osmux_out_handle *h, struct osmux_hdr *osmuxh,
|
||||||
rtph->csrc_count = 0;
|
rtph->csrc_count = 0;
|
||||||
rtph->extension = 0;
|
rtph->extension = 0;
|
||||||
rtph->version = RTP_VERSION;
|
rtph->version = RTP_VERSION;
|
||||||
rtph->payload_type = 98;
|
rtph->payload_type = h->rtp_payload_type;
|
||||||
/* ... emulate timestamp and ssrc */
|
/* ... emulate timestamp and ssrc */
|
||||||
rtph->timestamp = htonl(h->rtp_timestamp);
|
rtph->timestamp = htonl(h->rtp_timestamp);
|
||||||
rtph->sequence = htons(h->rtp_seq);
|
rtph->sequence = htons(h->rtp_seq);
|
||||||
|
@ -999,16 +999,23 @@ osmux_tx_sched(struct llist_head *list,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc)
|
void osmux_xfrm_output_init2(struct osmux_out_handle *h, uint32_t rtp_ssrc, uint8_t rtp_payload_type)
|
||||||
{
|
{
|
||||||
memset(h, 0, sizeof(*h));
|
memset(h, 0, sizeof(*h));
|
||||||
h->rtp_seq = (uint16_t)random();
|
h->rtp_seq = (uint16_t)random();
|
||||||
h->rtp_timestamp = (uint32_t)random();
|
h->rtp_timestamp = (uint32_t)random();
|
||||||
h->rtp_ssrc = rtp_ssrc;
|
h->rtp_ssrc = rtp_ssrc;
|
||||||
|
h->rtp_payload_type = rtp_payload_type;
|
||||||
INIT_LLIST_HEAD(&h->list);
|
INIT_LLIST_HEAD(&h->list);
|
||||||
osmo_timer_setup(&h->timer, osmux_xfrm_output_trigger, h);
|
osmo_timer_setup(&h->timer, osmux_xfrm_output_trigger, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc)
|
||||||
|
{
|
||||||
|
/* backward compatibility with old users, where 98 was harcoded in osmux_rebuild_rtp() */
|
||||||
|
osmux_xfrm_output_init2(h, rtp_ssrc, 98);
|
||||||
|
}
|
||||||
|
|
||||||
#define SNPRINTF_BUFFER_SIZE(ret, remain, offset) \
|
#define SNPRINTF_BUFFER_SIZE(ret, remain, offset) \
|
||||||
if (ret < 0) \
|
if (ret < 0) \
|
||||||
ret = 0; \
|
ret = 0; \
|
||||||
|
|
|
@ -517,7 +517,7 @@ void pcap_test() {
|
||||||
osmo_pcap.timer.cb = pcap_pkt_timer_cb;
|
osmo_pcap.timer.cb = pcap_pkt_timer_cb;
|
||||||
|
|
||||||
if(opt_osmux) {
|
if(opt_osmux) {
|
||||||
osmux_xfrm_output_init(&pcap_osmux_h, 0);
|
osmux_xfrm_output_init2(&pcap_osmux_h, 0, 98);
|
||||||
osmux_xfrm_output_set_tx_cb(&pcap_osmux_h, glue_cb, NULL);
|
osmux_xfrm_output_set_tx_cb(&pcap_osmux_h, glue_cb, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ int main(int argc, char *argv[])
|
||||||
osmo_pcap.timer.cb = osmo_pcap_pkt_timer_cb;
|
osmo_pcap.timer.cb = osmo_pcap_pkt_timer_cb;
|
||||||
|
|
||||||
osmux_xfrm_input_init(&h_input);
|
osmux_xfrm_input_init(&h_input);
|
||||||
osmux_xfrm_output_init(&h_output);
|
osmux_xfrm_output_init2(&h_output, 0, 98);
|
||||||
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
|
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
|
||||||
|
|
||||||
/* first run */
|
/* first run */
|
||||||
|
|
|
@ -269,7 +269,7 @@ int main(void)
|
||||||
osmo_init_logging2(tall_ctx, &osmux_test_log_info);
|
osmo_init_logging2(tall_ctx, &osmux_test_log_info);
|
||||||
log_set_log_level(osmo_stderr_target, LOGL_DEBUG);
|
log_set_log_level(osmo_stderr_target, LOGL_DEBUG);
|
||||||
|
|
||||||
osmux_xfrm_output_init(&h_output, 0x7000000);
|
osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
|
||||||
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
|
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
|
||||||
|
|
||||||
/* If the test takes longer than 10 seconds, abort it */
|
/* If the test takes longer than 10 seconds, abort it */
|
||||||
|
|
|
@ -164,7 +164,7 @@ static void test_output_consecutive(void)
|
||||||
clock_override_enable(true);
|
clock_override_enable(true);
|
||||||
clock_override_set(0, 0);
|
clock_override_set(0, 0);
|
||||||
osmux_init(32);
|
osmux_init(32);
|
||||||
osmux_xfrm_output_init(&h_output, 0x7000000);
|
osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
|
||||||
h_output.rtp_seq = (uint16_t)50;
|
h_output.rtp_seq = (uint16_t)50;
|
||||||
h_output.rtp_timestamp = (uint32_t)500;
|
h_output.rtp_timestamp = (uint32_t)500;
|
||||||
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
|
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
|
||||||
|
@ -226,7 +226,7 @@ static void test_output_interleaved(void)
|
||||||
clock_override_enable(true);
|
clock_override_enable(true);
|
||||||
clock_override_set(0, 0);
|
clock_override_set(0, 0);
|
||||||
osmux_init(32);
|
osmux_init(32);
|
||||||
osmux_xfrm_output_init(&h_output, 0x7000000);
|
osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
|
||||||
h_output.rtp_seq = (uint16_t)50;
|
h_output.rtp_seq = (uint16_t)50;
|
||||||
h_output.rtp_timestamp = (uint32_t)500;
|
h_output.rtp_timestamp = (uint32_t)500;
|
||||||
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
|
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
|
||||||
|
@ -263,7 +263,7 @@ static void test_output_2together(void)
|
||||||
clock_override_enable(true);
|
clock_override_enable(true);
|
||||||
clock_override_set(0, 0);
|
clock_override_set(0, 0);
|
||||||
osmux_init(32);
|
osmux_init(32);
|
||||||
osmux_xfrm_output_init(&h_output, 0x7000000);
|
osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
|
||||||
h_output.rtp_seq = (uint16_t)50;
|
h_output.rtp_seq = (uint16_t)50;
|
||||||
h_output.rtp_timestamp = (uint32_t)500;
|
h_output.rtp_timestamp = (uint32_t)500;
|
||||||
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
|
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
|
||||||
|
@ -297,7 +297,7 @@ static void test_output_frame_lost(void)
|
||||||
clock_override_enable(true);
|
clock_override_enable(true);
|
||||||
clock_override_set(0, 0);
|
clock_override_set(0, 0);
|
||||||
osmux_init(32);
|
osmux_init(32);
|
||||||
osmux_xfrm_output_init(&h_output, 0x7000000);
|
osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
|
||||||
h_output.rtp_seq = (uint16_t)50;
|
h_output.rtp_seq = (uint16_t)50;
|
||||||
h_output.rtp_timestamp = (uint32_t)500;
|
h_output.rtp_timestamp = (uint32_t)500;
|
||||||
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
|
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
|
||||||
|
@ -329,7 +329,7 @@ static void test_output_flush(void)
|
||||||
clock_override_enable(true);
|
clock_override_enable(true);
|
||||||
clock_override_set(0, 0);
|
clock_override_set(0, 0);
|
||||||
osmux_init(32);
|
osmux_init(32);
|
||||||
osmux_xfrm_output_init(&h_output, 0x7000000);
|
osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
|
||||||
h_output.rtp_seq = (uint16_t)50;
|
h_output.rtp_seq = (uint16_t)50;
|
||||||
h_output.rtp_timestamp = (uint32_t)500;
|
h_output.rtp_timestamp = (uint32_t)500;
|
||||||
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
|
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
|
||||||
|
|
Loading…
Reference in New Issue