1
This commit is contained in:
parent
4a2b6f94d4
commit
465d87ce0a
10
src/main.cpp
10
src/main.cpp
@ -100,16 +100,12 @@ int main()
|
|||||||
|
|
||||||
if (ENABLE_RTSP_THREAD)
|
if (ENABLE_RTSP_THREAD)
|
||||||
{
|
{
|
||||||
RTSPManager::stop();
|
RTSPManager::stop(); // 只负责让 g_main_loop_run 跳出
|
||||||
|
|
||||||
auto stop_deadline = std::chrono::steady_clock::now() + std::chrono::seconds(10);
|
|
||||||
while (RTSPManager::is_any_streaming() && std::chrono::steady_clock::now() < stop_deadline)
|
|
||||||
{
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rtsp_thread.joinable())
|
if (rtsp_thread.joinable())
|
||||||
rtsp_thread.join();
|
rtsp_thread.join();
|
||||||
|
|
||||||
|
LOG_INFO("[MAIN] RTSP thread finished and joined.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重置 MQTT 线程等待的截止时间
|
// 重置 MQTT 线程等待的截止时间
|
||||||
|
|||||||
@ -283,10 +283,16 @@ void RTSPManager::stop()
|
|||||||
// 退出 main loop
|
// 退出 main loop
|
||||||
if (loop)
|
if (loop)
|
||||||
{
|
{
|
||||||
g_main_context_invoke(main_context, [](gpointer data) -> gboolean
|
g_main_context_invoke(
|
||||||
|
main_context,
|
||||||
|
[](gpointer data) -> gboolean
|
||||||
{
|
{
|
||||||
g_main_loop_quit(static_cast<GMainLoop *>(data));
|
GMainLoop *lp = static_cast<GMainLoop *>(data);
|
||||||
return G_SOURCE_REMOVE; }, loop);
|
if (lp)
|
||||||
|
g_main_loop_quit(lp);
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
},
|
||||||
|
loop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user