debug
This commit is contained in:
parent
f18c52ad03
commit
30c05fd514
|
@ -85,9 +85,20 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
|
||||||
throw std::runtime_error("NumPy C-API not initialized. Call import_array() in module init");
|
throw std::runtime_error("NumPy C-API not initialized. Call import_array() in module init");
|
||||||
}
|
}
|
||||||
std::cout << "step2" << std::endl;
|
std::cout << "step2" << std::endl;
|
||||||
|
|
||||||
using PyArray_SimpleNew_t = PyObject*(*)(int, npy_intp*, int);
|
using PyArray_SimpleNew_t = PyObject*(*)(int, npy_intp*, int);
|
||||||
|
|
||||||
|
void* func_ptr = numpyApi_[93];
|
||||||
|
std::cout << "Raw function pointer: " << func_ptr << std::endl;
|
||||||
|
|
||||||
|
// 2. 使用memcpy避免编译器优化问题
|
||||||
|
PyArray_SimpleNew_t PyArray_SimpleNew;
|
||||||
|
static_assert(sizeof(func_ptr) == sizeof(PyArray_SimpleNew),
|
||||||
|
"Pointer size mismatch");
|
||||||
std::cout << "step3" << std::endl;
|
std::cout << "step3" << std::endl;
|
||||||
auto PyArray_SimpleNew = reinterpret_cast<PyArray_SimpleNew_t>(numpyApi_[93]);
|
memcpy(&PyArray_SimpleNew, &func_ptr, sizeof(func_ptr));
|
||||||
|
|
||||||
|
//auto PyArray_SimpleNew = reinterpret_cast<PyArray_SimpleNew_t>(numpyApi_[93]);
|
||||||
std::cout << "step4, PyArray_SimpleNew:" << PyArray_SimpleNew << std::endl;
|
std::cout << "step4, PyArray_SimpleNew:" << PyArray_SimpleNew << std::endl;
|
||||||
|
|
||||||
// 3. 严格校验输入数据
|
// 3. 严格校验输入数据
|
||||||
|
|
Loading…
Reference in New Issue