Fix crash on ending ar session with async ar recorder

This commit is contained in:
Georg Hagen
2025-02-03 21:37:33 +01:00
parent c50711308d
commit a8d4946751
2 changed files with 9 additions and 1 deletions

View File

@@ -53,6 +53,7 @@ namespace OpenVulkano::AR
ArRecorder::~ArRecorder()
{
if (!m_settings.asyncRecording) WriteMetadataFile();
else m_asyncProcessor.Close();
}
void ArRecorder::WriteColorImage(ArFrame* arFrame, MultiPartArchiveWriter* colorWriter, const std::filesystem::path* path, bool highRes) const
@@ -191,7 +192,7 @@ namespace OpenVulkano::AR
{
for(MultiPartArchiveWriter* writer : { m_colorWriter.get(), m_depthWriter.get(), m_confidenceWriter.get(), m_metadataWriter.get(), m_highResWriter.get() })
{
writer->Split();
if (writer) writer->Split();
}
}
@@ -282,6 +283,12 @@ namespace OpenVulkano::AR
ArRecorder::AsyncProcessor::~AsyncProcessor()
{
Close();
}
void ArRecorder::AsyncProcessor::Close()
{
if (requestExit) return;
requestExit = true;
newDataAvailable.notify_one();
if (std::this_thread::get_id() != processingThread.get_id())