Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions getstream/video/rtc/connection_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,17 @@ async def _on_ice_trickle(self, event):
async def _on_subscriber_offer(self, event: events_pb2.SubscriberOffer):
logger.info("Subscriber offer received")

# Offers can arrive after the subscriber peer connection has been
# torn down (slow asyncio loop under load, SFU sending a late
# renegotiation). `setRemoteDescription` would raise
# `InvalidStateError: Cannot handle offer in signaling state "closed"`
# and the exception propagates through the pyee error path, killing
# the session. Drop the offer instead — there is nothing to
# negotiate with a closed connection.
if self.subscriber_pc is None or self.subscriber_pc.signalingState == "closed":
logger.debug("Subscriber offer arrived after PC closed; dropping")
return

with telemetry.start_as_current_span("rtc.on_subscriber_offer") as span:
await self.subscriber_negotiation_lock.acquire()

Expand Down