This commit is contained in:
wangjiyu 2025-04-15 17:20:33 +08:00
parent 2fd9f33a68
commit aced2e2308
1 changed files with 3 additions and 2 deletions

View File

@ -69,7 +69,7 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
std::cerr << "Python 解释器未初始化!" << std::endl; std::cerr << "Python 解释器未初始化!" << std::endl;
return; return;
} }
//PyGILState_STATE gstate = PyGILState_Ensure(); PyGILState_STATE gstate = PyGILState_Ensure();
namespace py = boost::python; namespace py = boost::python;
try { try {
@ -108,6 +108,7 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
} }
*/ */
//PyGILState_STATE gstate = PyGILState_Ensure();
np::ndarray audioArray = np::from_data( np::ndarray audioArray = np::from_data(
audioFrame.data, // 数据指针 audioFrame.data, // 数据指针
dtype, // 数据类型 (int16) dtype, // 数据类型 (int16)
@ -124,7 +125,7 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
audioFrame.numChannels, audioFrame.numChannels,
audioFrame.channelIndex audioFrame.channelIndex
); );
PyGILState_Release(gstate); //PyGILState_Release(gstate);
std::cout << " after callback" << std::endl; std::cout << " after callback" << std::endl;
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
PyObject *type, *value, *traceback; PyObject *type, *value, *traceback;