Fix double stop in ANSVideoPlayer
This commit is contained in:
@@ -318,13 +318,28 @@ std::vector<ByteTrack::BYTETracker::STrackPtr> ByteTrack::BYTETracker::update(co
|
||||
lost_stracks_ = subStracks(jointStracks(subStracks(lost_stracks_, tracked_stracks_), current_lost_stracks), removed_stracks_);
|
||||
removed_stracks_ = jointStracks(removed_stracks_, current_removed_stracks);
|
||||
|
||||
// Cap removed_stracks_ to prevent unbounded growth. Its only job is to
|
||||
// block re-entry into lost_stracks_ for tracks that have already timed
|
||||
// out (see subStracks(..., removed_stracks_) on the previous line). A
|
||||
// track that's been removed for more than a few hundred frames cannot
|
||||
// plausibly re-appear as "lost" — by then it's been reaped elsewhere
|
||||
// and any new detection would get a fresh track_id. 1 000 entries is
|
||||
// ~100 s at 10 fps per camera, well beyond any re-identification
|
||||
// window. Older entries (front of vector) are dropped first.
|
||||
static constexpr size_t kRemovedCap = 1000;
|
||||
if (removed_stracks_.size() > kRemovedCap) {
|
||||
const size_t drop = removed_stracks_.size() - kRemovedCap;
|
||||
removed_stracks_.erase(removed_stracks_.begin(),
|
||||
removed_stracks_.begin() + drop);
|
||||
}
|
||||
|
||||
std::vector<STrackPtr> tracked_stracks_out, lost_stracks_out;
|
||||
removeDuplicateStracks(tracked_stracks_, lost_stracks_, tracked_stracks_out, lost_stracks_out);
|
||||
tracked_stracks_ = tracked_stracks_out;
|
||||
lost_stracks_ = lost_stracks_out;
|
||||
|
||||
// Diagnostic: report tracker state size at most once every 60 s per instance.
|
||||
// removed_stracks_ is append-only in this implementation — watch it grow.
|
||||
// With the cap above, removed_stracks_ should plateau at <= kRemovedCap.
|
||||
{
|
||||
static thread_local std::chrono::steady_clock::time_point s_nextLog{};
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
|
||||
Reference in New Issue
Block a user