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