summaryrefslogtreecommitdiff
path: root/toxav/audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxav/audio.c')
-rw-r--r--toxav/audio.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/toxav/audio.c b/toxav/audio.c
index 59d1554e..f3351ac3 100644
--- a/toxav/audio.c
+++ b/toxav/audio.c
@@ -45,7 +45,7 @@ bool reconfigure_audio_decoder(ACSession *ac, int32_t sampling_rate, int8_t chan
45 45
46ACSession *ac_new(Logger *log, ToxAV *av, uint32_t friend_number, toxav_audio_receive_frame_cb *cb, void *cb_data) 46ACSession *ac_new(Logger *log, ToxAV *av, uint32_t friend_number, toxav_audio_receive_frame_cb *cb, void *cb_data)
47{ 47{
48 ACSession *ac = calloc(sizeof(ACSession), 1); 48 ACSession *ac = (ACSession *)calloc(sizeof(ACSession), 1);
49 49
50 if (!ac) { 50 if (!ac) {
51 LOGGER_WARNING(log, "Allocation failed! Application might misbehave!"); 51 LOGGER_WARNING(log, "Allocation failed! Application might misbehave!");
@@ -104,7 +104,7 @@ ACSession *ac_new(Logger *log, ToxAV *av, uint32_t friend_number, toxav_audio_re
104 104
105DECODER_CLEANUP: 105DECODER_CLEANUP:
106 opus_decoder_destroy(ac->decoder); 106 opus_decoder_destroy(ac->decoder);
107 jbuf_free(ac->j_buf); 107 jbuf_free((struct JitterBuffer *)ac->j_buf);
108BASE_CLEANUP: 108BASE_CLEANUP:
109 pthread_mutex_destroy(ac->queue_mutex); 109 pthread_mutex_destroy(ac->queue_mutex);
110 free(ac); 110 free(ac);
@@ -118,7 +118,7 @@ void ac_kill(ACSession *ac)
118 118
119 opus_encoder_destroy(ac->encoder); 119 opus_encoder_destroy(ac->encoder);
120 opus_decoder_destroy(ac->decoder); 120 opus_decoder_destroy(ac->decoder);
121 jbuf_free(ac->j_buf); 121 jbuf_free((struct JitterBuffer *)ac->j_buf);
122 122
123 pthread_mutex_destroy(ac->queue_mutex); 123 pthread_mutex_destroy(ac->queue_mutex);
124 124
@@ -141,7 +141,7 @@ void ac_iterate(ACSession *ac)
141 141
142 pthread_mutex_lock(ac->queue_mutex); 142 pthread_mutex_lock(ac->queue_mutex);
143 143
144 while ((msg = jbuf_read(ac->j_buf, &rc)) || rc == 2) { 144 while ((msg = jbuf_read((struct JitterBuffer *)ac->j_buf, &rc)) || rc == 2) {
145 pthread_mutex_unlock(ac->queue_mutex); 145 pthread_mutex_unlock(ac->queue_mutex);
146 146
147 if (rc == 2) { 147 if (rc == 2) {
@@ -204,7 +204,7 @@ int ac_queue_message(void *acp, struct RTPMessage *msg)
204 return -1; 204 return -1;
205 } 205 }
206 206
207 ACSession *ac = acp; 207 ACSession *ac = (ACSession *)acp;
208 208
209 if ((msg->header.pt & 0x7f) == (rtp_TypeAudio + 2) % 128) { 209 if ((msg->header.pt & 0x7f) == (rtp_TypeAudio + 2) % 128) {
210 LOGGER_WARNING(ac->log, "Got dummy!"); 210 LOGGER_WARNING(ac->log, "Got dummy!");
@@ -219,7 +219,7 @@ int ac_queue_message(void *acp, struct RTPMessage *msg)
219 } 219 }
220 220
221 pthread_mutex_lock(ac->queue_mutex); 221 pthread_mutex_lock(ac->queue_mutex);
222 int rc = jbuf_write(ac->log, ac->j_buf, msg); 222 int rc = jbuf_write(ac->log, (struct JitterBuffer *)ac->j_buf, msg);
223 pthread_mutex_unlock(ac->queue_mutex); 223 pthread_mutex_unlock(ac->queue_mutex);
224 224
225 if (rc == -1) { 225 if (rc == -1) {
@@ -261,13 +261,15 @@ static struct JitterBuffer *jbuf_new(uint32_t capacity)
261 size *= 2; 261 size *= 2;
262 } 262 }
263 263
264 struct JitterBuffer *q; 264 struct JitterBuffer *q = (struct JitterBuffer *)calloc(sizeof(struct JitterBuffer), 1);
265 265
266 if (!(q = calloc(sizeof(struct JitterBuffer), 1))) { 266 if (!q) {
267 return NULL; 267 return NULL;
268 } 268 }
269 269
270 if (!(q->queue = calloc(sizeof(struct RTPMessage *), size))) { 270 q->queue = (struct RTPMessage **)calloc(sizeof(struct RTPMessage *), size);
271
272 if (!q->queue) {
271 free(q); 273 free(q);
272 return NULL; 274 return NULL;
273 } 275 }