This commit is contained in:
wangjiyu 2025-04-10 22:26:16 +08:00
parent d1525f6dfa
commit 66788d2f20
1 changed files with 6 additions and 0 deletions

View File

@ -202,6 +202,12 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
reinterpret_cast<PyArray_SimpleNew_t>(numpyApi_[93]);
std::cout << " 函数地址: " << (void*)PyArray_SimpleNew << std::endl;
std::cout << "[5.1] 验证函数指针..." << std::endl;
void* func_ptr = numpyApi_[93];
if (reinterpret_cast<uintptr_t>(func_ptr) < 0x1000) { // 检查是否为合法地址
std::cerr << "非法函数指针: " << func_ptr << std::endl;
throw std::runtime_error("Invalid PyArray_SimpleNew pointer");
}
// 6. 创建NumPy数组
std::cout << "[6] 创建NumPy数组..." << std::endl;
PyObject* pyArray = PyArray_SimpleNew(1, dims, NPY_INT16);