Browse Source

Merge branch 'smititelu-master'

pull/147/head
Richard Fuchs 11 years ago
parent
commit
8ca711e8e2
2 changed files with 15 additions and 8 deletions
  1. +12
    -6
      daemon/call.c
  2. +3
    -2
      daemon/call.h

+ 12
- 6
daemon/call.c View File

@ -1750,7 +1750,7 @@ struct stream_fd *__stream_fd_new(struct udp_fd *fd, struct call *call) {
} }
static struct endpoint_map *__get_endpoint_map(struct call_media *media, unsigned int num_ports, static struct endpoint_map *__get_endpoint_map(struct call_media *media, unsigned int num_ports,
const struct endpoint *ep)
const struct endpoint *ep, unsigned int wanted_start_port)
{ {
GSList *l; GSList *l;
struct endpoint_map *em; struct endpoint_map *em;
@ -1802,7 +1802,7 @@ static struct endpoint_map *__get_endpoint_map(struct call_media *media, unsigne
alloc: alloc:
if (num_ports > G_N_ELEMENTS(fd_arr)) if (num_ports > G_N_ELEMENTS(fd_arr))
return NULL; return NULL;
if (__get_consecutive_ports(fd_arr, num_ports, 0, media->call))
if (__get_consecutive_ports(fd_arr, num_ports, wanted_start_port, media->call))
return NULL; return NULL;
__C_DBG("allocating stream_fds for %u ports", num_ports); __C_DBG("allocating stream_fds for %u ports", num_ports);
@ -1841,10 +1841,10 @@ static void __assign_stream_fds(struct call_media *media, GList *sfds) {
ice_restart(media->ice_agent); ice_restart(media->ice_agent);
} }
static int __wildcard_endpoint_map(struct call_media *media, unsigned int num_ports) {
static int __wildcard_endpoint_map(struct call_media *media, unsigned int num_ports, unsigned int wanted_start_port) {
struct endpoint_map *em; struct endpoint_map *em;
em = __get_endpoint_map(media, num_ports, NULL);
em = __get_endpoint_map(media, num_ports, NULL, wanted_start_port);
if (!em) if (!em)
return -1; return -1;
@ -2595,7 +2595,9 @@ int monologue_offer_answer(struct call_monologue *other_ml, GQueue *streams,
/* get that many ports for each side, and one packet stream for each port, then /* get that many ports for each side, and one packet stream for each port, then
* assign the ports to the streams */ * assign the ports to the streams */
em = __get_endpoint_map(media, num_ports, &sp->rtp_endpoint);
em = __get_endpoint_map(media, num_ports, &sp->rtp_endpoint,
(unsigned int)GPOINTER_TO_UINT(g_queue_pop_head(&call->rtp_bridge_ports)));
if (!em) if (!em)
goto error; goto error;
@ -2606,7 +2608,8 @@ int monologue_offer_answer(struct call_monologue *other_ml, GQueue *streams,
/* new streams created on OTHER side. normally only happens in /* new streams created on OTHER side. normally only happens in
* initial offer. create a wildcard endpoint_map to be filled in * initial offer. create a wildcard endpoint_map to be filled in
* when the answer comes. */ * when the answer comes. */
if (__wildcard_endpoint_map(other_media, num_ports))
if (__wildcard_endpoint_map(other_media, num_ports,
(unsigned int)GPOINTER_TO_UINT(g_queue_pop_head(&call->rtp_bridge_ports))))
goto error; goto error;
} }
@ -3160,6 +3163,8 @@ static void __call_free(void *p) {
g_slice_free1(sizeof(*ps), ps); g_slice_free1(sizeof(*ps), ps);
} }
g_queue_clear(&c->rtp_bridge_ports);
assert(c->stream_fds == NULL); assert(c->stream_fds == NULL);
} }
@ -3178,6 +3183,7 @@ static struct call *call_create(const str *callid, struct callmaster *m) {
c->created = poller_now; c->created = poller_now;
c->dtls_cert = dtls_cert(); c->dtls_cert = dtls_cert();
c->tos = m->conf.default_tos; c->tos = m->conf.default_tos;
g_queue_init(&c->rtp_bridge_ports);
return c; return c;
} }


+ 3
- 2
daemon/call.h View File

@ -386,17 +386,18 @@ struct call {
mutex_t buffer_lock; mutex_t buffer_lock;
call_buffer_t buffer; call_buffer_t buffer;
GQueue rtp_bridge_ports;
/* everything below protected by master_lock */ /* everything below protected by master_lock */
rwlock_t master_lock; rwlock_t master_lock;
GSList *monologues; GSList *monologues;
GHashTable *tags;
GHashTable *tags;
GHashTable *viabranches; GHashTable *viabranches;
GSList *streams; GSList *streams;
GSList *stream_fds; GSList *stream_fds;
struct dtls_cert *dtls_cert; /* for outgoing */ struct dtls_cert *dtls_cert; /* for outgoing */
str callid;
str callid;
time_t created; time_t created;
time_t last_signal; time_t last_signal;
time_t deleted; time_t deleted;


Loading…
Cancel
Save