diff options
author | zoff99 <zoff@zoff.cc> | 2020-03-28 11:58:00 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2020-04-07 17:56:01 +0000 |
commit | dfe19e04d3fd47aaf8035451491ff97155fc8cb4 (patch) | |
tree | ca3bce35b67ae59bfcfaac072b95325aaf1ff9aa | |
parent | 97fc2f4c0b68d8c4eed3987943b3e4efafc361e0 (diff) |
Change ToxAVCall struct mutex to a more distinct name.
-rw-r--r-- | toxav/toxav.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/toxav/toxav.c b/toxav/toxav.c index 777daab8..8f3c7e01 100644 --- a/toxav/toxav.c +++ b/toxav/toxav.c | |||
@@ -58,7 +58,7 @@ typedef struct ToxAVCall_s { | |||
58 | /** Required for monitoring changes in states */ | 58 | /** Required for monitoring changes in states */ |
59 | uint8_t previous_self_capabilities; | 59 | uint8_t previous_self_capabilities; |
60 | 60 | ||
61 | pthread_mutex_t mutex[1]; | 61 | pthread_mutex_t toxav_call_mutex[1]; |
62 | 62 | ||
63 | struct ToxAVCall_s *prev; | 63 | struct ToxAVCall_s *prev; |
64 | struct ToxAVCall_s *next; | 64 | struct ToxAVCall_s *next; |
@@ -246,7 +246,7 @@ void toxav_iterate(ToxAV *av) | |||
246 | 246 | ||
247 | for (; i; i = i->next) { | 247 | for (; i; i = i->next) { |
248 | if (i->active) { | 248 | if (i->active) { |
249 | pthread_mutex_lock(i->mutex); | 249 | pthread_mutex_lock(i->toxav_call_mutex); |
250 | pthread_mutex_unlock(av->mutex); | 250 | pthread_mutex_unlock(av->mutex); |
251 | 251 | ||
252 | ac_iterate(i->audio); | 252 | ac_iterate(i->audio); |
@@ -266,7 +266,7 @@ void toxav_iterate(ToxAV *av) | |||
266 | 266 | ||
267 | uint32_t fid = i->friend_number; | 267 | uint32_t fid = i->friend_number; |
268 | 268 | ||
269 | pthread_mutex_unlock(i->mutex); | 269 | pthread_mutex_unlock(i->toxav_call_mutex); |
270 | pthread_mutex_lock(av->mutex); | 270 | pthread_mutex_lock(av->mutex); |
271 | 271 | ||
272 | /* In case this call is popped from container stop iteration */ | 272 | /* In case this call is popped from container stop iteration */ |
@@ -459,16 +459,16 @@ bool toxav_call_control(ToxAV *av, uint32_t friend_number, Toxav_Call_Control co | |||
459 | 459 | ||
460 | case TOXAV_CALL_CONTROL_CANCEL: { | 460 | case TOXAV_CALL_CONTROL_CANCEL: { |
461 | /* Hang up */ | 461 | /* Hang up */ |
462 | pthread_mutex_lock(call->mutex); | 462 | pthread_mutex_lock(call->toxav_call_mutex); |
463 | 463 | ||
464 | if (msi_hangup(call->msi_call) != 0) { | 464 | if (msi_hangup(call->msi_call) != 0) { |
465 | rc = TOXAV_ERR_CALL_CONTROL_SYNC; | 465 | rc = TOXAV_ERR_CALL_CONTROL_SYNC; |
466 | pthread_mutex_unlock(call->mutex); | 466 | pthread_mutex_unlock(call->toxav_call_mutex); |
467 | goto RETURN; | 467 | goto RETURN; |
468 | } | 468 | } |
469 | 469 | ||
470 | call->msi_call = nullptr; | 470 | call->msi_call = nullptr; |
471 | pthread_mutex_unlock(call->mutex); | 471 | pthread_mutex_unlock(call->toxav_call_mutex); |
472 | 472 | ||
473 | /* No mather the case, terminate the call */ | 473 | /* No mather the case, terminate the call */ |
474 | call_kill_transmission(call); | 474 | call_kill_transmission(call); |
@@ -592,7 +592,7 @@ bool toxav_audio_set_bit_rate(ToxAV *av, uint32_t friend_number, uint32_t audio_ | |||
592 | /* Audio sending is turned off; notify peer */ | 592 | /* Audio sending is turned off; notify peer */ |
593 | call->audio_bit_rate = 0; | 593 | call->audio_bit_rate = 0; |
594 | } else { | 594 | } else { |
595 | pthread_mutex_lock(call->mutex); | 595 | pthread_mutex_lock(call->toxav_call_mutex); |
596 | 596 | ||
597 | if (call->audio_bit_rate == 0) { | 597 | if (call->audio_bit_rate == 0) { |
598 | LOGGER_DEBUG(av->m->log, "Turned on audio sending"); | 598 | LOGGER_DEBUG(av->m->log, "Turned on audio sending"); |
@@ -600,7 +600,7 @@ bool toxav_audio_set_bit_rate(ToxAV *av, uint32_t friend_number, uint32_t audio_ | |||
600 | /* The audio has been turned off before this */ | 600 | /* The audio has been turned off before this */ |
601 | if (msi_change_capabilities(call->msi_call, call-> | 601 | if (msi_change_capabilities(call->msi_call, call-> |
602 | msi_call->self_capabilities | MSI_CAP_S_AUDIO) != 0) { | 602 | msi_call->self_capabilities | MSI_CAP_S_AUDIO) != 0) { |
603 | pthread_mutex_unlock(call->mutex); | 603 | pthread_mutex_unlock(call->toxav_call_mutex); |
604 | pthread_mutex_unlock(av->mutex); | 604 | pthread_mutex_unlock(av->mutex); |
605 | rc = TOXAV_ERR_BIT_RATE_SET_SYNC; | 605 | rc = TOXAV_ERR_BIT_RATE_SET_SYNC; |
606 | goto RETURN; | 606 | goto RETURN; |
@@ -610,7 +610,7 @@ bool toxav_audio_set_bit_rate(ToxAV *av, uint32_t friend_number, uint32_t audio_ | |||
610 | } | 610 | } |
611 | 611 | ||
612 | call->audio_bit_rate = audio_bit_rate; | 612 | call->audio_bit_rate = audio_bit_rate; |
613 | pthread_mutex_unlock(call->mutex); | 613 | pthread_mutex_unlock(call->toxav_call_mutex); |
614 | } | 614 | } |
615 | 615 | ||
616 | pthread_mutex_unlock(av->mutex); | 616 | pthread_mutex_unlock(av->mutex); |
@@ -664,7 +664,7 @@ bool toxav_video_set_bit_rate(ToxAV *av, uint32_t friend_number, uint32_t video_ | |||
664 | 664 | ||
665 | call->video_bit_rate = 0; | 665 | call->video_bit_rate = 0; |
666 | } else { | 666 | } else { |
667 | pthread_mutex_lock(call->mutex); | 667 | pthread_mutex_lock(call->toxav_call_mutex); |
668 | 668 | ||
669 | if (call->video_bit_rate == 0) { | 669 | if (call->video_bit_rate == 0) { |
670 | LOGGER_DEBUG(av->m->log, "Turned on video sending"); | 670 | LOGGER_DEBUG(av->m->log, "Turned on video sending"); |
@@ -672,7 +672,7 @@ bool toxav_video_set_bit_rate(ToxAV *av, uint32_t friend_number, uint32_t video_ | |||
672 | /* The video has been turned off before this */ | 672 | /* The video has been turned off before this */ |
673 | if (msi_change_capabilities(call->msi_call, call-> | 673 | if (msi_change_capabilities(call->msi_call, call-> |
674 | msi_call->self_capabilities | MSI_CAP_S_VIDEO) != 0) { | 674 | msi_call->self_capabilities | MSI_CAP_S_VIDEO) != 0) { |
675 | pthread_mutex_unlock(call->mutex); | 675 | pthread_mutex_unlock(call->toxav_call_mutex); |
676 | pthread_mutex_unlock(av->mutex); | 676 | pthread_mutex_unlock(av->mutex); |
677 | rc = TOXAV_ERR_BIT_RATE_SET_SYNC; | 677 | rc = TOXAV_ERR_BIT_RATE_SET_SYNC; |
678 | goto RETURN; | 678 | goto RETURN; |
@@ -682,7 +682,7 @@ bool toxav_video_set_bit_rate(ToxAV *av, uint32_t friend_number, uint32_t video_ | |||
682 | } | 682 | } |
683 | 683 | ||
684 | call->video_bit_rate = video_bit_rate; | 684 | call->video_bit_rate = video_bit_rate; |
685 | pthread_mutex_unlock(call->mutex); | 685 | pthread_mutex_unlock(call->toxav_call_mutex); |
686 | } | 686 | } |
687 | 687 | ||
688 | pthread_mutex_unlock(av->mutex); | 688 | pthread_mutex_unlock(av->mutex); |
@@ -1173,7 +1173,7 @@ static ToxAVCall *call_new(ToxAV *av, uint32_t friend_number, Toxav_Err_Call *er | |||
1173 | call->av = av; | 1173 | call->av = av; |
1174 | call->friend_number = friend_number; | 1174 | call->friend_number = friend_number; |
1175 | 1175 | ||
1176 | if (create_recursive_mutex(call->mutex)) { | 1176 | if (create_recursive_mutex(call->toxav_call_mutex)) { |
1177 | free(call); | 1177 | free(call); |
1178 | call = nullptr; | 1178 | call = nullptr; |
1179 | rc = TOXAV_ERR_CALL_MALLOC; | 1179 | rc = TOXAV_ERR_CALL_MALLOC; |
@@ -1184,7 +1184,7 @@ static ToxAVCall *call_new(ToxAV *av, uint32_t friend_number, Toxav_Err_Call *er | |||
1184 | av->calls = (ToxAVCall **)calloc(sizeof(ToxAVCall *), friend_number + 1); | 1184 | av->calls = (ToxAVCall **)calloc(sizeof(ToxAVCall *), friend_number + 1); |
1185 | 1185 | ||
1186 | if (av->calls == nullptr) { | 1186 | if (av->calls == nullptr) { |
1187 | pthread_mutex_destroy(call->mutex); | 1187 | pthread_mutex_destroy(call->toxav_call_mutex); |
1188 | free(call); | 1188 | free(call); |
1189 | call = nullptr; | 1189 | call = nullptr; |
1190 | rc = TOXAV_ERR_CALL_MALLOC; | 1190 | rc = TOXAV_ERR_CALL_MALLOC; |
@@ -1197,7 +1197,7 @@ static ToxAVCall *call_new(ToxAV *av, uint32_t friend_number, Toxav_Err_Call *er | |||
1197 | ToxAVCall **tmp = (ToxAVCall **)realloc(av->calls, sizeof(ToxAVCall *) * (friend_number + 1)); | 1197 | ToxAVCall **tmp = (ToxAVCall **)realloc(av->calls, sizeof(ToxAVCall *) * (friend_number + 1)); |
1198 | 1198 | ||
1199 | if (tmp == nullptr) { | 1199 | if (tmp == nullptr) { |
1200 | pthread_mutex_destroy(call->mutex); | 1200 | pthread_mutex_destroy(call->toxav_call_mutex); |
1201 | free(call); | 1201 | free(call); |
1202 | call = nullptr; | 1202 | call = nullptr; |
1203 | rc = TOXAV_ERR_CALL_MALLOC; | 1203 | rc = TOXAV_ERR_CALL_MALLOC; |
@@ -1261,7 +1261,7 @@ static ToxAVCall *call_remove(ToxAVCall *call) | |||
1261 | call->msi_call->av_call = nullptr; | 1261 | call->msi_call->av_call = nullptr; |
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | pthread_mutex_destroy(call->mutex); | 1264 | pthread_mutex_destroy(call->toxav_call_mutex); |
1265 | free(call); | 1265 | free(call); |
1266 | 1266 | ||
1267 | if (prev) { | 1267 | if (prev) { |
@@ -1387,8 +1387,8 @@ static void call_kill_transmission(ToxAVCall *call) | |||
1387 | pthread_mutex_unlock(call->mutex_audio); | 1387 | pthread_mutex_unlock(call->mutex_audio); |
1388 | pthread_mutex_lock(call->mutex_video); | 1388 | pthread_mutex_lock(call->mutex_video); |
1389 | pthread_mutex_unlock(call->mutex_video); | 1389 | pthread_mutex_unlock(call->mutex_video); |
1390 | pthread_mutex_lock(call->mutex); | 1390 | pthread_mutex_lock(call->toxav_call_mutex); |
1391 | pthread_mutex_unlock(call->mutex); | 1391 | pthread_mutex_unlock(call->toxav_call_mutex); |
1392 | 1392 | ||
1393 | bwc_kill(call->bwc); | 1393 | bwc_kill(call->bwc); |
1394 | 1394 | ||