From dbf8e531927a39cb044c5ccdde54173d0f213a2e Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 18 Apr 2018 13:58:46 +0200 Subject: osmux: Add new API osmux_xfrm_output_sched to fix rtp generation issues With old implementation, in conditions with jitter we could end up scheduling RTP generated packets from two consecutive osmux frames in an interleaved way (from seq field point of view). This new implementation should make it easier for any RTP reader/playback to have better results in those conditions. Old APIs osmux_xfm_output and osmux_tx_sched are marked as deprecated in favour of the new one, which has a better control of generated RTP packets. However, they are still usable despite the implementation changes done to support the new API. Related: OS#3180 Change-Id: I4e05ff141eb4041128ae77812bbcfe84ed4c02de --- include/osmocom/netif/osmux.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include/osmocom') diff --git a/include/osmocom/netif/osmux.h b/include/osmocom/netif/osmux.h index 5283059..e8e2c67 100644 --- a/include/osmocom/netif/osmux.h +++ b/include/osmocom/netif/osmux.h @@ -2,6 +2,7 @@ #define _OSMUX_H_ #include +#include /*! \addtogroup osmux * @{ @@ -79,6 +80,10 @@ struct osmux_out_handle { uint16_t rtp_seq; uint32_t rtp_timestamp; uint32_t rtp_ssrc; + struct osmo_timer_list timer; + struct llist_head list; + void (*tx_cb)(struct msgb *msg, void *data); /* Used defined rtp tx callback */ + void *data; /* User defined opaque data structure */ }; static inline uint8_t *osmux_get_payload(struct osmux_hdr *osmuxh) @@ -101,10 +106,13 @@ 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_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc); -int osmux_xfrm_output(struct osmux_hdr *osmuxh, struct osmux_out_handle *h, struct llist_head *list); +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_sched(struct osmux_out_handle *h, struct osmux_hdr *osmuxh); +void osmux_xfrm_output_flush(struct osmux_out_handle *h); struct osmux_hdr *osmux_xfrm_output_pull(struct msgb *msg); -void osmux_tx_sched(struct llist_head *list, void (*tx_cb)(struct msgb *msg, void *data), void *data); +void osmux_tx_sched(struct llist_head *list, void (*tx_cb)(struct msgb *msg, void *data), void *data) OSMO_DEPRECATED("Use osmux_xfrm_output_set_tx_cb() instead"); /*! @} */ -- cgit v1.2.3