threadshare: make live sources return NoPreroll from PlayingToPaused

Not returning NoPreroll in that transition causes downstream sinks
to wait for preroll forever.

Reproduce with:

gst-launch-1.0 audiotestsrc ! udpsink host=127.0.0.1 port=50000
gst-launch-1.0 ts-udpsrc address=127.0.0.1 port=50000 ! fakesink

ctrl + C in the receiver pipeline -> hangs forever
This commit is contained in:
Mathieu Duponchelle 2020-01-23 15:56:11 +01:00
parent 92941d7f92
commit decc1e2029
4 changed files with 19 additions and 4 deletions

View file

@ -718,6 +718,9 @@ impl ElementImpl for AppSrc {
runtime::executor::block_on(self.start(element))
.map_err(|_| gst::StateChangeError)?;
}
gst::StateChange::PlayingToPaused => {
success = gst::StateChangeSuccess::NoPreroll;
}
gst::StateChange::PausedToReady => {
self.src_pad_handler
.0

View file

@ -1373,13 +1373,19 @@ impl ElementImpl for JitterBuffer {
_ => (),
}
let mut ret = self.parent_change_state(element, transition)?;
let mut success = self.parent_change_state(element, transition)?;
if transition == gst::StateChange::ReadyToPaused {
ret = gst::StateChangeSuccess::NoPreroll;
match transition {
gst::StateChange::ReadyToPaused => {
success = gst::StateChangeSuccess::NoPreroll;
}
gst::StateChange::PlayingToPaused => {
success = gst::StateChangeSuccess::NoPreroll;
}
_ => (),
}
Ok(ret)
Ok(success)
}
}

View file

@ -1492,6 +1492,9 @@ impl ElementImpl for ProxySrc {
runtime::executor::block_on(self.start(element))
.map_err(|_| gst::StateChangeError)?;
}
gst::StateChange::PlayingToPaused => {
success = gst::StateChangeSuccess::NoPreroll;
}
_ => (),
}

View file

@ -1157,6 +1157,9 @@ impl ElementImpl for UdpSrc {
runtime::executor::block_on(self.start(element))
.map_err(|_| gst::StateChangeError)?;
}
gst::StateChange::PlayingToPaused => {
success = gst::StateChangeSuccess::NoPreroll;
}
gst::StateChange::PausedToReady => {
self.src_pad_handler
.0