From 2b87e5f51d470219037017844729285b8ad87dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 1 Oct 2020 11:25:40 +0300 Subject: [PATCH] gstreamer/clock: Unschedule clock ID when the receiver end of the channel is disconnected --- gstreamer/src/clock.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gstreamer/src/clock.rs b/gstreamer/src/clock.rs index 9182ba202..9caa12d3a 100644 --- a/gstreamer/src/clock.rs +++ b/gstreamer/src/clock.rs @@ -117,7 +117,10 @@ impl ClockId { let (sender, receiver) = mpsc::unbounded(); self.wait_async(move |_clock, jitter, id| { - let _ = sender.unbounded_send((jitter, id.clone())); + if sender.unbounded_send((jitter, id.clone())).is_err() { + // Unschedule any future calls if the receiver end is disconnected + id.unschedule(); + } })?; Ok(Box::pin(receiver))