ffv1dec: Drop decoder state before calling VideoDecoder::negotiate()

It calls into other elements via the allocation query and the caps
event, which makes it dangerous to keep a mutex locked at the same time.
This commit is contained in:
Sebastian Dröge 2021-09-18 10:55:26 +03:00
parent 4c8c398aa4
commit fd1c0a7518

View file

@ -304,15 +304,17 @@ impl VideoDecoderImpl for Ffv1Dec {
let output_info = Some(output_state.info()); let output_info = Some(output_state.info());
element
.negotiate(output_state)
.map_err(|err| gst::loggable_error!(CAT, "Negotiation failed: {}", err))?;
let mut decoder_state = self.state.lock().unwrap(); let mut decoder_state = self.state.lock().unwrap();
*decoder_state = DecoderState::Started { *decoder_state = DecoderState::Started {
output_info, output_info,
decoder: Box::new(decoder), decoder: Box::new(decoder),
video_meta_supported: false,
}; };
drop(decoder_state);
element
.negotiate(output_state)
.map_err(|err| gst::loggable_error!(CAT, "Negotiation failed: {}", err))?;
self.parent_set_format(element, state) self.parent_set_format(element, state)
} }