summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-12-03 13:52:18 -0500
committerirungentoo <irungentoo@gmail.com>2014-12-03 13:52:18 -0500
commitbe9c6f88d3c3a204958a2e3d3817850c215a8e06 (patch)
treeea2465d775d95f0d30767ef6fcfbbeeb64ba72e9
parent607003509b98dc90607ce6ec822c975ea7b68223 (diff)
Fixed possible threading issue.
-rw-r--r--toxav/toxav.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/toxav/toxav.c b/toxav/toxav.c
index 8101cbdb..7633edf9 100644
--- a/toxav/toxav.c
+++ b/toxav/toxav.c
@@ -156,11 +156,17 @@ uint32_t toxav_do_interval(ToxAv *av)
156 int i = 0; 156 int i = 0;
157 uint32_t rc = 200 + av->avgdectms; /* Return 200 if no call is active */ 157 uint32_t rc = 200 + av->avgdectms; /* Return 200 if no call is active */
158 158
159 for (; i < av->max_calls; i ++) if (av->calls[i].active) { 159 for (; i < av->max_calls; i ++) {
160 pthread_mutex_lock(av->calls[i].mutex);
161
162 if (av->calls[i].active) {
160 /* This should work. Video payload will always come in greater intervals */ 163 /* This should work. Video payload will always come in greater intervals */
161 rc = MIN(av->calls[i].cs->audio_decoder_frame_duration, rc); 164 rc = MIN(av->calls[i].cs->audio_decoder_frame_duration, rc);
162 } 165 }
163 166
167 pthread_mutex_unlock(av->calls[i].mutex);
168 }
169
164 return rc < av->avgdectms ? 0 : rc - av->avgdectms; 170 return rc < av->avgdectms ? 0 : rc - av->avgdectms;
165} 171}
166 172