From f0f1ebf70ea2222f97bb7445805ec7466dbcd22e Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 17 May 2019 17:11:02 +0200 Subject: 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 --- src/osmux.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/osmux.c b/src/osmux.c index 7a6ce60..8b6a115 100644 --- a/src/osmux.c +++ b/src/osmux.c @@ -146,7 +146,7 @@ osmux_rebuild_rtp(struct osmux_out_handle *h, struct osmux_hdr *osmuxh, rtph->csrc_count = 0; rtph->extension = 0; rtph->version = RTP_VERSION; - rtph->payload_type = 98; + rtph->payload_type = h->rtp_payload_type; /* ... emulate timestamp and ssrc */ rtph->timestamp = htonl(h->rtp_timestamp); 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)); h->rtp_seq = (uint16_t)random(); h->rtp_timestamp = (uint32_t)random(); h->rtp_ssrc = rtp_ssrc; + h->rtp_payload_type = rtp_payload_type; INIT_LLIST_HEAD(&h->list); 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) \ if (ret < 0) \ ret = 0; \ -- cgit v1.2.3