This commit is contained in:
wangjiyu 2025-04-15 19:41:16 +08:00
parent 3dd6a84c5d
commit 9c8c15a924
1 changed files with 5 additions and 5 deletions

View File

@ -72,8 +72,8 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
std::cout << "[1] 获取GIL锁..." << std::endl; std::cout << "[1] 获取GIL锁..." << std::endl;
#ifdef GIL #ifdef GIL
//PyGILState_STATE gstate = PyGILState_Ensure(); //PyGILState_STATE gstate = PyGILState_Ensure();
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS;
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS;
#endif #endif
try { try {
@ -190,7 +190,7 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
std::cout << "[9] 释放GIL..." << std::endl; std::cout << "[9] 释放GIL..." << std::endl;
#ifdef GIL #ifdef GIL
//PyGILState_Release(gstate); //PyGILState_Release(gstate);
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS;
#endif #endif
std::cout << "=== 音频处理完成 ===" << std::endl; std::cout << "=== 音频处理完成 ===" << std::endl;
@ -198,13 +198,13 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
std::cout << "[EXCEPTION] 异常捕获: " << e.what() << std::endl; std::cout << "[EXCEPTION] 异常捕获: " << e.what() << std::endl;
#ifdef GIL #ifdef GIL
//PyGILState_Release(gstate); //PyGILState_Release(gstate);
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS;
#endif #endif
std::cerr << "Audio process error: " << e.what() << std::endl; std::cerr << "Audio process error: " << e.what() << std::endl;
} }
#ifdef GIL #ifdef GIL
//PyGILState_Release(gstate); //PyGILState_Release(gstate);
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS;
#endif #endif
} }