debug
This commit is contained in:
parent
74b131ad8d
commit
420145ee47
|
@ -33,11 +33,13 @@ int initSend(const char* destRoomId, const int16_t destChannelIndex) {
|
|||
}
|
||||
int sendCustomAudioData(const int16_t destChannelIndex, py::object pyData, int32_t sampleRate, uint64_t channelNum,
|
||||
uint64_t dataLen) {
|
||||
std::cout << "step1" << std::endl;
|
||||
// 检查是否为 numpy 数组
|
||||
if (!PyArray_Check(pyData.ptr())) {
|
||||
PyErr_SetString(PyExc_TypeError, "Expected a numpy array");
|
||||
throw py::error_already_set();
|
||||
}
|
||||
std::cout << "step2" << std::endl;
|
||||
|
||||
// 检查数据类型是否为 int16
|
||||
PyArrayObject* npArray = (PyArrayObject*)pyData.ptr();
|
||||
|
@ -45,12 +47,20 @@ int sendCustomAudioData(const int16_t destChannelIndex, py::object pyData, int32
|
|||
PyErr_SetString(PyExc_TypeError, "Array must be of type int16 (np.int16)");
|
||||
throw py::error_already_set();
|
||||
}
|
||||
std::cout << "step3" << std::endl;
|
||||
if (npArray == nullptr) {
|
||||
std::cout << "npArray is null" << std::endl;
|
||||
PyErr_SetString(PyExc_TypeError, "npArray is null");
|
||||
throw py::error_already_set();
|
||||
}
|
||||
|
||||
std::cout << "step4" << std::endl;
|
||||
void* dataPtr = PyArray_DATA(npArray);
|
||||
if (dataPtr == nullptr) {
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid data pointer");
|
||||
throw py::error_already_set();
|
||||
}
|
||||
std::cout << "step5" << std::endl;
|
||||
return RTCContext::instance().sendCustomAudioData(destChannelIndex, dataPtr, sampleRate, channelNum, dataLen);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue