debug
This commit is contained in:
parent
4fa6c56873
commit
5374dae17e
|
@ -277,7 +277,7 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
|
||||||
mrtc::MRTCAudioSourceType audioSourceType)
|
mrtc::MRTCAudioSourceType audioSourceType)
|
||||||
{
|
{
|
||||||
namespace py = boost::python;
|
namespace py = boost::python;
|
||||||
std::cout << "=== 开始音频处理(共享内存版) ===" << std::endl;
|
std::cout << "=== 开始音频处理 ===" << std::endl;
|
||||||
std::cout << "audioFrame:" << audioFrame.dataCount << "," << audioFrame.sampleRate << "," <<
|
std::cout << "audioFrame:" << audioFrame.dataCount << "," << audioFrame.sampleRate << "," <<
|
||||||
audioFrame.numChannels << "," << audioFrame.channelIndex << std::endl;
|
audioFrame.numChannels << "," << audioFrame.channelIndex << std::endl;
|
||||||
|
|
||||||
|
@ -298,6 +298,7 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
|
||||||
|
|
||||||
const size_t data_size = audioFrame.dataCount * sizeof(int16_t);
|
const size_t data_size = audioFrame.dataCount * sizeof(int16_t);
|
||||||
|
|
||||||
|
/*
|
||||||
// 3. 创建共享内存
|
// 3. 创建共享内存
|
||||||
std::cout << "[3] 创建共享内存..." << std::endl;
|
std::cout << "[3] 创建共享内存..." << std::endl;
|
||||||
char shm_name[32];
|
char shm_name[32];
|
||||||
|
@ -329,12 +330,13 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
|
||||||
}
|
}
|
||||||
std::cout << " 映射地址: " << ptr << std::endl;
|
std::cout << " 映射地址: " << ptr << std::endl;
|
||||||
|
|
||||||
namespace py = boost::python;
|
|
||||||
namespace np = boost::python::numpy;
|
|
||||||
// 6. 拷贝数据到共享内存
|
// 6. 拷贝数据到共享内存
|
||||||
std::cout << "[6] 拷贝音频数据到共享内存..." << std::endl;
|
std::cout << "[6] 拷贝音频数据到共享内存..." << std::endl;
|
||||||
memcpy(ptr, audioFrame.data, data_size);
|
memcpy(ptr, audioFrame.data, data_size);
|
||||||
|
*/
|
||||||
std::cout << "step1" << std::endl;
|
std::cout << "step1" << std::endl;
|
||||||
|
namespace py = boost::python;
|
||||||
|
namespace np = boost::python::numpy;
|
||||||
npy_intp shape[1] = { static_cast<npy_intp>(audioFrame.dataCount) };
|
npy_intp shape[1] = { static_cast<npy_intp>(audioFrame.dataCount) };
|
||||||
std::cout << "step2" << std::endl;
|
std::cout << "step2" << std::endl;
|
||||||
np::dtype dtype = np::dtype::get_builtin<int16_t>();
|
np::dtype dtype = np::dtype::get_builtin<int16_t>();
|
||||||
|
@ -412,9 +414,11 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
|
||||||
Py_DECREF(pyCallback_.ptr());
|
Py_DECREF(pyCallback_.ptr());
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
std::cout << "[ERROR] 回调执行失败" << std::endl;
|
std::cout << "[ERROR] 回调执行失败" << std::endl;
|
||||||
|
/*
|
||||||
munmap(ptr, data_size);
|
munmap(ptr, data_size);
|
||||||
close(fd);
|
close(fd);
|
||||||
shm_unlink(shm_name);
|
shm_unlink(shm_name);
|
||||||
|
*/
|
||||||
Py_DECREF(pyCallback_.ptr());
|
Py_DECREF(pyCallback_.ptr());
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
@ -425,9 +429,11 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
|
||||||
|
|
||||||
// 8. 释放资源
|
// 8. 释放资源
|
||||||
std::cout << "[8] 释放共享内存资源..." << std::endl;
|
std::cout << "[8] 释放共享内存资源..." << std::endl;
|
||||||
|
/*
|
||||||
munmap(ptr, data_size);
|
munmap(ptr, data_size);
|
||||||
close(fd);
|
close(fd);
|
||||||
shm_unlink(shm_name);
|
shm_unlink(shm_name);
|
||||||
|
*/
|
||||||
|
|
||||||
std::cout << "[9] 释放GIL..." << std::endl;
|
std::cout << "[9] 释放GIL..." << std::endl;
|
||||||
PyGILState_Release(gstate);
|
PyGILState_Release(gstate);
|
||||||
|
|
Loading…
Reference in New Issue