osmux: support two concurrent calls in output path
This commit is contained in:
parent
b9cf903bbe
commit
72a0aae500
|
@ -49,8 +49,8 @@ struct osmux_in_handle {
|
|||
|
||||
/* one per OSmux circuit_id, ie. one per RTP flow. */
|
||||
struct osmux_out_handle {
|
||||
uint16_t rtp_seq;
|
||||
uint32_t rtp_timestamp;
|
||||
uint16_t rtp_seq[8];
|
||||
uint32_t rtp_timestamp[8];
|
||||
};
|
||||
|
||||
static inline uint8_t *osmux_get_payload(struct osmux_hdr *osmuxh)
|
||||
|
@ -65,6 +65,7 @@ void osmux_xfrm_input_register_ccid(struct osmux_in_handle *h, uint32_t ssrc);
|
|||
int osmux_xfrm_input(struct osmux_in_handle *h, struct msgb *msg);
|
||||
void osmux_xfrm_input_deliver(struct osmux_in_handle *h);
|
||||
|
||||
void osmux_xfrm_output_init(struct osmux_out_handle *h);
|
||||
int osmux_xfrm_output(struct osmux_hdr *osmuxh, struct osmux_out_handle *h, struct llist_head *list);
|
||||
struct osmux_hdr *osmux_xfrm_output_pull(struct msgb *msg);
|
||||
|
||||
|
|
20
src/osmux.c
20
src/osmux.c
|
@ -75,8 +75,8 @@ osmux_rebuild_rtp(struct osmux_out_handle *h,
|
|||
rtph->version = RTP_VERSION;
|
||||
rtph->payload_type = 98;
|
||||
/* ... emulate timestamp and ssrc */
|
||||
rtph->timestamp = htonl(h->rtp_timestamp);
|
||||
rtph->sequence = htons(h->rtp_seq);
|
||||
rtph->timestamp = htonl(h->rtp_timestamp[osmuxh->circuit_id]);
|
||||
rtph->sequence = htons(h->rtp_seq[osmuxh->circuit_id]);
|
||||
rtph->ssrc = htonl(ssrc_from_ccid);
|
||||
|
||||
msgb_put(out_msg, sizeof(struct rtp_hdr));
|
||||
|
@ -95,8 +95,8 @@ osmux_rebuild_rtp(struct osmux_out_handle *h,
|
|||
msgb_put(out_msg, payload_len);
|
||||
|
||||
/* bump last RTP sequence number and timestamp that has been used */
|
||||
h->rtp_seq++;
|
||||
h->rtp_timestamp++;
|
||||
h->rtp_seq[osmuxh->circuit_id]++;
|
||||
h->rtp_timestamp[osmuxh->circuit_id]++;
|
||||
|
||||
osmo_rtp_snprintf(buf, sizeof(buf), out_msg);
|
||||
LOGP(DOSMUX, LOGL_DEBUG, "%s\n", buf);
|
||||
|
@ -134,7 +134,7 @@ struct osmux_batch {
|
|||
struct llist_head msgb_list;
|
||||
unsigned int remaining_bytes;
|
||||
uint8_t seq;
|
||||
int64_t ccid[8];
|
||||
int64_t ccid[OSMUX_MAX_CONCURRENT_CALLS];
|
||||
};
|
||||
|
||||
static int
|
||||
|
@ -507,3 +507,13 @@ int osmux_xfrm_input_get_ccid(struct osmux_in_handle *h, uint32_t ssrc)
|
|||
|
||||
return found ? i : -1;
|
||||
}
|
||||
|
||||
void osmux_xfrm_output_init(struct osmux_out_handle *h)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<8; i++) {
|
||||
h->rtp_seq[i] = (uint16_t)random();
|
||||
h->rtp_timestamp[i] = (uint32_t)random();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,10 +35,7 @@
|
|||
* This is the output handle for osmux, it stores last RTP sequence and
|
||||
* timestamp that has been used. There should be one per circuit ID.
|
||||
*/
|
||||
static struct osmux_out_handle h_output = {
|
||||
.rtp_seq = 1000,
|
||||
.rtp_timestamp = 10,
|
||||
};
|
||||
static struct osmux_out_handle h_output;
|
||||
|
||||
static void tx_cb(struct msgb *msg, void *data)
|
||||
{
|
||||
|
@ -154,6 +151,7 @@ int main(int argc, char *argv[])
|
|||
osmo_pcap.timer.cb = osmo_pcap_pkt_timer_cb;
|
||||
|
||||
osmux_xfrm_input_init(&h_input);
|
||||
osmux_xfrm_output_init(&h_output);
|
||||
|
||||
/* first run */
|
||||
osmo_pcap_pkt_timer_cb(NULL);
|
||||
|
|
Loading…
Reference in New Issue