mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-26 05:21:00 +00:00
webrtc-utils: Ensure there is only one cancellable call at a time
Since we only have one canceller at a time, panic if one try to use it twice in parallel. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1262>
This commit is contained in:
parent
817b60a758
commit
08b6251a7a
1 changed files with 7 additions and 0 deletions
|
@ -127,6 +127,13 @@ where
|
|||
let (abort_handle, abort_registration) = future::AbortHandle::new_pair();
|
||||
{
|
||||
let mut canceller_guard = canceller.lock().unwrap();
|
||||
if canceller_guard.is_some() {
|
||||
return Err(WaitError::FutureError(gst::error_msg!(
|
||||
gst::ResourceError::Failed,
|
||||
["Old Canceller should not exist"]
|
||||
)));
|
||||
}
|
||||
|
||||
canceller_guard.replace(abort_handle);
|
||||
drop(canceller_guard);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue