Defer source failures and end calls that cannot reserve audio capture

This commit is contained in:
evgeny committed 2026-10-14 02:56:36 +02:00
1 parent 50fad4ceff
commit ce461521e4
2 files changed
+17 -5

No files matched your search

+14 -2
View File
@@ -619,7 +619,12 @@ void MainWindow::setupBridgeCallbacks() {
void MainWindow::setupConnects() {
connect(m_messageList, &MessageList::streamPublishRequested, this, [this](quint64 group) {
if (!m_streamPublisher) m_streamPublisher = new StreamPublishEngine(this);
if (!m_streamPublisher) {
m_streamPublisher = new StreamPublishEngine(this);
connect(m_streamPublisher, &StreamPublishEngine::stateChanged, this, [this](const QString& state) {
if (m_trayIcon) m_trayIcon->setToolTip(m_streamPublisher->active() ? QStringLiteral("vibechat · ") + state : QStringLiteral("vibechat"));
});
}
if (m_streamPublishWindow) delete m_streamPublishWindow.data();
m_streamPublishWindow = new StreamPublishWindow(m_streamPublisher, m_streamPublisher->active() ? m_streamPublisher->group() : group, this);
m_streamPublishWindow->show(); m_streamPublishWindow->raise(); m_streamPublishWindow->activateWindow();
@@ -772,7 +777,14 @@ void MainWindow::onCallAccepted(quint64 callId) {
CallWindow* w = m_activeCalls.value(callId, nullptr);
if (w) w->setState(CallWindow::Active);
if (!s_mainWindow) return;
CallAudioEngine::instance()->start(callId);
if (CallAudioEngine::instance()->start(callId) != 0) {
DEBUG_WARN(DEBUG_CATEGORY_CALL, "desktop call cannot acquire audio; hangup id=%llu", (unsigned long long)callId);
auto* request = static_cast<call_id_arg*>(u_malloc(sizeof(call_id_arg)));
if (request) { request->inst = gui_bridge_get_inst(); request->call_id = callId; gui_bridge_post_uasync_fn(call_hangup_trampoline, request); }
else DEBUG_ERROR(DEBUG_CATEGORY_CALL, "desktop failed call hangup allocation failed");
closeCallWindow(callId);
QMessageBox::information(this, QStringLiteral("vibechat"), QCoreApplication::translate("ChatGui", "The microphone is used by a call, radio or recording"));
}
}
void MainWindow::onCallEnded(quint64 callId, uint8_t reason) {