diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2020-05-20 12:03:21 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2020-05-20 12:13:25 +0300 |
commit | c91e480f09a5cae761675002eb407ef57f987d62 (patch) | |
tree | 84db4089ff4537098b35a9e11fba93902c48e3c7 /utils | |
parent | d50abd74a1e2b11c02ebfa5d02140522362e3d5a (diff) |
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.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/fallbackswitch/src/fallbacksrc.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/utils/fallbackswitch/src/fallbacksrc.rs b/utils/fallbackswitch/src/fallbacksrc.rs index c39a1c7b8..484c29466 100644 --- a/utils/fallbackswitch/src/fallbacksrc.rs +++ b/utils/fallbackswitch/src/fallbacksrc.rs @@ -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); |