diff --git a/util/RTCContext.cpp b/util/RTCContext.cpp index 4620f11..31d5972 100644 --- a/util/RTCContext.cpp +++ b/util/RTCContext.cpp @@ -355,14 +355,17 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId, throw std::runtime_error("Python callback error"); } std::cout << " 回调执行成功" << std::endl; - - } catch (...) { - std::cout << "[ERROR] 回调执行失败" << std::endl; - munmap(ptr, data_size); - close(fd); - shm_unlink(shm_name); + } + catch (const py::error_already_set& e) { + std::cerr << "[PYTHON ERROR] " << e.what() << std::endl; + PyErr_Print(); throw; } + catch (...) { + Py_DECREF(pyCallback_.ptr()); + throw; + } + Py_DECREF(pyCallback_.ptr()); } else { std::cout << "[7] 无回调函数设置" << std::endl; }