Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
whitphx committed Apr 8, 2021
1 parent 31fb61c commit 4b716d6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions streamlit_webrtc/webrtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def callback(localDescription):
async def on_iceconnectionstatechange():
iceConnectionState = self.pc.iceConnectionState
if iceConnectionState == "closed" or iceConnectionState == "failed":
self._stop_webrtc_loop()
self._unset_transformers()

loop.create_task(
_process_offer(
Expand Down Expand Up @@ -371,15 +371,14 @@ def process_offer(

return result

def _stop_webrtc_loop(self):
if self._loop:
self._loop.stop()
def _unset_transformers(self):
self._video_transformer = None
self._video_receiver = None

def stop(self, timeout: Union[float, None] = 1.0):
self._stop_webrtc_loop()

self._unset_transformers()
if self._loop:
self._loop.stop()
if self._webrtc_thread:
self._webrtc_thread.join(timeout=timeout)

Expand Down

0 comments on commit 4b716d6

Please sign in to comment.