From f18c52ad03002a89d33af7d58b70735ae13f0709 Mon Sep 17 00:00:00 2001 From: wangjiyu Date: Thu, 10 Apr 2025 21:23:38 +0800 Subject: [PATCH] debug --- util/RTCContext.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/util/RTCContext.cpp b/util/RTCContext.cpp index e4d527e..d2b6178 100644 --- a/util/RTCContext.cpp +++ b/util/RTCContext.cpp @@ -73,22 +73,21 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId, std::cout << "onAudioProcess, numpyApi_:" << numpyApi_[93] << std::endl; - void** numpyApi = numpyApi_; - if (!numpyApi || !numpyApi[93]) { // 93是PyArray_SimpleNew的偏移量 - std::cout << "numpyApi is null in onAudioProcess" << std::endl; + if (!numpyApi_ || !numpyApi_[93]) { // 93是PyArray_SimpleNew的偏移量 + std::cout << "numpyApi_ is null in onAudioProcess" << std::endl; } else { - std::cout << "numpyApi is not null in onAudioProcess:" << numpyApi[93] << std::endl; + std::cout << "numpyApi_ is not null in onAudioProcess:" << numpyApi_[93] << std::endl; } //auto numpyApi = RTCContext::numpy_api(); std::cout << "step1" << std::endl; - if (!numpyApi) { + if (!numpyApi_) { PyGILState_Release(gstate); throw std::runtime_error("NumPy C-API not initialized. Call import_array() in module init"); } std::cout << "step2" << std::endl; using PyArray_SimpleNew_t = PyObject*(*)(int, npy_intp*, int); std::cout << "step3" << std::endl; - auto PyArray_SimpleNew = reinterpret_cast(numpyApi[93]); + auto PyArray_SimpleNew = reinterpret_cast(numpyApi_[93]); std::cout << "step4, PyArray_SimpleNew:" << PyArray_SimpleNew << std::endl; // 3. 严格校验输入数据 @@ -166,11 +165,10 @@ void RTCContext::onProducer(uint32_t msgId, mrtc::MRTCProducerInfo& info) bool RTCContext::init(const char* selfUserId, const char* selfDisplayName, const char* selfRoomId) { std::cout << "init, numpyApi_:" << numpyApi_[93] << std::endl; - void** numpyApi = numpyApi_; - if (!numpyApi || !numpyApi[93]) { // 93是PyArray_SimpleNew的偏移量 - std::cout << "numpyApi is null in init" << std::endl; + if (!numpyApi_ || !numpyApi_[93]) { // 93是PyArray_SimpleNew的偏移量 + std::cout << "numpyApi_ is null in init" << std::endl; } else { - std::cout << "numpyApi is not null in init" << std::endl; + std::cout << "numpyApi_ is not null in init" << std::endl; } mrtc::IMRTCEngineFactory * rtcFactory = mrtc::getMRTCEngineFactory(); if (!rtcFactory) @@ -223,11 +221,10 @@ bool RTCContext::init(const char* selfUserId, const char* selfDisplayName, const bool RTCContext::initRecv(const char* destRoomId, const char* srcUserId, const int16_t destChannelIndex) { std::cout << "initRecv, numpyApi_:" << numpyApi_[93] << std::endl; - void** numpyApi = numpyApi_; - if (!numpyApi || !numpyApi[93]) { // 93是PyArray_SimpleNew的偏移量 - std::cout << "numpyApi is null in initRecv" << std::endl; + if (!numpyApi_ || !numpyApi_[93]) { // 93是PyArray_SimpleNew的偏移量 + std::cout << "numpyApi_ is null in initRecv" << std::endl; } else { - std::cout << "numpyApi is not null in initRecv" << std::endl; + std::cout << "numpyApi_ is not null in initRecv" << std::endl; } while (!isOnConsumer_) {