Allow restarting the DTX buffer upon reception of a packet iff shutdown
occurred due to the max-dtx time being exceeded.
Change-Id: I9cbb9e946e6f495526cbef8f468f4e0a5aff0096
this fixes an edge case where `DTMF-security=silence`, `block-media`
is enabled and the endpoint sends silence packets in between each RTP
event packet of a single DTMF hit. When that happens, the DTMF doesn't
get processed as `packet_sequencer_next_packet` returns NULL, and the
while loop is broken due to the ts_diff being 0
By checking if media is currently blocked and that the current packet
is a supplemental DTMF, we can force the packet to be processed so the
dropped packet is considered lost and we don't lose the DTMF event
Change-Id: I78bc8e273e872b3ab88f7a84e26a79fad1793476
If DTX audio has already been produced for a particular timestamp and a
late packet matching that timestamp is encountered, we should just
discard the packet instead of immediately doing a timestamp reset. This
prevents unwanted TS resets. Only do a timestamp reset if this happens
multiple times in a row, as we don't want to have to discard too much
audio.
Change-Id: I46c8c20b08787f7e45145bd88463bb6878f36f15
if a delay buffer is enabled, the packets get scheduled in the future,
but media playback packets are scheduled immediately. this results
in choppy playback due to the packets coming in at the same time.
This change adds a new bool to chu_args that gets enabled when
play-media is called and passed in to codec_handlers_stop so the delay
buffer queue is cleared instead of flushed
Change-Id: Id534f9087d934481f17341bc577099dc2362f8e1
when DTMF-security is set to an option that results in a transcode,
the packets go into handler_func_transcode. This returns immediately
when handler_silence_block returns false due to block-media, resulting
in the events not being processed for sending on log-DTMF etc.
This change only uses the transcode function for transcoded DTMF if
we're not blocking media (and logically, blocking media should mean
_all_ media). It instead goes into __handler_func_supplemental as normal
so packet_dtmf can process the packet, but drop it if its in one of
these modes and media is blocked
Change-Id: I19901877f6018f3916b22ff60799e8c74d02e065
when media playback happens, all packets get scheduled at the same
time with a send time in the future. however, this results in the
output_skew calculation triggering an unnecessary shift in the send
timer, which can cause choppy playback
Change-Id: I449f221a4d348eb615c2af1dca30bec163aa4fc6
In case stray audio is receveived before the DTMF event is fully
finished, retain the internal state from the beginning of the event to
make sure that the output is consistent. This fixes both DTMF timestamps
jumping during the end event, and audio timestamps being off after the
end event.
Closes#1929
Change-Id: I4e675b15153e35a8d1546b947e4b82879c1577b4
Keep outgoing RTP timestamps consistent between different instances of
the DTX buffer. Update affected tests.
Change-Id: I6cf03ab32f5c510bd781063a9e7241d1187c202b
If the last used PT was a different one, check if it was an unknown PT.
If it was, then DTX can remain active, as the packet would have been
blocked.
Change-Id: Icc8bf195c30a2252b392bbccfeef34b91078ddd6
The stub is used for unknown payload types. Specialise the handler
function for it with an extra check for DTX usage. This effectively
blocks RTP packets with unknown payload types if DTX has been
configured. Forwarding RTP packets with unknown payload types can
interfere with a clean output stream generated by the DTX buffer.
Change-Id: I6f0aa9654946d2877b963cd13cec7c3f5c8b1c54
Shutting down a DTX buffer means that it may restart at an unknown later
time. Reset TS tracking when shutting it down so that if it does
restart, it receives a fresh TS state, instead of continuing on the
previous timestamps, which may then be wrong.
Change-Id: I9c7978e2f335eab32982c4739917ca5ce0c27eb6
Extend PT tracker to not just track the most used PT, but also which PT
has been used last. Use a simple circular array.
Use this new tracking to determine whether a DTX buffer should remain
active. The "most used PT" approach isn't reliable for this, as it leads
to a DTX buffer restarting only after the PT has become the "most used,"
so only after about 10 packets. Meanwhile a newly appearing SSRC would
have a new DTX buffer active immediately. Being strict about which PT
was used last resolves this inconsistency.
Change-Id: If912e4d10e6737a82f6adc0b19d502075aa18a93
If a packet is received for a codec that should have an active DTX but
doesn't, drop the packet instead of forwarding it without being
processed. In this case we expect that some other codec has an active
DTX buffer, and forwarding the packet would interfere with a clean
output stream.
Change-Id: I162ba6f314b804123a6a3957feb7435a319ad2b9
The GLib slice allocator has been obsoleted. Having a mixture of two
allocators can lead to hidden issues on systems that use different
implementations. Take the leap and replace everything with g_new/g_free.
Change-Id: I025c8383ef47b2c2472573360407fd6a6ca339b3
Decoding and encoding may have taken some time. Grab an updated "now"
before scheduling a packet to send.
Change-Id: I9380cb01d77519cf082d87f3a6c6cfc18b8213f8