Complete overhaul of the codec handling code:
*) obsolete flags `asymmetric codecs`, `symmetric codecs`, `reorder
codecs`
*) support proper codec offer/answer
*) split codec manipulation (strip/offer/accept/etc) into separate
functions for clarity and better code maintenance
*) fully update codec handlers in both directions after an answer
*) explicit allocation and handling of codecs and payload types in a
codec_store object
*) improve codec matchup logic during answer
*) more explicit handling of supplemental codecs (CN/DTMF)
*) remove now obsolete hacks for handling certain use cases
Change-Id: I996705ba8fe339524c2f70e6bb0fd854f9a1f4fb
This solves problems when the same SSRC is looped through the same call
multiple times in different mono/dialogues, with different parameters.
Change-Id: I1d033cb1f012574d82b5bcbfffe11eb5f983cfd8
Transcoding should not be decided based on the name of the codec alone,
but primarily on the payload type. First the PT needs to be compared,
then the codec type must be confirmed.
closes#1289
Change-Id: I1a8bffc6d521443aba14d9b4cf1ad4d1e21f1226
The JSON context is already in an object, therefore skip the surrounding
{} enclosure.
Also don't run the global MQTT timer when MQTT is disabled.
closes#1290
Change-Id: I63c622bd339545e625ee18def33f21de2533f949
The only reason the wait time in timer threads is capped at 100 ms is to
catch the daemon's shutdown. Since these threads already use a
condition variable to be woken up, we can use the same condition to wake
up the threads during a shutdown, allowing for a much longer (possibly
unlimited) sleep time in timer threads.
Change-Id: I3b5f280a4d502176a731e8b52b1b731022c8db4f
When a new timer object is scheduled to run in the future, we only need
to wake up one thread to notify about the new object as only one thread
is needed to handle it. The other threads can remain in the previous
sleep state.
Change-Id: I92ccec61a6c5a4a3cea5c5428c85f83707cf4d64
GLib 2.68 deprecates g_memdup() in favour of g_memdup2() as the former
was using a guint second argument which could lead to integer overflows
(gsize should be used instead).
Change-Id: Iaa3e3b1ecaab00d1ac887c915397b15b7204dd11
This makes sure all objects are cleaned up during shutdown even if the
respective timer hasn't run yet.
Change-Id: I197b930f1b6e407819cc5a8c4ebd92fcef21b2cd
Some codec handlers hold references to objects held within the
statistics hash table, therefore we must free the statistics after all
codec handlers have been released.
Change-Id: I3832dbeeaaf21d4a82be2dc2c842718415fd46f7
Recent ffmpeg versions have removed AVPacket from the public ABI,
therefore deprecating av_init_packet on statically allocated objects.
The replacement is av_packet_alloc()/av_packet_free().
Change-Id: I5f93fbd19e43413c3328e143cc9147fbdf12d910
Expanding the initialiser of the contained array eliminates a stray
warning from gcc (-Wmissing-field-initializers).
Change-Id: Icef260477d0ff7acc050375ce48cc6604ee325ff
We should eventually try to reduce the amount of -Wno-* options, but for
now this is a net improvement.
Change-Id: I3bd03679acbc157c0d1b3c257a542e2eec0e5ee9
These functions can return negative values to signal errors, therefore
use ssize_t as appropriate type.
Change-Id: I810b2d40e9d6df47269af54c59940d114bb5a672
Use a packed union to access the IV parts, which otherwise force unaligned
accesses.
Warned-by: gcc ASAN
Change-Id: I25661f1b1a00e9cd7d1e24bbcc10ed103ccef323
get_ssrc_ctx() returns a new reference to the SSRC object, therefore we
must release the referece when we're done with it.
Change-Id: I0db07e4cca49a37af68d072ac6d0630c025b8809
Convert ssrc_ctx_put() and ssrc_ctx_hold() to macros to aide in
debugging reference leaks. Having them as inline functions hides the
actual location of the refcount changes.
Obsolete ssrc_ctx_get() as returning values from macros is awkward and
it was only used in two locations.
Also fix a function invocation mishap: obj_get_o() should be used
instead of __obj_get() as the latter is an internal macro.
Change-Id: Icc0d63f04b3816632fd120c1c749cafabbbfa331
This makes the type in line with string(3) functions and eliminates some
compiler warnings.
Also update the related bencode data type.
Change-Id: I7ef4024f4b5a0f737b3dbe03bcd078032395bce6
The SSRC mapping strategy can change if a re-invite disengages
transcoding, therefore we always need to update the output SSRC mapping
even if the SSRC entry has already existed, to avoid stray SSRC changes.
Change-Id: Ib6f14ede1a4e615ff5eb8372cc68bf1acdd4b6c8
(cherry picked from commit dd7acd2644)
Make sure the pointers we return from our continuous memory buffer is
always 64-bit aligned as it's used not only for strings, but also for
structs/objects, and such unaligned memory access is undefined on some
archs and flagged as such by ASAN.
Change-Id: I84cf74e4e9d203fe02507aa1190ccc6554fb36e2
Avoid accessing memory via pointers that may not be aligned, which is
undefined behaviour on some archs. Use memcpy for this purpose instead.
Change-Id: Iec6c8d15fdd7ef00896e494b69412847b637b01b
Check if the uint64_t pointer is aligned before using it. If unaligned,
go byte by byte. Unaligned pointer access is undefined on some archs and
flagged as such by ASAN.
Change-Id: I3afc80a2ddbc874a62d6930971493f8d461aa452