fix: audio close status sync

This commit is contained in:
Kingtous 2023-02-07 19:09:22 +08:00
parent 795b0068d0
commit db8b6d618f
2 changed files with 13 additions and 2 deletions

View File

@ -1249,8 +1249,15 @@ impl<T: InvokeUiSession> Remote<T> {
self.handler self.handler
.msgbox(&msgbox.msgtype, &msgbox.title, &msgbox.text, &link); .msgbox(&msgbox.msgtype, &msgbox.title, &msgbox.text, &link);
} }
Some(message::Union::VoiceCallRequest(_request)) => { Some(message::Union::VoiceCallRequest(request)) => {
// TODO: maybe we will do voice call from the peer. if request.is_connect {
// TODO: maybe we will do voice call from the peer in the future.
} else {
if let Some(sender) = self.stop_voice_call_sender.take() {
allow_err!(sender.send(()));
self.handler.on_voice_call_closed("");
}
}
} }
Some(message::Union::VoiceCallResponse(response)) => { Some(message::Union::VoiceCallResponse(response)) => {
let ts = std::mem::replace(&mut self.voice_call_request_timestamp, None); let ts = std::mem::replace(&mut self.voice_call_request_timestamp, None);

View File

@ -402,6 +402,9 @@ impl Connection {
} }
ipc::Data::CloseVoiceCall(_reason) => { ipc::Data::CloseVoiceCall(_reason) => {
conn.close_voice_call().await; conn.close_voice_call().await;
// Notify the peer that we closed the voice call.
let req = new_voice_call_request(false);
conn.send(req).await;
} }
_ => {} _ => {}
} }
@ -1639,6 +1642,7 @@ impl Connection {
if let Some(sound_input) = std::mem::replace(&mut self.audio_input_device_before_voice_call, None) { if let Some(sound_input) = std::mem::replace(&mut self.audio_input_device_before_voice_call, None) {
set_sound_input(sound_input); set_sound_input(sound_input);
} }
// Notify the connection manager that the voice call has been closed.
self.send_to_cm(Data::CloseVoiceCall("".to_owned())); self.send_to_cm(Data::CloseVoiceCall("".to_owned()));
} }