transports(base_output): chunk audio into 20ms instead of 10ms
This commit is contained in:
@@ -59,11 +59,11 @@ class BaseOutputTransport(FrameProcessor):
|
|||||||
self._stopped_event = asyncio.Event()
|
self._stopped_event = asyncio.Event()
|
||||||
self._is_interrupted = threading.Event()
|
self._is_interrupted = threading.Event()
|
||||||
|
|
||||||
# We will send 10ms audio which is the smallest possible amount of audio
|
# We will write 20ms audio at a time. If we receive long audio frames we
|
||||||
# we can send. If we receive long audio frames we will chunk them into
|
# will chunk them. This will help with interruption handling.
|
||||||
# 10ms. This will help with interruption handling.
|
audio_bytes_10ms = int(self._params.audio_out_sample_rate / 100) * \
|
||||||
self._audio_chunk_size = int(self._params.audio_out_sample_rate / 100) * \
|
|
||||||
self._params.audio_out_channels * 2
|
self._params.audio_out_channels * 2
|
||||||
|
self._audio_chunk_size = audio_bytes_10ms * 2
|
||||||
|
|
||||||
# Create push frame task. This is the task that will push frames in
|
# Create push frame task. This is the task that will push frames in
|
||||||
# order. We also guarantee that all frames are pushed in the same task.
|
# order. We also guarantee that all frames are pushed in the same task.
|
||||||
|
|||||||
Reference in New Issue
Block a user