Browse Source

MT#55283 add codec_touched_real()

Simply stripping a supplemental codec doesn't actually affect the
remaining real codecs. Add a special-cased version of codec_touched() to
ignore such a manipulation.

Add a matching test case.

Change-Id: I4a91292dd38e1114837c2dc841afe07d87cff6cb
pull/1665/head
Richard Fuchs 3 years ago
parent
commit
13a7e1db7b
2 changed files with 68 additions and 2 deletions
  1. +9
    -2
      daemon/codec.c
  2. +59
    -0
      t/auto-daemon-tests.pl

+ 9
- 2
daemon/codec.c View File

@ -4536,6 +4536,13 @@ static struct codec_tracker *codec_tracker_init(void) {
return NULL;
#endif
}
static void codec_touched_real(struct codec_store *cs, struct rtp_payload_type *pt) {
#ifdef WITH_TRANSCODING
if (pt->codec_def && pt->codec_def->supplemental)
return;
g_hash_table_replace(cs->tracker->touched, GUINT_TO_POINTER(pt->clock_rate), (void *) 0x1);
#endif
}
static void codec_touched(struct codec_store *cs, struct rtp_payload_type *pt) {
#ifdef WITH_TRANSCODING
if (pt->codec_def && pt->codec_def->supplemental) {
@ -4917,7 +4924,7 @@ void codec_store_strip(struct codec_store *cs, GQueue *strip, GHashTable *except
" (%i) due to strip=all or strip=full",
STR_FMT(&pt->encoding_with_params),
pt->payload_type);
codec_touched(cs, pt);
codec_touched_real(cs, pt);
next = __codec_store_delete_link(link, cs);
}
link = next;
@ -4938,7 +4945,7 @@ void codec_store_strip(struct codec_store *cs, GQueue *strip, GHashTable *except
if (pt) {
ilogs(codec, LOG_DEBUG, "Stripping codec " STR_FORMAT " (%i)",
STR_FMT(&pt->encoding_with_params), pt_num);
codec_touched(cs, pt);
codec_touched_real(cs, pt);
__codec_store_delete_link(pt->prefs_link, cs);
// this removes pts->head
}


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

@ -18588,6 +18588,65 @@ SDP
new_call;
offer('strip CN',
{ ICE => 'remove', replace => ['origin'],
codec => { strip => [qw/PCMU RED CN G729/]} }, <<SDP);
v=0
o=- 100263 0 IN IP4 127.0.0.1
s=session
c=IN IP4 52.113.56.34
b=CT:10000000
t=0 0
m=audio 49954 RTP/AVP 104 9 103 111 18 0 8 97 101 13 118
c=IN IP4 52.113.56.34
a=rtcp:49955
a=label:main-audio
a=mid:1
a=sendrecv
a=rtpmap:104 SILK/16000
a=rtpmap:9 G722/8000
a=rtpmap:103 SILK/8000
a=rtpmap:111 SIREN/16000
a=fmtp:111 bitrate=16000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 RED/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:13 CN/8000
a=rtpmap:118 CN/16000
a=ptime:20
----------------------------------
v=0
o=- 100263 0 IN IP4 203.0.113.1
s=session
c=IN IP4 52.113.56.34
b=CT:10000000
t=0 0
m=audio PORT RTP/AVP 104 9 103 111 8 101
c=IN IP4 203.0.113.1
a=label:main-audio
a=mid:1
a=rtpmap:104 SILK/16000
a=rtpmap:9 G722/8000
a=rtpmap:103 SILK/8000
a=rtpmap:111 SIREN/16000
a=fmtp:111 bitrate=16000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
($sock_a, $sock_b) = new_call([qw(198.51.100.1 8050)], [qw(198.51.100.3 8052)]);
($port_a) = offer('reverse DTMF transcoding - no-op', { ICE => 'remove', replace => ['origin'],


Loading…
Cancel
Save