summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.circleci/config.yml3
-rw-r--r--toxav/audio.c13
2 files changed, 10 insertions, 6 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index f85e9548..de800936 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -39,4 +39,5 @@ jobs:
39 -DTEST_TIMEOUT_SECONDS=120 39 -DTEST_TIMEOUT_SECONDS=120
40 -DUSE_IPV6=OFF 40 -DUSE_IPV6=OFF
41 - run: cd _build && ninja install -j$(nproc) 41 - run: cd _build && ninja install -j$(nproc)
42 - run: cd _build && ctest -j50 --output-on-failure 42 - run: cd _build && ctest -j50 --output-on-failure ||
43 ctest -j50 --output-on-failure --rerun-failed
diff --git a/toxav/audio.c b/toxav/audio.c
index 3b46d1d5..75d3d477 100644
--- a/toxav/audio.c
+++ b/toxav/audio.c
@@ -66,7 +66,9 @@ ACSession *ac_new(const Logger *log, ToxAV *av, uint32_t friend_number, toxav_au
66 goto BASE_CLEANUP; 66 goto BASE_CLEANUP;
67 } 67 }
68 68
69 if (!(ac->j_buf = jbuf_new(AUDIO_JITTERBUFFER_COUNT))) { 69 ac->j_buf = jbuf_new(AUDIO_JITTERBUFFER_COUNT);
70
71 if (ac->j_buf == nullptr) {
70 LOGGER_WARNING(log, "Jitter buffer creaton failed!"); 72 LOGGER_WARNING(log, "Jitter buffer creaton failed!");
71 opus_decoder_destroy(ac->decoder); 73 opus_decoder_destroy(ac->decoder);
72 goto BASE_CLEANUP; 74 goto BASE_CLEANUP;
@@ -138,12 +140,13 @@ void ac_iterate(ACSession *ac)
138 /* Enough space for the maximum frame size (120 ms 48 KHz stereo audio) */ 140 /* Enough space for the maximum frame size (120 ms 48 KHz stereo audio) */
139 int16_t temp_audio_buffer[AUDIO_MAX_BUFFER_SIZE_PCM16 * AUDIO_MAX_CHANNEL_COUNT]; 141 int16_t temp_audio_buffer[AUDIO_MAX_BUFFER_SIZE_PCM16 * AUDIO_MAX_CHANNEL_COUNT];
140 142
141 struct RTPMessage *msg;
142 int rc = 0;
143
144 pthread_mutex_lock(ac->queue_mutex); 143 pthread_mutex_lock(ac->queue_mutex);
144 struct JitterBuffer *const j_buf = (struct JitterBuffer *)ac->j_buf;
145
146 int rc = 0;
147 struct RTPMessage *msg = jbuf_read(j_buf, &rc);
145 148
146 while ((msg = jbuf_read((struct JitterBuffer *)ac->j_buf, &rc)) || rc == 2) { 149 for (; msg != nullptr || rc == 2; msg = jbuf_read(j_buf, &rc)) {
147 pthread_mutex_unlock(ac->queue_mutex); 150 pthread_mutex_unlock(ac->queue_mutex);
148 151
149 if (rc == 2) { 152 if (rc == 2) {