togglerecord: release rec_state before pushing buffer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1961>
This commit is contained in:
Guillaume Desmottes 2024-12-02 10:36:23 +01:00
parent 6ee745edee
commit 80b9d7081a

View file

@ -1351,8 +1351,6 @@ impl ToggleRecord {
self.handle_main_stream(pad, &stream, buffer, upstream_live)
}?;
let rec_state = self.state.lock();
let mut buffer = match handle_result {
HandleResult::Drop => {
return Ok(gst::FlowSuccess::Ok);
@ -1377,6 +1375,7 @@ impl ToggleRecord {
};
let out_running_time = {
let rec_state = self.state.lock();
let main_state = if stream != self.main_stream {
Some(self.main_stream.state.lock())
} else {
@ -1427,6 +1426,7 @@ impl ToggleRecord {
let out_running_time = state.out_segment.to_running_time(buffer.pts());
// Unlock before pushing
drop(rec_state);
drop(state);
drop(main_state);