Don't use AR recorder in playback mode
This commit is contained in:
@@ -47,6 +47,7 @@ namespace OpenVulkano::AR
|
||||
ArRecorder::ArRecorder(ArSession* session)
|
||||
: m_session(session), m_asyncProcessor(this)
|
||||
{
|
||||
if (!session) return;
|
||||
m_settings.path = GeneratePath(AppFolders::GetAppDataHomeDir(), "ar_recording");
|
||||
session->OnNewFrameHighResolution += EventHandler(this, &ArRecorder::SaveHighResolution);
|
||||
}
|
||||
@@ -158,6 +159,7 @@ namespace OpenVulkano::AR
|
||||
|
||||
void ArRecorder::Start()
|
||||
{
|
||||
if (!m_session) return;
|
||||
if (!m_colorWriter)
|
||||
{
|
||||
m_colorWriter = std::make_unique<MultiPartArchiveWriter>(m_settings.path.string(), "color_{:05d}.tar", ArchiveConfig::TAR, m_settings.archiveSize, true);
|
||||
@@ -185,6 +187,7 @@ namespace OpenVulkano::AR
|
||||
|
||||
void ArRecorder::SetRecordingPath(const std::string& path)
|
||||
{
|
||||
if (!m_session) return;
|
||||
if (!m_colorWriter)
|
||||
{
|
||||
std::filesystem::path p(path);
|
||||
@@ -202,6 +205,7 @@ namespace OpenVulkano::AR
|
||||
|
||||
void ArRecorder::SetRecordingMode(RecordingMode mode)
|
||||
{
|
||||
if (!m_session) return;
|
||||
if (m_settings.recordingMode == mode) return;
|
||||
if (m_settings.recordingMode == RecordingMode::NEW_FRAME && m_newFrameHandler)
|
||||
{
|
||||
@@ -261,6 +265,7 @@ namespace OpenVulkano::AR
|
||||
void ArRecorder::AsyncProcessor::Handler()
|
||||
{
|
||||
Utils::SetThreadName("ArRecorder");
|
||||
if (!recorder->m_session) return;
|
||||
std::unique_lock lock(queueMutex);
|
||||
do
|
||||
{
|
||||
@@ -269,7 +274,7 @@ namespace OpenVulkano::AR
|
||||
{
|
||||
auto frame = std::move(highResFrameQueue.front());
|
||||
highResFrameQueue.pop();
|
||||
if (frame->IsSaved()) continue;
|
||||
if (!frame || frame->IsSaved()) continue;
|
||||
lock.unlock();
|
||||
recorder->Write(frame.get(), true);
|
||||
lock.lock();
|
||||
@@ -284,7 +289,7 @@ namespace OpenVulkano::AR
|
||||
}
|
||||
auto frame = std::move(frameQueue.front());
|
||||
frameQueue.pop();
|
||||
if (frame->IsSaved()) continue;
|
||||
if (!frame || frame->IsSaved()) continue;
|
||||
lock.unlock();
|
||||
recorder->Write(frame.get(), false);
|
||||
lock.lock();
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace OpenVulkano::AR
|
||||
class ArSession
|
||||
{
|
||||
protected:
|
||||
ArSession(const ArSessionMetadata& metadata) : metadata(metadata), recorder(this) {}
|
||||
ArSession(const ArSessionMetadata& metadata) : metadata(metadata), recorder(metadata.playback ? nullptr : this) {}
|
||||
|
||||
public:
|
||||
/**
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace OpenVulkano::AR
|
||||
type = metaFromFile->type;
|
||||
depthFormat = metaFromFile->depthFormat;
|
||||
confidenceRange = metaFromFile->confidenceRange;
|
||||
playback = true;
|
||||
}
|
||||
|
||||
std::string ArSessionMetadata::ToXML() const
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace OpenVulkano::AR
|
||||
ArType type;
|
||||
ArDepthFormat depthFormat;
|
||||
Math::Range<uint8_t> confidenceRange;
|
||||
bool playback = false;
|
||||
|
||||
ArSessionMetadata() noexcept
|
||||
: ArSessionMetadata(ArType::UNKNOWN, ArDepthFormat::UNAVAILABLE, {0,0})
|
||||
|
||||
Reference in New Issue
Block a user