forked from Green-Sky/tomato
Squashed 'external/toxcore/c-toxcore/' changes from 03e9fbf3703..55752a2e2ef
55752a2e2ef fix(toxav): pass video bit rate as kbit Previously we unintentionally made it Mbit. 7e573280a75 docs(toxav): fix docs of toxav.h - fix units to be more readable - use width before height consistently - video -> audio typo 5f88a084e8c fix: friend_connections leak on allocation failure clean up when it only contains connections in the NONE state 6d27a1ae178 fix: wrong comment for closelist ce4f29e8036 cleanup: Fix all `-Wsign-compare` warnings. 4d4251c397f chore: lower cirrus ci timeout drastically 40676284507 fix: events leak that can occur if allocation fails rare in practice, found by fuzzing 9610ac31c5f fix: Return an error instead of crashing on nullptr args in NGC. a57c2c8f956 refactor: Make ToxAV independent of toxcore internals. 5752fc29f86 refactor: Make tox-bootstrapd use bool instead of int df675786eb2 chore: Add release-drafter github action. 03fd7a69dcf chore: Use toktok's cmp instead of upstream. 350c0ba1205 cleanup: Sort apk/apt install commands in Dockerfiles. 8c1bda502cb chore(deps): bump golang.org/x/net ddb9d3210da chore: Upgrade to FreeBSD 14.1 in cirrus build. e9076f45bd3 chore(cmake): set options changes as cache and with force git-subtree-dir: external/toxcore/c-toxcore git-subtree-split: 55752a2e2ef894bfa6d7a2a21a0278e3f2bede7d
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
#include "../toxcore/ccompat.h"
|
||||
#include "../toxcore/logger.h"
|
||||
#include "../toxcore/mono_time.h"
|
||||
#include "../toxcore/network.h"
|
||||
|
||||
static struct JitterBuffer *jbuf_new(uint32_t capacity);
|
||||
static void jbuf_clear(struct JitterBuffer *q);
|
||||
@ -25,6 +26,8 @@ static bool reconfigure_audio_encoder(const Logger *log, OpusEncoder **e, uint32
|
||||
uint8_t new_ch, uint32_t *old_br, uint32_t *old_sr, uint8_t *old_ch);
|
||||
static bool reconfigure_audio_decoder(ACSession *ac, uint32_t sampling_rate, uint8_t channels);
|
||||
|
||||
|
||||
|
||||
ACSession *ac_new(Mono_Time *mono_time, const Logger *log, ToxAV *av, uint32_t friend_number,
|
||||
toxav_audio_receive_frame_cb *cb, void *cb_data)
|
||||
{
|
||||
@ -150,9 +153,9 @@ void ac_iterate(ACSession *ac)
|
||||
|
||||
ac->lp_channel_count = opus_packet_get_nb_channels(msg->data + 4);
|
||||
|
||||
/* NOTE: even though OPUS supports decoding mono frames with stereo decoder and vice versa,
|
||||
* it didn't work quite well.
|
||||
*/
|
||||
/** NOTE: even though OPUS supports decoding mono frames with stereo decoder and vice versa,
|
||||
* it didn't work quite well.
|
||||
*/
|
||||
if (!reconfigure_audio_decoder(ac, ac->lp_sampling_rate, ac->lp_channel_count)) {
|
||||
LOGGER_WARNING(ac->log, "Failed to reconfigure decoder!");
|
||||
free(msg);
|
||||
@ -273,6 +276,7 @@ static struct JitterBuffer *jbuf_new(uint32_t capacity)
|
||||
q->capacity = capacity;
|
||||
return q;
|
||||
}
|
||||
|
||||
static void jbuf_clear(struct JitterBuffer *q)
|
||||
{
|
||||
while (q->bottom != q->top) {
|
||||
@ -281,6 +285,7 @@ static void jbuf_clear(struct JitterBuffer *q)
|
||||
++q->bottom;
|
||||
}
|
||||
}
|
||||
|
||||
static void jbuf_free(struct JitterBuffer *q)
|
||||
{
|
||||
if (q == nullptr) {
|
||||
@ -291,6 +296,11 @@ static void jbuf_free(struct JitterBuffer *q)
|
||||
free(q->queue);
|
||||
free(q);
|
||||
}
|
||||
|
||||
/*
|
||||
* if -1 is returned the RTPMessage m needs to be free'd by the caller
|
||||
* if 0 is returned the RTPMessage m is stored in the ringbuffer and must NOT be freed by the caller
|
||||
*/
|
||||
static int jbuf_write(const Logger *log, struct JitterBuffer *q, struct RTPMessage *m)
|
||||
{
|
||||
const uint16_t sequnum = m->header.sequnum;
|
||||
@ -319,6 +329,7 @@ static int jbuf_write(const Logger *log, struct JitterBuffer *q, struct RTPMessa
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct RTPMessage *jbuf_read(struct JitterBuffer *q, int32_t *success)
|
||||
{
|
||||
if (q->top == q->bottom) {
|
||||
|
Reference in New Issue
Block a user