|
|
@ -2997,8 +2997,8 @@ static void __unsubscribe_from_all(struct call_monologue *ml) { |
|
|
l = next; |
|
|
l = next; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
void __add_subscription(struct call_monologue *which, struct call_monologue *to, bool offer_answer, |
|
|
|
|
|
unsigned int offset, bool rtcp_only, bool egress, const struct sink_attrs *attrs) |
|
|
|
|
|
|
|
|
void __add_subscription(struct call_monologue *which, struct call_monologue *to, |
|
|
|
|
|
unsigned int offset, const struct sink_attrs *attrs) |
|
|
{ |
|
|
{ |
|
|
if (g_hash_table_lookup(which->subscriptions_ht, to)) { |
|
|
if (g_hash_table_lookup(which->subscriptions_ht, to)) { |
|
|
ilog(LOG_DEBUG, "Tag '" STR_FORMAT_M "' is already subscribed to '" STR_FORMAT_M "'", |
|
|
ilog(LOG_DEBUG, "Tag '" STR_FORMAT_M "' is already subscribed to '" STR_FORMAT_M "'", |
|
|
@ -3020,11 +3020,8 @@ void __add_subscription(struct call_monologue *which, struct call_monologue *to, |
|
|
which_cs->attrs = *attrs; |
|
|
which_cs->attrs = *attrs; |
|
|
to_rev_cs->attrs = *attrs; |
|
|
to_rev_cs->attrs = *attrs; |
|
|
} |
|
|
} |
|
|
// override some attributes explicitly |
|
|
|
|
|
which_cs->attrs.rtcp_only = rtcp_only ? 1 : 0; |
|
|
|
|
|
to_rev_cs->attrs.rtcp_only = rtcp_only ? 1 : 0; |
|
|
|
|
|
// keep offer-answer subscriptions first in the list |
|
|
// keep offer-answer subscriptions first in the list |
|
|
if (!offer_answer) { |
|
|
|
|
|
|
|
|
if (!attrs || !attrs->offer_answer) { |
|
|
g_queue_push_tail(&which->subscriptions, which_cs); |
|
|
g_queue_push_tail(&which->subscriptions, which_cs); |
|
|
g_queue_push_tail(&to->subscribers, to_rev_cs); |
|
|
g_queue_push_tail(&to->subscribers, to_rev_cs); |
|
|
which_cs->link = to->subscribers.tail; |
|
|
which_cs->link = to->subscribers.tail; |
|
|
@ -3036,10 +3033,6 @@ void __add_subscription(struct call_monologue *which, struct call_monologue *to, |
|
|
which_cs->link = to->subscribers.head; |
|
|
which_cs->link = to->subscribers.head; |
|
|
to_rev_cs->link = which->subscriptions.head; |
|
|
to_rev_cs->link = which->subscriptions.head; |
|
|
} |
|
|
} |
|
|
which_cs->attrs.offer_answer = offer_answer ? 1 : 0; |
|
|
|
|
|
to_rev_cs->attrs.offer_answer = which_cs->attrs.offer_answer; |
|
|
|
|
|
which_cs->attrs.egress = egress ? 1 : 0; |
|
|
|
|
|
to_rev_cs->attrs.egress = which_cs->attrs.egress; |
|
|
|
|
|
g_hash_table_insert(which->subscriptions_ht, to, to_rev_cs->link); |
|
|
g_hash_table_insert(which->subscriptions_ht, to, to_rev_cs->link); |
|
|
g_hash_table_insert(to->subscribers_ht, which, which_cs->link); |
|
|
g_hash_table_insert(to->subscribers_ht, which, which_cs->link); |
|
|
} |
|
|
} |
|
|
@ -3048,22 +3041,22 @@ static void __subscribe_offer_answer_both_ways(struct call_monologue *a, struct |
|
|
struct call_subscription *a_cs = call_get_call_subscription(a->subscriptions_ht, b); |
|
|
struct call_subscription *a_cs = call_get_call_subscription(a->subscriptions_ht, b); |
|
|
struct call_subscription *b_cs = call_get_call_subscription(b->subscriptions_ht, a); |
|
|
struct call_subscription *b_cs = call_get_call_subscription(b->subscriptions_ht, a); |
|
|
// copy out attributes |
|
|
// copy out attributes |
|
|
struct sink_attrs a_attrs = {0,}, *a_attrs_p = NULL; |
|
|
|
|
|
struct sink_attrs b_attrs = {0,}, *b_attrs_p = NULL; |
|
|
|
|
|
if (a_cs) { |
|
|
|
|
|
|
|
|
struct sink_attrs a_attrs = {0,}; |
|
|
|
|
|
struct sink_attrs b_attrs = {0,}; |
|
|
|
|
|
if (a_cs) |
|
|
a_attrs = a_cs->attrs; |
|
|
a_attrs = a_cs->attrs; |
|
|
a_attrs_p = &a_attrs; |
|
|
|
|
|
} |
|
|
|
|
|
if (b_cs) { |
|
|
|
|
|
|
|
|
if (b_cs) |
|
|
b_attrs = b_cs->attrs; |
|
|
b_attrs = b_cs->attrs; |
|
|
b_attrs_p = &b_attrs; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// override/reset some attributes |
|
|
|
|
|
a_attrs.offer_answer = b_attrs.offer_answer = true; |
|
|
|
|
|
a_attrs.egress = b_attrs.egress = false; |
|
|
|
|
|
a_attrs.rtcp_only = b_attrs.rtcp_only = false; |
|
|
// delete existing subscriptions |
|
|
// delete existing subscriptions |
|
|
__unsubscribe_all_offer_answer_subscribers(a); |
|
|
__unsubscribe_all_offer_answer_subscribers(a); |
|
|
__unsubscribe_all_offer_answer_subscribers(b); |
|
|
__unsubscribe_all_offer_answer_subscribers(b); |
|
|
// (re)create, preserving existing attributes if there were any |
|
|
// (re)create, preserving existing attributes if there were any |
|
|
__add_subscription(a, b, true, 0, false, false, a_attrs_p); |
|
|
|
|
|
__add_subscription(b, a, true, 0, false, false, b_attrs_p); |
|
|
|
|
|
|
|
|
__add_subscription(a, b, 0, &a_attrs); |
|
|
|
|
|
__add_subscription(b, a, 0, &b_attrs); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -3200,9 +3193,10 @@ static int monologue_subscribe_request1(struct call_monologue *src_ml, struct ca |
|
|
return -1; |
|
|
return -1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
__add_subscription(dst_ml, src_ml, false, idx_diff, false, flags->egress ? true : false, NULL); |
|
|
|
|
|
|
|
|
__add_subscription(dst_ml, src_ml, idx_diff, &(struct sink_attrs) { .egress = !!flags->egress }); |
|
|
if (flags->rtcp_mirror) |
|
|
if (flags->rtcp_mirror) |
|
|
__add_subscription(src_ml, dst_ml, false, rev_idx_diff, true, flags->egress ? true : false, NULL); |
|
|
|
|
|
|
|
|
__add_subscription(src_ml, dst_ml, rev_idx_diff, |
|
|
|
|
|
&(struct sink_attrs) { .egress = !!flags->egress, .rtcp_only = true }); |
|
|
|
|
|
|
|
|
__update_init_subscribers(src_ml, NULL, NULL, flags->opmode); |
|
|
__update_init_subscribers(src_ml, NULL, NULL, flags->opmode); |
|
|
__update_init_subscribers(dst_ml, NULL, NULL, flags->opmode); |
|
|
__update_init_subscribers(dst_ml, NULL, NULL, flags->opmode); |
|
|
|