debug
This commit is contained in:
parent
9314c2d7d6
commit
4c50a1b4b7
|
@ -336,6 +336,9 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
|
|||
if (!pyCallback_.is_none()) {
|
||||
std::cout << "[7] 准备执行Python回调..." << std::endl;
|
||||
try {
|
||||
// 增加引用计数防止提前释放
|
||||
Py_INCREF(pyCallback_.ptr());
|
||||
std::cout << " py incr" << std::endl;
|
||||
// 传递共享内存信息
|
||||
pyCallback_(
|
||||
py::str(shm_name), // 共享内存名称
|
||||
|
@ -345,7 +348,13 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
|
|||
audioFrame.numChannels,
|
||||
audioFrame.channelIndex
|
||||
);
|
||||
std::cout << " after callback" << std::endl;
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_Print();
|
||||
throw std::runtime_error("Python callback error");
|
||||
}
|
||||
std::cout << " 回调执行成功" << std::endl;
|
||||
|
||||
} catch (...) {
|
||||
std::cout << "[ERROR] 回调执行失败" << std::endl;
|
||||
munmap(ptr, data_size);
|
||||
|
|
Loading…
Reference in New Issue