MT#56465 offer/answer: don't drop existing offer's subs

Don't unsubscribe offer from its existing
subscriptions, because it may have multiple
branched receiver's monologues, and hence medias.

Change-Id: I5caf515f35688041b684fbea9bf05ae559d43e15
pull/1880/head
Donat Zenichev 6 months ago
parent 4669051cac
commit ce9c767cf9

@ -72,7 +72,8 @@ static void __call_free(void *p);
static void __call_cleanup(call_t *c);
static void __monologue_stop(struct call_monologue *ml);
static void media_stop(struct call_media *m);
static void __subscribe_medias_both_ways(struct call_media * a, struct call_media * b);
static void __subscribe_medias_both_ways(struct call_media * a, struct call_media * b,
bool is_offer);
/* called with call->master_lock held in R */
static int call_timer_delete_monologues(call_t *c) {
@ -2966,6 +2967,7 @@ int monologue_offer_answer(struct call_monologue *monologues[2], sdp_streams_q *
struct call_monologue *sender_ml = monologues[0];
struct call_monologue *receiver_ml = monologues[1];
unsigned int num_ports_this, num_ports_other;
bool is_offer = (flags->opmode == OP_OFFER);
/* we must have a complete dialogue, even though the to-tag (monologue->tag)
* may not be known yet */
@ -3002,7 +3004,7 @@ int monologue_offer_answer(struct call_monologue *monologues[2], sdp_streams_q *
* details already. */
/* if medias still not subscribed to each other, do it now */
__subscribe_medias_both_ways(sender_media, receiver_media);
__subscribe_medias_both_ways(sender_media, receiver_media, is_offer);
struct media_subscription * ms = call_get_media_subscription(receiver_media->media_subscribers_ht, sender_media);
if (ms)
@ -3286,7 +3288,8 @@ void __add_media_subscription(struct call_media * which, struct call_media * to,
/**
* Subscribe medias to each other.
*/
static void __subscribe_medias_both_ways(struct call_media * a, struct call_media * b)
static void __subscribe_medias_both_ways(struct call_media * a, struct call_media * b,
bool is_offer)
{
if (!a || !b)
return;
@ -3309,8 +3312,11 @@ static void __subscribe_medias_both_ways(struct call_media * a, struct call_medi
a_attrs.egress = b_attrs.egress = false;
a_attrs.rtcp_only = b_attrs.rtcp_only = false;
/* release existing subscriptions both ways */
__unsubscribe_all_offer_answer_medias(a);
/* Release existing subscriptions both ways.
* But leave those for SDP offer, if there are any,
* because can be a branched offer. */
if (!is_offer)
__unsubscribe_all_offer_answer_medias(a);
__unsubscribe_all_offer_answer_medias(b);
/* (re)create, preserving existing attributes if there have been any */

Loading…
Cancel
Save