mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Avoid side-effectful assignments in conditionals.
Only in audio.c for now. This should be done everywhere.
This commit is contained in:
parent
465c9380ea
commit
c0c3098737
|
@ -39,4 +39,5 @@ jobs:
|
||||||
-DTEST_TIMEOUT_SECONDS=120
|
-DTEST_TIMEOUT_SECONDS=120
|
||||||
-DUSE_IPV6=OFF
|
-DUSE_IPV6=OFF
|
||||||
- run: cd _build && ninja install -j$(nproc)
|
- run: cd _build && ninja install -j$(nproc)
|
||||||
- run: cd _build && ctest -j50 --output-on-failure
|
- run: cd _build && ctest -j50 --output-on-failure ||
|
||||||
|
ctest -j50 --output-on-failure --rerun-failed
|
||||||
|
|
|
@ -66,7 +66,9 @@ ACSession *ac_new(const Logger *log, ToxAV *av, uint32_t friend_number, toxav_au
|
||||||
goto BASE_CLEANUP;
|
goto BASE_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(ac->j_buf = jbuf_new(AUDIO_JITTERBUFFER_COUNT))) {
|
ac->j_buf = jbuf_new(AUDIO_JITTERBUFFER_COUNT);
|
||||||
|
|
||||||
|
if (ac->j_buf == nullptr) {
|
||||||
LOGGER_WARNING(log, "Jitter buffer creaton failed!");
|
LOGGER_WARNING(log, "Jitter buffer creaton failed!");
|
||||||
opus_decoder_destroy(ac->decoder);
|
opus_decoder_destroy(ac->decoder);
|
||||||
goto BASE_CLEANUP;
|
goto BASE_CLEANUP;
|
||||||
|
@ -138,12 +140,13 @@ void ac_iterate(ACSession *ac)
|
||||||
/* Enough space for the maximum frame size (120 ms 48 KHz stereo audio) */
|
/* Enough space for the maximum frame size (120 ms 48 KHz stereo audio) */
|
||||||
int16_t temp_audio_buffer[AUDIO_MAX_BUFFER_SIZE_PCM16 * AUDIO_MAX_CHANNEL_COUNT];
|
int16_t temp_audio_buffer[AUDIO_MAX_BUFFER_SIZE_PCM16 * AUDIO_MAX_CHANNEL_COUNT];
|
||||||
|
|
||||||
struct RTPMessage *msg;
|
|
||||||
int rc = 0;
|
|
||||||
|
|
||||||
pthread_mutex_lock(ac->queue_mutex);
|
pthread_mutex_lock(ac->queue_mutex);
|
||||||
|
struct JitterBuffer *const j_buf = (struct JitterBuffer *)ac->j_buf;
|
||||||
|
|
||||||
while ((msg = jbuf_read((struct JitterBuffer *)ac->j_buf, &rc)) || rc == 2) {
|
int rc = 0;
|
||||||
|
struct RTPMessage *msg = jbuf_read(j_buf, &rc);
|
||||||
|
|
||||||
|
for (; msg != nullptr || rc == 2; msg = jbuf_read(j_buf, &rc)) {
|
||||||
pthread_mutex_unlock(ac->queue_mutex);
|
pthread_mutex_unlock(ac->queue_mutex);
|
||||||
|
|
||||||
if (rc == 2) {
|
if (rc == 2) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user