transports: fix local transports audio cleanup

This commit is contained in:
Aleix Conchillo Flaqué
2025-02-06 13:44:51 -08:00
parent 962fc27dbd
commit 070bf66980
3 changed files with 3 additions and 12 deletions

View File

@@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed a `TkLocalTransport` and `LocalAudioTransport` issues that was causing
errors on cleanup.
- Fixed an issue that was causing `tests.utils` import to fail because of
logging setup.

View File

@@ -53,9 +53,6 @@ class LocalAudioInputTransport(BaseInputTransport):
await super().cleanup()
if self._in_stream:
self._in_stream.stop_stream()
# This is not very pretty (taken from PyAudio docs).
while self._in_stream.is_active():
await asyncio.sleep(0.1)
self._in_stream.close()
self._in_stream = None
@@ -99,9 +96,6 @@ class LocalAudioOutputTransport(BaseOutputTransport):
await super().cleanup()
if self._out_stream:
self._out_stream.stop_stream()
# This is not very pretty (taken from PyAudio docs).
while self._out_stream.is_active():
await asyncio.sleep(0.1)
self._out_stream.close()
async def write_raw_audio_frames(self, frames: bytes):

View File

@@ -61,9 +61,6 @@ class TkInputTransport(BaseInputTransport):
await super().cleanup()
if self._in_stream:
self._in_stream.stop_stream()
# This is not very pretty (taken from PyAudio docs).
while self._in_stream.is_active():
await asyncio.sleep(0.1)
self._in_stream.close()
def _audio_in_callback(self, in_data, frame_count, time_info, status):
@@ -113,9 +110,6 @@ class TkOutputTransport(BaseOutputTransport):
await super().cleanup()
if self._out_stream:
self._out_stream.stop_stream()
# This is not very pretty (taken from PyAudio docs).
while self._out_stream.is_active():
await asyncio.sleep(0.1)
self._out_stream.close()
async def write_raw_audio_frames(self, frames: bytes):