fallbacksrc: Don't panic when shutting down the source and there are source pad blocks but no actual source pads

This can happen if the source removed the actual source pad already but
our downstream pad that is blocked still exists.
This commit is contained in:
Sebastian Dröge 2022-04-11 13:36:48 +03:00 committed by Sebastian Dröge
parent 84402f39ef
commit 3de317b3c9

View file

@ -2094,12 +2094,13 @@ impl FallbackSrc {
}
Some(state) => state,
};
for (source_srcpad, block) in [state.video_stream.as_mut(), state.audio_stream.as_mut()]
for (source_srcpad_name, block) in
[state.video_stream.as_mut(), state.audio_stream.as_mut()]
.iter_mut()
.filter_map(|s| s.as_mut())
.filter_map(|s| {
if let Some(block) = s.source_srcpad_block.take() {
Some((s.source_srcpad.as_ref().unwrap(), block))
Some((s.source_srcpad.as_ref().map(|pad| pad.name()), block))
} else {
None
}
@ -2109,7 +2110,7 @@ impl FallbackSrc {
CAT,
obj: element,
"Removing pad probe for pad {}",
source_srcpad.name()
source_srcpad_name.as_deref().unwrap_or("UNKNOWN")
);
block.pad.remove_probe(block.probe_id);
}