cea608overlay: ensure tha the list of lines remains sorted by line number

Otherwise, when iterating over the lines, they may be written out of order.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2051>
This commit is contained in:
Matthew Waters 2025-01-28 16:18:34 +11:00 committed by GStreamer Marge Bot
parent 5639a0640e
commit 4f4f84a615

View file

@ -191,7 +191,8 @@ impl Cea608Frame {
line: VecDeque::new(),
initial_preamble: None,
});
lines.back_mut().unwrap()
lines.make_contiguous().sort_by_key(|line| line.no);
lines.iter_mut().find(|line| line.no == row).unwrap()
};
while line.line.len() <= column {
line.line.push_back(Cea608Cell::Empty);