python-sdks icon indicating copy to clipboard operation
python-sdks copied to clipboard

Issue with AudioStream Async Iteration Not Ending in Multi-User Rooms

Open gigaverse-oz opened this issue 1 year ago • 1 comments

Hello,

First off, I'd like to express my appreciation for the work being done on this project. It's been instrumental in many of my endeavors, and I'm thankful for the opportunity to contribute to its improvement.

I've encountered an issue related to the AudioStream behavior in scenarios where multiple users are present in the same room. Specifically, when one user leaves, the track does not receive the "eos" (end of stream) field, resulting in the asynchronous iteration continuing indefinitely. This behavior contrasts with rooms that only have a single participant, where the room correctly closes upon the departure of the last non-agent participant, thereby not presenting the same issue.

The event indicating an unpublished audio track is raised successfully, but the condition meant to break the loop upon receiving an "eos" field within the audio event seems never to be met. Here is the relevant code snippet for reference:

elif audio_event.HasField("eos"):
    break

Due to this, the AudioStream._run() function does not complete as expected, and subsequently, the StopAsyncIteration is not raised, leading to the iteration not ending correctly.

Here are the relevant parts of the code for context:

I believe addressing this issue will enhance the robustness of multi-user support in the library. If there's any additional information or assistance I can provide, please don't hesitate to let me know. I'm looking forward to any guidance or suggestions you might have on this matter.

Thank you for your time and consideration.

Best regards,

Oz

gigaverse-oz avatar Mar 28 '24 00:03 gigaverse-oz

Thanks for the report. It's likely that the stream isn't being closed correctly when participants leave. we'll investigate.

davidzhao avatar Mar 29 '24 16:03 davidzhao