Fix client freeze when exiting
This commit is contained in:
@@ -128,8 +128,7 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
scenes::stream::~stream()
|
||||
{
|
||||
cleanup();
|
||||
exiting = true;
|
||||
shard_queue.close();
|
||||
exit();
|
||||
|
||||
video_thread.join();
|
||||
if (tracking_thread)
|
||||
@@ -405,6 +404,13 @@ void scenes::stream::render()
|
||||
read_actions();
|
||||
}
|
||||
|
||||
void scenes::stream::exit()
|
||||
{
|
||||
exiting = true;
|
||||
audio_handle.reset();
|
||||
shard_queue.close();
|
||||
}
|
||||
|
||||
void scenes::stream::cleanup()
|
||||
{
|
||||
// Assumes decoder_mutex is locked
|
||||
@@ -556,7 +562,7 @@ void scenes::stream::video()
|
||||
catch (std::exception & e)
|
||||
{
|
||||
spdlog::error("Exception in video thread: {}", e.what());
|
||||
exiting = true;
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,6 +134,7 @@ private:
|
||||
void read_actions();
|
||||
|
||||
void setup(const to_headset::video_stream_description &);
|
||||
void exit();
|
||||
void cleanup();
|
||||
};
|
||||
} // namespace scenes
|
||||
|
||||
@@ -32,7 +32,7 @@ void scenes::stream::process_packets()
|
||||
catch (std::exception & e)
|
||||
{
|
||||
spdlog::info("Exception in network thread, exiting: {}", e.what());
|
||||
exiting = true;
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ void scenes::stream::tracking()
|
||||
catch (std::exception & e)
|
||||
{
|
||||
spdlog::info("Exception in tracking thread, exiting: {}", e.what());
|
||||
exiting = true;
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user