Browse Source

MT#63317 check if bundled PTs are unique

Change-Id: I3f1c63e2079a73ce8f1d3aa79e3650b2c68ed570
rfuchs/dtls-ice
Richard Fuchs 3 months ago
parent
commit
455caf2328
2 changed files with 177 additions and 0 deletions
  1. +27
    -0
      daemon/call.c
  2. +150
    -0
      t/auto-daemon-tests-bundle.pl

+ 27
- 0
daemon/call.c View File

@ -3328,6 +3328,31 @@ static void track_bundle_media_pt(struct call_media *media, pt_media_ht tracker)
}
}
// check to see if all bundled media can actually be bundled
__attribute__((nonnull(1)))
static void monologue_bundle_check_consistency(struct call_monologue *ml) {
for (unsigned int i = 0; i < ml->medias->len; i++) {
__auto_type media = ml->medias->pdata[i];
if (!media)
continue;
__auto_type bundle = media->bundle;
if (!bundle)
continue;
// are PTs unique?
for (__auto_type l = media->codecs.codec_prefs.head; l; l = l->next) {
__auto_type pt = l->data;
if (!t_hash_table_lookup(bundle->pt_media, GINT_TO_POINTER(pt->payload_type))) {
ilog(LOG_WARN, "Payload type %d of media #%u cannot be uniquely associated, "
"therefore cannot bundle media", pt->payload_type,
media->index);
media->bundle = NULL;
break;
}
}
}
}
__attribute__((nonnull(1, 2)))
static void monologue_bundle_accept(struct call_monologue *ml, sdp_ng_flags *flags) {
if (!ML_ISSET(ml, BUNDLE))
@ -3367,6 +3392,8 @@ static void monologue_bundle_accept(struct call_monologue *ml, sdp_ng_flags *fla
track_bundle_media_pt(media, exclude_pt);
}
monologue_bundle_check_consistency(ml);
}
/* called with call->master_lock held in W */


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

@ -555,5 +555,155 @@ rcv_no($sock_c);
offer('same port bundle with non unique PT',
{ bundle => ['accept'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
a=group:BUNDLE a v
m=audio 6208 RTP/AVP 0 100
c=IN IP4 198.51.100.14
a=sendrecv
a=mid:a
a=rtpmap:100 foo/8000
m=video 6208 RTP/AVP 105 100
c=IN IP4 198.51.100.14
a=rtpmap:105 H264/90000
a=rtpmap:100 bar/90000
a=sendrecv
a=mid:v
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0 100
c=IN IP4 203.0.113.1
a=mid:a
a=rtpmap:0 PCMU/8000
a=rtpmap:100 foo/8000
a=sendrecv
a=rtcp:PORT
m=video PORT RTP/AVP 105 100
c=IN IP4 203.0.113.1
a=mid:v
a=rtpmap:105 H264/90000
a=rtpmap:100 bar/90000
a=sendrecv
a=rtcp:PORT
SDP
answer('same port bundle with non unique PT',
{ }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 6210 RTP/AVP 0
c=IN IP4 198.51.100.14
a=sendrecv
a=mid:a
m=video 6212 RTP/AVP 105
c=IN IP4 198.51.100.14
a=rtpmap:105 H264/90000
a=sendrecv
a=mid:v
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=mid:a
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtcp:PORT
m=video PORT RTP/AVP 105
c=IN IP4 203.0.113.1
a=mid:v
a=rtpmap:105 H264/90000
a=sendrecv
a=rtcp:PORT
SDP
offer('optional bundle with non unique PT',
{ bundle => ['accept'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
a=group:BUNDLE a v
m=audio 7106 RTP/AVP 0 100
c=IN IP4 198.51.100.14
a=sendrecv
a=mid:a
a=rtpmap:100 foo/8000
m=video 7108 RTP/AVP 105 100
c=IN IP4 198.51.100.14
a=rtpmap:105 H264/90000
a=rtpmap:100 bar/90000
a=sendrecv
a=mid:v
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0 100
c=IN IP4 203.0.113.1
a=mid:a
a=rtpmap:0 PCMU/8000
a=rtpmap:100 foo/8000
a=sendrecv
a=rtcp:PORT
m=video PORT RTP/AVP 105 100
c=IN IP4 203.0.113.1
a=mid:v
a=rtpmap:105 H264/90000
a=rtpmap:100 bar/90000
a=sendrecv
a=rtcp:PORT
SDP
answer('same port bundle with non unique PT',
{ }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 7110 RTP/AVP 0
c=IN IP4 198.51.100.14
a=sendrecv
a=mid:a
m=video 7112 RTP/AVP 105
c=IN IP4 198.51.100.14
a=rtpmap:105 H264/90000
a=sendrecv
a=mid:v
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=mid:a
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtcp:PORT
m=video PORT RTP/AVP 105
c=IN IP4 203.0.113.1
a=mid:v
a=rtpmap:105 H264/90000
a=sendrecv
a=rtcp:PORT
SDP
#done_testing;NGCP::Rtpengine::AutoTest::terminate('f00');exit;
done_testing();

Loading…
Cancel
Save