1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 01:53:02 +01:00

Properly close audio devices on quit

This commit is contained in:
Jfreegman 2015-11-12 17:14:10 -05:00
parent ab99c1ac73
commit 65c07a57db
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
2 changed files with 7 additions and 8 deletions

View File

@ -570,7 +570,7 @@ void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
{ {
const char *error_str = NULL; const char *error_str = NULL;
if ( !self->is_call) { if ( !self->is_call ) {
error_str = "Not in a call."; error_str = "Not in a call.";
goto on_error; goto on_error;
} }
@ -587,11 +587,8 @@ void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
#ifdef VIDEO #ifdef VIDEO
callback_video_end(self->num); callback_video_end(self->num);
#endif /* VIDEO */ #endif /* VIDEO */
if ( CallControl.pending_call ) { if ( CallControl.pending_call ) {
/* Manually send a cancel call control because call hasn't started */ /* Manually send a cancel call control because call hasn't started */
toxav_call_control(CallControl.av, self->num, TOXAV_CALL_CONTROL_CANCEL, NULL); toxav_call_control(CallControl.av, self->num, TOXAV_CALL_CONTROL_CANCEL, NULL);
@ -836,6 +833,8 @@ on_error:
void stop_current_call(ToxWindow* self) void stop_current_call(ToxWindow* self)
{ {
TOXAV_ERR_CALL_CONTROL error; Call *this_call = &CallControl.calls[self->num];
toxav_call_control(CallControl.av, self->num, TOXAV_CALL_CONTROL_CANCEL, &error);
if (this_call && self->is_call)
stop_transmission(this_call, self->num);
} }

View File

@ -68,7 +68,7 @@ static void kill_infobox(ToxWindow *self);
#ifdef AUDIO #ifdef AUDIO
#define AC_NUM_CHAT_COMMANDS 30 #define AC_NUM_CHAT_COMMANDS 30
#else #else
#define AC_NUM_CHAT_COMMANDS 23 #define AC_NUM_CHAT_COMMANDS 22
#endif /* AUDIO */ #endif /* AUDIO */
/* Array of chat command names used for tab completion. */ /* Array of chat command names used for tab completion. */
@ -95,7 +95,6 @@ static const char chat_cmd_list[AC_NUM_CHAT_COMMANDS][MAX_CMDNAME_SIZE] = {
{ "/savefile" }, { "/savefile" },
{ "/sendfile" }, { "/sendfile" },
{ "/status" }, { "/status" },
{ "/video" },
#ifdef AUDIO #ifdef AUDIO
@ -106,6 +105,7 @@ static const char chat_cmd_list[AC_NUM_CHAT_COMMANDS][MAX_CMDNAME_SIZE] = {
{ "/sdev" }, { "/sdev" },
{ "/mute" }, { "/mute" },
{ "/sense" }, { "/sense" },
{ "/video" },
#endif /* AUDIO */ #endif /* AUDIO */
}; };