Browse Source

MT#63317 share ports/sockets among bundle groups

Change-Id: I951f3690e7b795fdc08f0e37a1efb48a1a2630ca
rfuchs/dtls-ice
Richard Fuchs 3 months ago
parent
commit
12f69abbc3
3 changed files with 44 additions and 2 deletions
  1. +41
    -0
      daemon/call.c
  2. +1
    -0
      include/call.h
  3. +2
    -2
      t/auto-daemon-tests-bundle.pl

+ 41
- 0
daemon/call.c View File

@ -3375,6 +3375,42 @@ static void monologue_bundle_check_heads(struct call_monologue *ml) {
}
}
// assigns sockets to be shared
__attribute__((nonnull(1)))
static void monologue_bundle_set_fds(struct call_monologue *ml) {
for (unsigned int i = 0; i < ml->medias->len; i++) {
__auto_type media = ml->medias->pdata[i];
if (!media)
continue;
if (!media->bundle)
continue;
if (!MEDIA_ISSET(media, BUNDLE_ONLY))
continue;
__auto_type bundle = media->bundle;
if (bundle == media)
continue;
__auto_type msl = media->streams.head;
__auto_type bsl = bundle->streams.head;
while (msl) {
__auto_type ms = msl->data;
__auto_type bs = bsl->data;
// XXX close sockets that are not needed?
t_queue_clear(&ms->sfds);
for (__auto_type sl = bs->sfds.head; sl; sl = sl->next)
t_queue_push_tail(&ms->sfds, sl->data);
ms->selected_sfd = bs->selected_sfd;
msl = msl->next;
bsl = bsl->next;
}
}
}
__attribute__((nonnull(1, 2)))
static void monologue_bundle_accept(struct call_monologue *ml, sdp_ng_flags *flags) {
if (!ML_ISSET(ml, BUNDLE))
@ -3412,11 +3448,15 @@ static void monologue_bundle_accept(struct call_monologue *ml, sdp_ng_flags *fla
continue;
}
// remember as accepted
MEDIA_SET(media, BUNDLE_ONLY);
track_bundle_media_pt(media, exclude_pt);
}
monologue_bundle_check_consistency(ml);
monologue_bundle_check_heads(ml);
monologue_bundle_set_fds(ml);
}
/* called with call->master_lock held in W */
@ -3661,6 +3701,7 @@ int monologue_offer_answer(struct call_monologue *monologues[2], sdp_streams_q *
}
monologue_bundle_accept(sender_ml, flags);
monologue_bundle_set_fds(receiver_ml);
// set ipv4/ipv6/mixed media stats
if (flags->opmode == OP_OFFER || flags->opmode == OP_ANSWER) {


+ 1
- 0
include/call.h View File

@ -219,6 +219,7 @@ enum {
#define MEDIA_FLAG_RECRYPT (1LL << 37)
#define MEDIA_FLAG_PUBLIC (1LL << 38)
#define MEDIA_FLAG_EXTMAP_SHORT SHARED_FLAG_EXTMAP_SHORT
#define MEDIA_FLAG_BUNDLE_ONLY (1LL << 40)
/* struct call_monologue */
#define ML_FLAG_REC_FORWARDING (1LL << 16)


+ 2
- 2
t/auto-daemon-tests-bundle.pl View File

@ -416,7 +416,7 @@ isnt($port_a, $port_c, 'different ports');
isnt($port_a, $port_d, 'different ports');
isnt($port_b, $port_c, 'different ports');
isnt($port_b, $port_d, 'different ports');
isnt($port_c, $port_d, 'different ports');
is($port_c, $port_d, 'same ports');
snd($sock_a, $port_c, rtp(0, 2000, 6000, 0x1234, "\x44" x 160));
rcv($sock_c, $port_a, rtpm(0, 2000, 6000, 0x1234, "\x44" x 160));
@ -529,7 +529,7 @@ isnt($port_a, $port_c, 'different ports');
isnt($port_a, $port_d, 'different ports');
isnt($port_b, $port_c, 'different ports');
isnt($port_b, $port_d, 'different ports');
isnt($port_c, $port_d, 'different ports');
is($port_c, $port_d, 'same ports');
snd($sock_a, $port_c, rtp(0, 2000, 6000, 0x1234, "\x44" x 160));
rcv($sock_c, $port_a, rtpm(0, 2000, 6000, 0x1234, "\x44" x 160));


Loading…
Cancel
Save