This commit is contained in:
wangjiyu 2025-04-10 21:23:38 +08:00
parent e43035864e
commit f18c52ad03
1 changed files with 11 additions and 14 deletions

View File

@ -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<PyArray_SimpleNew_t>(numpyApi[93]);
auto PyArray_SimpleNew = reinterpret_cast<PyArray_SimpleNew_t>(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_)
{