Improve ANSCV
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "ANSMatRegistry.h"
|
||||
#include "ANSGpuFrameOps.h"
|
||||
#include "ANSCVVendorGate.h" // anscv_vendor_gate::IsNvidiaGpuAvailable()
|
||||
#include "ANSLicense.h" // ANS_DBG macro
|
||||
#include <memory>
|
||||
#include "media_codec.h"
|
||||
#include <cstdint>
|
||||
@@ -253,6 +254,23 @@ namespace ANSCENTER {
|
||||
return _pLastFrame; // Shallow copy (fast)
|
||||
}
|
||||
|
||||
// Early stale-out: if the decoder hasn't produced a frame in 5s the
|
||||
// source is dead. Skip _playerClient->getImage() entirely and return
|
||||
// the cached frame with unchanged _pts so LabVIEW sees STALE PTS one
|
||||
// poll earlier and triggers reconnect.
|
||||
if (!_pLastFrame.empty()) {
|
||||
double ageMs = _playerClient->getLastFrameAgeMs();
|
||||
if (ageMs >= 5000.0) {
|
||||
ANS_DBG("SRT_GetImage",
|
||||
"EARLY STALE: ageMs=%.1f pts=%lld url=%s — skipping getImage()",
|
||||
ageMs, (long long)_pts, _url.c_str());
|
||||
width = _imageWidth;
|
||||
height = _imageHeight;
|
||||
pts = _pts;
|
||||
return _pLastFrame;
|
||||
}
|
||||
}
|
||||
|
||||
int imageW = 0, imageH = 0;
|
||||
int64_t currentPts = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user