mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-09 18:55:27 +00:00
uriplaylistbin: prevent deadlock when notifying property changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1234>
This commit is contained in:
parent
9ae514f986
commit
9b97e68da3
1 changed files with 15 additions and 1 deletions
|
@ -1679,12 +1679,26 @@ impl UriPlaylistBin {
|
||||||
}
|
}
|
||||||
|
|
||||||
let element = self.obj();
|
let element = self.obj();
|
||||||
|
let mut notify_iteration = false;
|
||||||
|
let mut notify_index = false;
|
||||||
|
|
||||||
if current_iteration != state.current_iteration {
|
if current_iteration != state.current_iteration {
|
||||||
state.current_iteration = current_iteration;
|
state.current_iteration = current_iteration;
|
||||||
element.notify("current-iteration");
|
notify_iteration = true;
|
||||||
}
|
}
|
||||||
if current_uri_index != state.current_uri_index {
|
if current_uri_index != state.current_uri_index {
|
||||||
state.current_uri_index = current_uri_index;
|
state.current_uri_index = current_uri_index;
|
||||||
|
notify_index = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// drop mutex before notifying changes as the callback will likely try to fetch the updated values
|
||||||
|
// which would deadlock.
|
||||||
|
drop(state_guard);
|
||||||
|
|
||||||
|
if notify_iteration {
|
||||||
|
element.notify("current-iteration");
|
||||||
|
}
|
||||||
|
if notify_index {
|
||||||
element.notify("current-uri-index");
|
element.notify("current-uri-index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue