tttocea608: don't erase display memory before loading new pop-on

There is no point to that, the code is already factored in such
a way that erase_display_memory is inserted at the correct time,
including while loading the next pop-on captions in non displayed
memory.
This commit is contained in:
Mathieu Duponchelle 2021-09-02 00:19:09 +02:00
parent 338e334c8a
commit 715418c005
2 changed files with 11 additions and 7 deletions

View file

@ -616,10 +616,6 @@ impl TtToCea608 {
}
if state.mode == Cea608Mode::PopOn {
if state.erase_display_frame_no.is_some() {
state.erase_display_frame_no = None;
state.erase_display_memory(element, mut_list);
}
state.resume_caption_loading(element, mut_list);
state.cc_data(element, mut_list, erase_non_displayed_memory());
} else if state.mode == Cea608Mode::PaintOn {
@ -798,6 +794,8 @@ impl TtToCea608 {
}
if state.mode == Cea608Mode::PopOn {
/* No need to erase the display at this point, end_of_caption will be equivalent */
state.erase_display_frame_no = None;
state.end_of_caption(element, mut_list);
}

View file

@ -193,8 +193,14 @@ fn test_erase_display_memory_non_spliced() {
}
/* Here we test that the erase_display_memory control code
* gets inserted before the following pop-on captions
* gets inserted while loading the following pop-on captions
* when there's not enough of an interval between them.
*
* Note that as tttocea608 introduces an offset between the
* intended PTS and the actual display time with pop-on captions
* (when end_of_caption is output) in order not to introduce
* a huge latency, the clear time is also offset so that the captions
* display as long as intended.
*/
#[test]
fn test_erase_display_memory_spliced() {
@ -215,7 +221,7 @@ fn test_erase_display_memory_spliced() {
assert_eq!(h.push(inbuf), Ok(gst::FlowSuccess::Ok));
let inbuf = new_timed_buffer(
&"World",
&"World, Lorem Ipsum",
ClockTime::from_nseconds(2_000_000_000),
ClockTime::SECOND,
);
@ -231,7 +237,7 @@ fn test_erase_display_memory_spliced() {
let pts = outbuf.pts().unwrap();
assert!(pts >= prev_pts);
if pts == ClockTime::from_nseconds(2_000_000_000) {
if pts == ClockTime::from_nseconds(2_200_000_000) {
let data = outbuf.map_readable().unwrap();
assert_eq!(&*data, &[0x94, 0x2c]);
erase_display_buffers += 1;