utils/fallbacksrc: Block all currently unblocked pads when receiving the stream collection

It might be a second stream collection that we receive at a later time,
and the previous pads would already be unblocked at that point. So block
all currently unblocked pads again and then adjust the offset
according to the new situation.

This fixes playback of various RTMP streams where usually we first get a
stream collection with only one of the two streams, and shortly
afterwards with both streams.
This commit is contained in:
Sebastian Dröge 2020-05-20 12:03:21 +03:00
parent d50abd74a1
commit c91e480f09

View file

@ -1537,6 +1537,19 @@ impl FallbackSrc {
state.streams = Some(streams);
// This might not be the first stream collection and we might have some unblocked pads from
// before already, which would need to be blocked again now for keeping things in sync
for stream in [&mut state.video_stream, &mut state.audio_stream]
.iter_mut()
.filter_map(|v| v.as_mut())
{
if let Some(ref srcpad) = stream.source_srcpad {
if stream.source_srcpad_block.is_none() {
stream.source_srcpad_block = Some(self.add_pad_probe(element, srcpad));
}
}
}
self.unblock_pads(element, state);
drop(state_guard);