Disable NV12 path for ANSCV by default. Currenly use cv::Mat** directly
This commit is contained in:
@@ -621,6 +621,14 @@ namespace ANSCENTER {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
_playerClient->setImageQuality(mode); // 0=fast (AI), 1=quality (display)
|
||||
}
|
||||
void ANSFLVClient::SetTargetFPS(double intervalMs) {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
_playerClient->setTargetFPS(intervalMs); // 0=no limit, 100=~10FPS, 200=~5FPS
|
||||
}
|
||||
void ANSFLVClient::SetNV12FastPath(bool enable) {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
_useNV12FastPath = enable;
|
||||
}
|
||||
AVFrame* ANSFLVClient::GetNV12Frame() {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
return _playerClient->getNV12Frame(); // Returns clone, caller must av_frame_free
|
||||
@@ -767,17 +775,18 @@ extern "C" __declspec(dllexport) int GetFLVCVImage(ANSCENTER::ANSFLVClient** Han
|
||||
// Thread-safe Mat pointer swap (anscv_mat_replace has its own internal lock)
|
||||
anscv_mat_replace(image, std::move(img));
|
||||
|
||||
// Attach NV12 frame for GPU fast-path inference (side-table registry)
|
||||
// attach() takes ownership — do NOT av_frame_free here
|
||||
int gpuIdx = (*Handle)->GetHWDecodingGpuIndex();
|
||||
AVFrame* cudaHW = (*Handle)->GetCudaHWFrame();
|
||||
if (cudaHW) {
|
||||
AVFrame* cpuNV12 = (*Handle)->GetNV12Frame();
|
||||
gpu_frame_attach_cuda(*image, cudaHW, gpuIdx, timeStamp, cpuNV12);
|
||||
} else {
|
||||
AVFrame* nv12 = (*Handle)->GetNV12Frame();
|
||||
if (nv12) {
|
||||
gpu_frame_attach(*image, nv12, gpuIdx, timeStamp);
|
||||
// NV12 GPU fast path (optional — disabled by default for stability)
|
||||
if ((*Handle)->IsNV12FastPath()) {
|
||||
int gpuIdx = (*Handle)->GetHWDecodingGpuIndex();
|
||||
AVFrame* cudaHW = (*Handle)->GetCudaHWFrame();
|
||||
if (cudaHW) {
|
||||
AVFrame* cpuNV12 = (*Handle)->GetNV12Frame();
|
||||
gpu_frame_attach_cuda(*image, cudaHW, gpuIdx, timeStamp, cpuNV12);
|
||||
} else {
|
||||
AVFrame* nv12 = (*Handle)->GetNV12Frame();
|
||||
if (nv12) {
|
||||
gpu_frame_attach(*image, nv12, gpuIdx, timeStamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -952,6 +961,18 @@ extern "C" __declspec(dllexport) void SetFLVDisplayResolution(ANSCENTER::ANSFLVC
|
||||
(*Handle)->SetDisplayResolution(width, height);
|
||||
} catch (...) { }
|
||||
}
|
||||
extern "C" __declspec(dllexport) void SetFLVTargetFPS(ANSCENTER::ANSFLVClient** Handle, double intervalMs) {
|
||||
if (Handle == nullptr || *Handle == nullptr) return;
|
||||
try {
|
||||
(*Handle)->SetTargetFPS(intervalMs);
|
||||
} catch (...) { }
|
||||
}
|
||||
extern "C" __declspec(dllexport) void SetFLVNV12FastPath(ANSCENTER::ANSFLVClient** Handle, int enable) {
|
||||
if (Handle == nullptr || *Handle == nullptr) return;
|
||||
try {
|
||||
(*Handle)->SetNV12FastPath(enable != 0);
|
||||
} catch (...) { }
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// V2 entry points — accept handle by value (uint64_t) instead of Handle**
|
||||
|
||||
Reference in New Issue
Block a user