This commit is contained in:
wangjiyu 2025-04-16 10:39:45 +08:00
parent b9a981b57a
commit 8a2389bf68
1 changed files with 4 additions and 2 deletions

View File

@ -359,6 +359,7 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
std::cout << "step2" << std::endl;
np::dtype dtype = np::dtype::get_builtin<int16_t>();
std::cout << "step3" << std::endl;
/*
np::ndarray audioArray = np::from_data(
audioFrame.data, // 数据指针
dtype, // 数据类型 (int16)
@ -366,6 +367,7 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
py::make_tuple(sizeof(int16_t)), // 步长
py::object() // 所有者Python管理
);
*/
std::cout << " 数据拷贝完成" << std::endl;
// 7. 执行回调
@ -380,7 +382,6 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
std::cout << " pyCallback_ repr: " << PyUnicode_AsUTF8(repr) << std::endl;
Py_DECREF(repr); // 必须手动释放
}
/*
// 传递共享内存信息
pyCallback_(
py::str(shm_name), // 共享内存名称
@ -390,7 +391,7 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
audioFrame.numChannels,
audioFrame.channelIndex
);
*/
/*
pyCallback_(
audioArray, // numpy 数组
data_size, // 数据大小
@ -399,6 +400,7 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
audioFrame.numChannels,
audioFrame.channelIndex
);
*/
std::cout << " after callback" << std::endl;
if (PyErr_Occurred()) {
PyObject *type, *value, *traceback;