cea608overlay: move Send impl lower in the stack

Try to avoid hiding another non-Send object in the State struct.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1519>
This commit is contained in:
Matthew Waters 2024-04-10 11:05:48 +10:00 committed by GStreamer Marge Bot
parent fbce73f6fc
commit 4dcc44687a
2 changed files with 5 additions and 5 deletions

View file

@ -55,11 +55,6 @@ struct State {
last_cc_pts: Option<gst::ClockTime>,
}
// SAFETY: Required because `pango::Layout` is not `Send` but the whole `State` needs to be.
// We ensure that no additional references to the layout are ever created, which makes it safe
// to send it to other threads as long as only a single thread uses it concurrently.
unsafe impl Send for State {}
impl Default for State {
fn default() -> Self {
Self {

View file

@ -479,6 +479,11 @@ fn pango_foreground_color_from_608(color: Color) -> pango::AttrColor {
pango::AttrColor::new_foreground(r, g, b)
}
// SAFETY: Required because `pango::Layout` is not `Send` but the whole `Cea608Renderer` needs to be.
// We ensure that no additional references to the layout are ever created, which makes it safe
// to send it to other threads as long as only a single thread uses it concurrently.
unsafe impl Send for Cea608Renderer {}
pub struct Cea608Renderer {
frame: Cea608Frame,
state: Cea608State,