first stable version
This commit is contained in:
@@ -1063,11 +1063,15 @@ extern "C" __declspec(dllexport) int GetRTSPCVImage(
|
|||||||
RTSP_DBG("[GetRTSPCVImage] cudaHW: %dx%d data[0]=%p data[1]=%p",
|
RTSP_DBG("[GetRTSPCVImage] cudaHW: %dx%d data[0]=%p data[1]=%p",
|
||||||
cudaHW->width, cudaHW->height,
|
cudaHW->width, cudaHW->height,
|
||||||
(void*)cudaHW->data[0], (void*)cudaHW->data[1]);
|
(void*)cudaHW->data[0], (void*)cudaHW->data[1]);
|
||||||
AVFrame* cpuNV12 = (*Handle)->GetNV12Frame();
|
|
||||||
|
|
||||||
// Acquire a slot from the global pool — survives camera Destroy.
|
// Acquire a slot from the global pool — survives camera Destroy.
|
||||||
GpuNV12Slot* slot = GpuNV12SlotPool::instance().acquire(
|
GpuNV12Slot* slot = GpuNV12SlotPool::instance().acquire(
|
||||||
gpuIdx, cudaHW->width, cudaHW->height);
|
gpuIdx, cudaHW->width, cudaHW->height);
|
||||||
|
|
||||||
|
// Only fetch CPU NV12 if pool slot unavailable (cross-GPU fallback).
|
||||||
|
// When slot is valid, the D2D copy goes GPU→GPU and CPU NV12 is never used.
|
||||||
|
// Skipping av_frame_clone + av_frame_free saves ~0.1ms per frame.
|
||||||
|
AVFrame* cpuNV12 = slot ? nullptr : (*Handle)->GetNV12Frame();
|
||||||
gpu_frame_attach_cuda(*image, cudaHW, gpuIdx, timeStamp, cpuNV12, slot);
|
gpu_frame_attach_cuda(*image, cudaHW, gpuIdx, timeStamp, cpuNV12, slot);
|
||||||
} else {
|
} else {
|
||||||
// HW decode not active — try CPU NV12
|
// HW decode not active — try CPU NV12
|
||||||
|
|||||||
Reference in New Issue
Block a user