Skip to content

Commit b9fbf69

Browse files
janherlingmetameta-codesync[bot]
authored andcommitted
Ocean: Fail trackRecording() when the recording yields no trackable frame
Summary: `trackRecording()` fell into an unconditional success tail. If `devicePlayer.playNextFrame()` returned an invalid timestamp on the very first iteration, an empty or exhausted recording, the loop broke immediately and the function returned true after moving a still null `anyCamera` and an empty `database` to the caller. It now returns false when no frame was tracked, leaving the output parameters untouched like every other early exit in the function. `Database::isEmpty<false>()` is the right predicate and subsumes a separate null camera test: `trackFrame()` adds a pose unconditionally at line 68, so an empty database means no frame was tracked, which in turn means `currentAnyCamera` was never assigned. The sibling reimplementation gates identically at `OnDeviceMapCreatorTracker6DOF.cpp:178`. No caller exists in fbsource, the only in-repo user of the class reimplements the same loop, so this is reachable through the public API only. ___ Differential Revision: D115260381 fbshipit-source-id: 5e9bb70f6d6f803ad27db300a0c1e48b347969fa
1 parent 582942f commit b9fbf69

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

impl/ocean/tracking/mapbuilding/PatchTracker.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,14 @@ bool PatchTracker::trackRecording(Devices::DevicePlayer& devicePlayer, const Str
300300
#endif
301301
}
302302

303+
if (patchTracker.database_.isEmpty<false>())
304+
{
305+
Log::error() << "The recording did not provide any trackable frame.";
306+
return false;
307+
}
308+
309+
ocean_assert(currentAnyCamera);
310+
303311
anyCamera = std::move(currentAnyCamera);
304312

305313
database = std::move(patchTracker.database_);

0 commit comments

Comments
 (0)