This commit is contained in:
wangjiyu 2025-04-09 18:24:55 +08:00
parent f407bebbb5
commit 614a214fb1
1 changed files with 4 additions and 2 deletions

View File

@ -4,6 +4,7 @@
#include "./util/RTCContext.h" #include "./util/RTCContext.h"
namespace py = boost::python;
int init(const char* selfUserId, const char* selfDisplayName, const char* selfRoomId, boost::python::object callback) { int init(const char* selfUserId, const char* selfDisplayName, const char* selfRoomId, boost::python::object callback) {
RTCContext::instance().setPyCallback(callback); RTCContext::instance().setPyCallback(callback);
@ -30,13 +31,14 @@ int initSend(const char* destRoomId, const int16_t destChannelIndex) {
return -1; return -1;
} }
} }
int sendCustomAudioData(const int16_t destChannelIndex, void* customData, int32_t sampleRate, uint64_t channelNum, int sendCustomAudioData(const int16_t destChannelIndex, py::object pyData, int32_t sampleRate, uint64_t channelNum,
uint64_t dataLen) { uint64_t dataLen) {
PyObject* pyObj = pyData.ptr();
void* dataPtr = PyArray_DATA((PyArrayObject*)pyObj);
return RTCContext::instance().sendCustomAudioData(destChannelIndex, customData, sampleRate, channelNum, dataLen); return RTCContext::instance().sendCustomAudioData(destChannelIndex, customData, sampleRate, channelNum, dataLen);
} }
BOOST_PYTHON_MODULE(rtc_plugins) { BOOST_PYTHON_MODULE(rtc_plugins) {
namespace py = boost::python;
py::def("init", &init); py::def("init", &init);
py::def("initRecv", &initRecv); py::def("initRecv", &initRecv);
py::def("initSend", &initSend); py::def("initSend", &initSend);