This commit is contained in:
wangjiyu 2025-04-15 17:40:52 +08:00
parent 287bd759a1
commit 34306dcaca
1 changed files with 12 additions and 1 deletions

View File

@ -105,7 +105,18 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
//PyGILState_STATE gstate = PyGILState_Ensure();
std::cout << "data:" << audioFrame.data << std::endl;
std::cout << "当前线程是否持有 GIL: " << PyGILState_Check() << std::endl;
std::cout << "数据类型: " << py::extract<std::string>(py::str(dtype))() << std::endl;
try {
py::object str_repr = py::str(dtype);
if(str_repr.ptr() != Py_None) {
std::string dtype_str = py::extract<std::string>(str_repr);
std::cout << "数据类型: " << dtype_str << std::endl;
} else {
std::cout << "数据类型: None" << std::endl;
}
} catch (const py::error_already_set&) {
std::cout<< "数据类型转换错误" << std::endl;
PyErr_Clear();
}
std::cout << "数据形状: " << shape[0] << std::endl;
np::ndarray audioArray = np::from_data(
audioFrame.data, // 数据指针