diff --git a/util/RTCContext.cpp b/util/RTCContext.cpp index 4f99c94..7c08d67 100644 --- a/util/RTCContext.cpp +++ b/util/RTCContext.cpp @@ -277,7 +277,7 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId, mrtc::MRTCAudioSourceType audioSourceType) { namespace py = boost::python; - std::cout << "=== 开始音频处理(共享内存版) ===" << std::endl; + std::cout << "=== 开始音频处理 ===" << std::endl; std::cout << "audioFrame:" << audioFrame.dataCount << "," << audioFrame.sampleRate << "," << audioFrame.numChannels << "," << audioFrame.channelIndex << std::endl; @@ -298,6 +298,7 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId, const size_t data_size = audioFrame.dataCount * sizeof(int16_t); + /* // 3. 创建共享内存 std::cout << "[3] 创建共享内存..." << std::endl; char shm_name[32]; @@ -329,12 +330,13 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId, } std::cout << " 映射地址: " << ptr << std::endl; - namespace py = boost::python; - namespace np = boost::python::numpy; // 6. 拷贝数据到共享内存 std::cout << "[6] 拷贝音频数据到共享内存..." << std::endl; memcpy(ptr, audioFrame.data, data_size); + */ std::cout << "step1" << std::endl; + namespace py = boost::python; + namespace np = boost::python::numpy; npy_intp shape[1] = { static_cast(audioFrame.dataCount) }; std::cout << "step2" << std::endl; np::dtype dtype = np::dtype::get_builtin(); @@ -412,9 +414,11 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId, Py_DECREF(pyCallback_.ptr()); } catch (...) { std::cout << "[ERROR] 回调执行失败" << std::endl; + /* munmap(ptr, data_size); close(fd); shm_unlink(shm_name); + */ Py_DECREF(pyCallback_.ptr()); throw; } @@ -425,9 +429,11 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId, // 8. 释放资源 std::cout << "[8] 释放共享内存资源..." << std::endl; + /* munmap(ptr, data_size); close(fd); shm_unlink(shm_name); + */ std::cout << "[9] 释放GIL..." << std::endl; PyGILState_Release(gstate);