osmux: allow to set initial RTP SSRC

Instead of using the osmuxh->circuit_id.
This commit is contained in:
Pablo Neira Ayuso 2013-05-12 18:03:50 +02:00
parent d32caea9ea
commit 282aee422f
3 changed files with 6 additions and 5 deletions

View File

@ -157,7 +157,7 @@ int main(int argc, char *argv[])
/* /*
* initialize OSMUX handlers. * initialize OSMUX handlers.
*/ */
osmux_xfrm_output_init(&h_output); osmux_xfrm_output_init(&h_output, random());
/* /*
* initialize datagram server. * initialize datagram server.

View File

@ -54,6 +54,7 @@ struct osmux_in_handle {
struct osmux_out_handle { struct osmux_out_handle {
uint16_t rtp_seq; uint16_t rtp_seq;
uint32_t rtp_timestamp; uint32_t rtp_timestamp;
uint32_t rtp_ssrc;
}; };
struct osmux_hdr *osmux_get_hdr(struct msgb *msg); struct osmux_hdr *osmux_get_hdr(struct msgb *msg);
@ -70,7 +71,7 @@ void osmux_xfrm_input_init(struct osmux_in_handle *h);
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); 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); 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); struct osmux_hdr *osmux_xfrm_output_pull(struct msgb *msg);

View File

@ -75,7 +75,6 @@ osmux_rebuild_rtp(struct osmux_out_handle *h,
struct msgb *out_msg; struct msgb *out_msg;
struct rtp_hdr *rtph; struct rtp_hdr *rtph;
struct amr_hdr *amrh; struct amr_hdr *amrh;
uint32_t ssrc_from_ccid = osmuxh->circuit_id;
char buf[4096]; char buf[4096];
out_msg = msgb_alloc(sizeof(struct rtp_hdr) + out_msg = msgb_alloc(sizeof(struct rtp_hdr) +
@ -94,7 +93,7 @@ osmux_rebuild_rtp(struct osmux_out_handle *h,
/* ... 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);
rtph->ssrc = htonl(ssrc_from_ccid); rtph->ssrc = htonl(h->rtp_ssrc);
msgb_put(out_msg, sizeof(struct rtp_hdr)); msgb_put(out_msg, sizeof(struct rtp_hdr));
@ -517,10 +516,11 @@ osmux_tx_sched(struct llist_head *list,
} }
} }
void osmux_xfrm_output_init(struct osmux_out_handle *h) void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc)
{ {
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;
} }
#define SNPRINTF_BUFFER_SIZE(ret, size, len, offset) \ #define SNPRINTF_BUFFER_SIZE(ret, size, len, offset) \