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

Make sure conference audio calls are properly flagged

This fixes a bug causing the conference audio noise animations
and indicators from properly displaying
This commit is contained in:
jfreegman 2021-11-20 10:16:47 -05:00
parent b7002ef3f0
commit 0a708e4a2e
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
3 changed files with 19 additions and 7 deletions

View File

@ -1334,7 +1334,7 @@ bool toggle_conference_push_to_talk(uint32_t conferencenum, bool enabled)
return true; return true;
} }
bool enable_conference_audio(Tox *tox, uint32_t conferencenum) bool enable_conference_audio(ToxWindow *self, Tox *tox, uint32_t conferencenum)
{ {
if (!toxav_groupchat_av_enabled(tox, conferencenum)) { if (!toxav_groupchat_av_enabled(tox, conferencenum)) {
if (toxav_groupchat_enable_av(tox, conferencenum, audio_conference_callback, NULL) != 0) { if (toxav_groupchat_enable_av(tox, conferencenum, audio_conference_callback, NULL) != 0) {
@ -1342,10 +1342,16 @@ bool enable_conference_audio(Tox *tox, uint32_t conferencenum)
} }
} }
return init_conference_audio_input(tox, conferencenum); bool success = init_conference_audio_input(tox, conferencenum);
if (success) {
self->is_call = true;
}
return success;
} }
bool disable_conference_audio(Tox *tox, uint32_t conferencenum) bool disable_conference_audio(ToxWindow *self, Tox *tox, uint32_t conferencenum)
{ {
ConferenceChat *chat = &conferences[conferencenum]; ConferenceChat *chat = &conferences[conferencenum];
@ -1358,7 +1364,13 @@ bool disable_conference_audio(Tox *tox, uint32_t conferencenum)
chat->audio_enabled = false; chat->audio_enabled = false;
} }
return toxav_groupchat_disable_av(tox, conferencenum) == 0; bool success = toxav_groupchat_disable_av(tox, conferencenum) == 0;
if (success) {
self->is_call = false;
}
return success;
} }
bool conference_mute_self(uint32_t conferencenum) bool conference_mute_self(uint32_t conferencenum)

View File

@ -103,8 +103,8 @@ uint32_t get_name_list_entries_by_prefix(uint32_t conferencenum, const char *pre
uint32_t maxpeers); uint32_t maxpeers);
bool init_conference_audio_input(Tox *tox, uint32_t conferencenum); bool init_conference_audio_input(Tox *tox, uint32_t conferencenum);
bool enable_conference_audio(Tox *tox, uint32_t conferencenum); bool enable_conference_audio(ToxWindow *self, Tox *tox, uint32_t conferencenum);
bool disable_conference_audio(Tox *tox, uint32_t conferencenum); bool disable_conference_audio(ToxWindow *self, Tox *tox, uint32_t conferencenum);
bool toggle_conference_push_to_talk(uint32_t conferencenum, bool enabled); bool toggle_conference_push_to_talk(uint32_t conferencenum, bool enabled);
void audio_conference_callback(void *tox, uint32_t conferencenum, uint32_t peernum, void audio_conference_callback(void *tox, uint32_t conferencenum, uint32_t peernum,
const int16_t *pcm, unsigned int samples, uint8_t channels, uint32_t const int16_t *pcm, unsigned int samples, uint8_t channels, uint32_t

View File

@ -108,7 +108,7 @@ void cmd_enable_audio(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*
return; return;
} }
if (enable ? enable_conference_audio(m, self->num) : disable_conference_audio(m, self->num)) { if (enable ? enable_conference_audio(self, m, self->num) : disable_conference_audio(self, m, self->num)) {
print_err(self, enable ? "Enabled conference audio. Use the '/ptt' command to toggle Push-To-Talk." print_err(self, enable ? "Enabled conference audio. Use the '/ptt' command to toggle Push-To-Talk."
: "Disabled conference audio"); : "Disabled conference audio");
} else { } else {