Preserve stream capture settings and refine audio playback
This commit is contained in:
1 parent
198ebc0acb
commit
d60f8e4b1b
16 files changed
+244
-43
No files matched your search
@@ -83,13 +83,15 @@ static void unixSignalHandler(int) { g_signalFlag = 1; }
|
||||
#endif
|
||||
|
||||
/* Сохранение key/value в БД (ui_state). Пишется из utun-потока через trampoline,
|
||||
чтобы не трогать sqlite из GUI-потока. Буфер формата key\0value\0, ≤256 байт. */
|
||||
чтобы не трогать sqlite из GUI-потока. Буфер формата key\0value\0. */
|
||||
static void postUiStateKv(const char* key, const QString& value) {
|
||||
QByteArray val = value.toUtf8();
|
||||
size_t klen = strlen(key), vlen = (size_t)val.size(), total = klen + 1 + vlen + 1;
|
||||
if (total > 256) return;
|
||||
if (total > sizeof(save_ui_state_arg::data)) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CONFIG, "UI setting too large key=%s bytes=%zu", key, total); return;
|
||||
}
|
||||
struct save_ui_state_arg* arg = (struct save_ui_state_arg*)u_malloc(sizeof(struct save_ui_state_arg));
|
||||
if (!arg) return;
|
||||
if (!arg) { DEBUG_ERROR(DEBUG_CATEGORY_CONFIG, "UI setting allocation failed key=%s", key); return; }
|
||||
arg->inst = gui_bridge_get_inst();
|
||||
memcpy(arg->data, key, klen + 1);
|
||||
memcpy(arg->data + klen + 1, val.constData(), vlen + 1);
|
||||
@@ -628,7 +630,10 @@ void MainWindow::setupConnects() {
|
||||
});
|
||||
}
|
||||
if (m_streamPublishWindow) delete m_streamPublishWindow.data();
|
||||
m_streamPublishWindow = new StreamPublishWindow(m_streamPublisher, m_streamPublisher->active() ? m_streamPublisher->group() : group, this);
|
||||
m_streamPublishWindow = new StreamPublishWindow(m_streamPublisher, m_streamPublisher->active() ? m_streamPublisher->group() : group,
|
||||
this, m_db ? m_db->getUiState("stream_capture_settings") : QString());
|
||||
connect(m_streamPublishWindow, &StreamPublishWindow::settingsChanged, this,
|
||||
[](const QString& settings) { postUiStateKv("stream_capture_settings", settings); });
|
||||
m_streamPublishWindow->show(); m_streamPublishWindow->raise(); m_streamPublishWindow->activateWindow();
|
||||
});
|
||||
connect(m_messageList, &MessageList::streamRequested, this,
|
||||
|
||||
Reference in new issue
Block a user