Fix crash on ending ar session with async ar recorder
This commit is contained in:
@@ -53,6 +53,7 @@ namespace OpenVulkano::AR
|
|||||||
ArRecorder::~ArRecorder()
|
ArRecorder::~ArRecorder()
|
||||||
{
|
{
|
||||||
if (!m_settings.asyncRecording) WriteMetadataFile();
|
if (!m_settings.asyncRecording) WriteMetadataFile();
|
||||||
|
else m_asyncProcessor.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArRecorder::WriteColorImage(ArFrame* arFrame, MultiPartArchiveWriter* colorWriter, const std::filesystem::path* path, bool highRes) const
|
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() })
|
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()
|
ArRecorder::AsyncProcessor::~AsyncProcessor()
|
||||||
{
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ArRecorder::AsyncProcessor::Close()
|
||||||
|
{
|
||||||
|
if (requestExit) return;
|
||||||
requestExit = true;
|
requestExit = true;
|
||||||
newDataAvailable.notify_one();
|
newDataAvailable.notify_one();
|
||||||
if (std::this_thread::get_id() != processingThread.get_id())
|
if (std::this_thread::get_id() != processingThread.get_id())
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ namespace OpenVulkano::AR
|
|||||||
|
|
||||||
explicit AsyncProcessor(ArRecorder* recorder);
|
explicit AsyncProcessor(ArRecorder* recorder);
|
||||||
~AsyncProcessor();
|
~AsyncProcessor();
|
||||||
|
void Close();
|
||||||
void Queue(const std::shared_ptr<ArFrame>& frame, bool highRes);
|
void Queue(const std::shared_ptr<ArFrame>& frame, bool highRes);
|
||||||
void Handler();
|
void Handler();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user