Connect desktop stream bridge to core lifecycle and events
This commit is contained in:
1 parent
d9821fa89c
commit
0a5b9b50f1
3 files changed
+12
No files matched your search
@@ -253,6 +253,7 @@ void gui_bridge_set_feedback_changed_cb(gui_dm_messages_fn cb);
|
||||
void gui_bridge_set_feedback_result_cb(gui_dm_messages_fn cb);
|
||||
void gui_bridge_set_msg_submitted_cb(gui_dm_messages_fn cb);
|
||||
void gui_bridge_set_radio_mute_result_cb(gui_dm_messages_fn cb);
|
||||
void gui_bridge_set_stream_sources_cb(gui_dm_messages_fn cb);
|
||||
int gui_bridge_toggle_member_radio_mute(const char* channel_id, uint64_t node_id);
|
||||
/* CHAT_EVT_ATTACHMENT_PREPARATION: target + job UUID + state. */
|
||||
void gui_bridge_set_attachment_preparation_cb(gui_dm_messages_fn cb);
|
||||
|
||||
@@ -77,6 +77,7 @@ static gui_dm_messages_fn g_feedback_changed_cb = nullptr;
|
||||
static gui_dm_messages_fn g_feedback_result_cb = nullptr;
|
||||
static gui_dm_messages_fn g_msg_submitted_cb = nullptr;
|
||||
static gui_dm_messages_fn g_radio_mute_result_cb = nullptr;
|
||||
static gui_dm_messages_fn g_stream_sources_cb = nullptr;
|
||||
static gui_network_changed_fn g_network_changed_cb = nullptr;
|
||||
static struct UASYNC* g_ua = nullptr;
|
||||
static struct UTUN_INSTANCE* g_inst = nullptr;
|
||||
@@ -91,6 +92,9 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) {
|
||||
eventType == 16 || eventType == 17 || eventType == 24 || eventType == 25 || eventType == 31 || eventType == 33))
|
||||
g_network_changed_cb(eventType);
|
||||
switch (eventType) {
|
||||
case CHAT_EVT_STREAM_SOURCES:
|
||||
if (g_stream_sources_cb) g_stream_sources_cb(d, dlen);
|
||||
break;
|
||||
case CHAT_EVT_CPU_LOAD:
|
||||
if (dlen != 2 || d[0] > 1 || d[1] > 100) {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SYS, "invalid CPU load response bytes=%d", dlen);
|
||||
@@ -615,6 +619,7 @@ void gui_bridge_set_dm_msg_received_cb(gui_dm_msg_received_fn cb) {
|
||||
}
|
||||
|
||||
void gui_bridge_set_network_changed_cb(gui_network_changed_fn cb) { g_network_changed_cb = cb; }
|
||||
void gui_bridge_set_stream_sources_cb(gui_dm_messages_fn cb) { g_stream_sources_cb = cb; }
|
||||
void gui_bridge_set_dm_call_route_cb(gui_dm_messages_fn cb) { g_dm_call_route_cb = cb; }
|
||||
void gui_bridge_set_dm_invite_result_cb(gui_dm_messages_fn cb) { g_dm_invite_result_cb = cb; }
|
||||
void gui_bridge_set_member_files_response_cb(gui_dm_messages_fn cb) { g_member_files_response_cb = cb; }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// utun_node.cpp — embedded uTun node running in a dedicated thread
|
||||
#include "utun_node.h"
|
||||
#include "stream_bridge.h"
|
||||
#include <cinttypes>
|
||||
#include <QDir>
|
||||
#include "../../lib/socket_compat.h"
|
||||
@@ -246,6 +247,10 @@ void UtunNode::runLoop() {
|
||||
}
|
||||
call_audio_init(m_instance);
|
||||
radio_audio_init(m_instance);
|
||||
if (!gui_stream_attach(m_instance)) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "desktop stream bridge initialization failed");
|
||||
QMetaObject::invokeMethod(this, [this] { emit error("stream bridge initialization failed"); });
|
||||
}
|
||||
chat_core_sync_my_addresses(m_instance);
|
||||
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_GENERAL, "chat_core + chat_sync initialized");
|
||||
@@ -262,6 +267,7 @@ void UtunNode::runLoop() {
|
||||
|
||||
if (m_instance) {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_GENERAL, "runLoop: destroying instance in worker thread");
|
||||
gui_stream_detach(m_instance);
|
||||
call_audio_destroy(m_instance);
|
||||
radio_audio_destroy(m_instance);
|
||||
utun_instance_destroy(m_instance);
|
||||
|
||||
Reference in new issue
Block a user