Add jitter buffer
This commit is contained in:
@@ -37,6 +37,11 @@ namespace ANSCENTER
|
||||
std::string _lastJpegImage;
|
||||
int _imageWidth,_imageHeight;
|
||||
int64_t _pts;
|
||||
// Last currentPts seen from the inner getImage(). Used for duplicate
|
||||
// detection separately from _pts (which gets synthetically incremented
|
||||
// for LabVIEW's staleness check). Keeping these decoupled fixes the
|
||||
// "every other dup goes through new-frame path" inefficiency.
|
||||
int64_t _lastInnerPts = -1;
|
||||
bool _isPlaying;
|
||||
bool _useNV12FastPath = false; // false = original stable CPU path, true = NV12 GPU fast path
|
||||
std::recursive_mutex _mutex;
|
||||
@@ -104,6 +109,21 @@ namespace ANSCENTER
|
||||
void SetDisplayResolution(int width, int height); // Set display output size; 0,0 = original (no resize)
|
||||
void SetImageQuality(int mode); // 0=fast (AI), 1=quality (display)
|
||||
void SetTargetFPS(double intervalMs); // Set min interval between processed frames in ms (0 = no limit, 100 = ~10 FPS, 200 = ~5 FPS)
|
||||
// Jitter buffer for the BGR delivery path. Holds frames ms milliseconds
|
||||
// before releasing to absorb network/decoder hiccups. 0 = today's
|
||||
// getLatest semantics. Default in CVideoPlayer is 200 ms.
|
||||
// Adaptive: if the consumer is slower than the producer, drop-ahead
|
||||
// keeps latency bounded — slow callers (LabVIEW polling at 1-5 Hz)
|
||||
// effectively bypass the buffer.
|
||||
// Inference path (NV12/CUDA fast-path) is unaffected — it always
|
||||
// receives the latest decoded frame regardless of this setting.
|
||||
void SetJitterBufferMs(int ms);
|
||||
int GetJitterBufferMs() const;
|
||||
// Transport for RTP packets. true = RTP/UDP (lower latency, no TCP head-of-line
|
||||
// blocking — recommended on LAN). false = RTP/RTSP/TCP interleaved (default, more
|
||||
// firewall-friendly but bursts on packet loss / large I-frames).
|
||||
// MUST be called BEFORE Start() / StartRTSP — the SETUP request is sent inside play().
|
||||
void SetRtpOverUdp(bool useUdp);
|
||||
void SetNV12FastPath(bool enable); // true = NV12 GPU fast path (zero-copy inference), false = original CPU path (stable)
|
||||
bool IsNV12FastPath() const { return _useNV12FastPath; }
|
||||
double GetLastFrameAgeMs(); // Milliseconds since last frame from decoder (detects truly stale cameras, unaffected by SetTargetFPS)
|
||||
@@ -145,6 +165,9 @@ extern "C" __declspec(dllexport) int GetRTSPHWDecodingGpuIndex(ANSCENTER::ANSRT
|
||||
extern "C" __declspec(dllexport) void SetRTSPImageQuality(ANSCENTER::ANSRTSPClient** Handle, int mode);
|
||||
extern "C" __declspec(dllexport) void SetRTSPDisplayResolution(ANSCENTER::ANSRTSPClient** Handle, int width, int height);
|
||||
extern "C" __declspec(dllexport) void SetRTSPTargetFPS(ANSCENTER::ANSRTSPClient** Handle, double intervalMs);
|
||||
extern "C" __declspec(dllexport) void SetRTSPRtpOverUdp(ANSCENTER::ANSRTSPClient** Handle, int useUdp);
|
||||
extern "C" __declspec(dllexport) void SetRTSPJitterBuffer(ANSCENTER::ANSRTSPClient** Handle, int jitterMs);
|
||||
extern "C" __declspec(dllexport) int GetRTSPJitterBuffer(ANSCENTER::ANSRTSPClient** Handle);
|
||||
extern "C" __declspec(dllexport) void SetRTSPNV12FastPath(ANSCENTER::ANSRTSPClient** Handle, int enable);
|
||||
extern "C" __declspec(dllexport) double GetRTSPLastFrameAgeMs(ANSCENTER::ANSRTSPClient** Handle);
|
||||
#endif
|
||||
Reference in New Issue
Block a user