This commit is contained in:
wangjiyu 2025-04-15 14:43:49 +08:00
parent 5374dae17e
commit 498932385e
1 changed files with 0 additions and 9 deletions

View File

@ -18,16 +18,7 @@ destChannelIndex = 47
def my_callback(shmName, dataSize, dataCount, sampleRate, numChannels, channelIndex):
print(f"dataSize:{dataSize}, dataCount:{dataCount}, sampleRate:{sampleRate}, numChannels:{numChannels}, channelIndex:{channelIndex}")
print(f"data:{shmName}")
#fd = os.open(shmName, os.O_RDONLY)
#if fd == -1:
# raise RuntimeError(f"无法打开共享内存 {shmName}")
## 2. 创建内存映射
#shm = mmap.mmap(fd, dataSize, mmap.MAP_SHARED, mmap.PROT_READ)
## 3. 转换为numpy数组 (零拷贝)
#audio_data = np.frombuffer(shm, dtype=c_int16, count=dataCount)
#print(f" 前5个采样点: {audio_data[:5]}")
#audioData = np.array([0, 1, -1, 0], dtype=np.int16)
#ret = rtc_plugins.sendCustomAudioData(srcChannelIndex, audioData, 48000, 1, len(audioData))
#if ret != 0: