fix webrtc audio
This commit is contained in:
parent
a3a86bf299
commit
6d4952c1bf
23
nerfreal.py
23
nerfreal.py
|
@ -161,17 +161,20 @@ class NeRFReal:
|
||||||
new_frame = VideoFrame.from_ndarray(image_fullbody, format="rgb24")
|
new_frame = VideoFrame.from_ndarray(image_fullbody, format="rgb24")
|
||||||
asyncio.run_coroutine_threadsafe(video_track._queue.put(new_frame), loop)
|
asyncio.run_coroutine_threadsafe(video_track._queue.put(new_frame), loop)
|
||||||
#self.pipe.stdin.write(image.tostring())
|
#self.pipe.stdin.write(image.tostring())
|
||||||
for _ in range(2):
|
if self.opt.transport=='rtmp':
|
||||||
frame = self.asr.get_audio_out()
|
for _ in range(2):
|
||||||
#print(f'[INFO] get_audio_out shape ',frame.shape)
|
frame = self.asr.get_audio_out()
|
||||||
if self.opt.transport=='rtmp':
|
#print(f'[INFO] get_audio_out shape ',frame.shape)
|
||||||
self.streamer.stream_frame_audio(frame)
|
self.streamer.stream_frame_audio(frame)
|
||||||
else:
|
else:
|
||||||
frame = (frame * 32767).astype(np.int16)
|
frame1 = self.asr.get_audio_out()
|
||||||
new_frame = AudioFrame(format='s16', layout='mono', samples=320)
|
frame2 = self.asr.get_audio_out()
|
||||||
new_frame.planes[0].update(frame.tobytes())
|
frame = np.concatenate((frame1,frame2))
|
||||||
new_frame.sample_rate=16000
|
frame = (frame * 32767).astype(np.int16)
|
||||||
asyncio.run_coroutine_threadsafe(audio_track._queue.put(new_frame), loop)
|
new_frame = AudioFrame(format='s16', layout='mono', samples=frame.shape[0])
|
||||||
|
new_frame.planes[0].update(frame.tobytes())
|
||||||
|
new_frame.sample_rate=16000
|
||||||
|
asyncio.run_coroutine_threadsafe(audio_track._queue.put(new_frame), loop)
|
||||||
# frame = (frame * 32767).astype(np.int16).tobytes()
|
# frame = (frame * 32767).astype(np.int16).tobytes()
|
||||||
# self.fifo_audio.write(frame)
|
# self.fifo_audio.write(frame)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue