From f11260aeb5ff56dbc8b61a69c345532f899a03a9 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 19 Apr 2022 15:38:53 +0000 Subject: [PATCH] webrtcsink: Fix a race starting the signaller 1. Working scenario: T1 -> Caps event (all caps have been received) T1 -> Start discovering T2 -> Change state to Playing T2 -> The signaller is not started as: - Sink current_state() == Paused as it will be set to playing after the change_state vmethod returns - Discovery is not done anyway T1 -> Discovery is done => The signaller is started, and **everything works well**. 2. Failing scenario: T1 -> Caps event (all caps have been received) T1 -> Start discovering T1 -> Discovery is done T1 -> The signaller is not started as: - Current state == Paused (it will be set to playing after the change_state vmethod returns) - Discovery is not done anyway T2 -> Change state to Playing T2 -> The signaller is not started as: - Sink current_state == Paused as it will be set to playing after the we return from the change_state vmethod In that case the signaller never starts. --- plugins/src/webrtcsink/imp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/src/webrtcsink/imp.rs b/plugins/src/webrtcsink/imp.rs index 6aa977fa2..e1e8a5101 100644 --- a/plugins/src/webrtcsink/imp.rs +++ b/plugins/src/webrtcsink/imp.rs @@ -913,7 +913,7 @@ impl State { fn maybe_start_signaller(&mut self, element: &super::WebRTCSink) { if self.signaller_state == SignallerState::Stopped - && element.current_state() == gst::State::Playing + && element.current_state() >= gst::State::Paused && self.codec_discovery_done { if let Err(err) = self.signaller.start(element) {