cea708mux: make sure to empty the stored pending codes

Fixes some captions being truncated if multiple of the same service is
received in the same input buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1984>
This commit is contained in:
Matthew Waters 2024-12-12 17:15:02 +11:00 committed by GStreamer Marge Bot
parent db8e1da65d
commit a2279bc253

View file

@ -324,6 +324,22 @@ impl AggregatorImpl for Cea708Mux {
}
}
}
for (service_no, pending_codes) in pad_state.pending_services.iter_mut() {
let new_service = services
.entry(*service_no)
.or_insert_with_key(|&n| Service::new(n));
while let Some(code) = pending_codes.pop_front() {
match new_service.push_code(&code) {
Ok(_) => (),
Err(cea708_types::WriterError::WouldOverflow(_)) => {
pending_codes.push_front(code);
break;
}
Err(cea708_types::WriterError::ReadOnly) => unreachable!(),
}
}
}
}
_ => (),
}