fmp4mux: Dequeue as many buffers as are available in each aggregate call

This commit is contained in:
Sebastian Dröge 2022-05-31 17:34:30 +03:00
parent 7e2cf613b4
commit 402500f79c
2 changed files with 56 additions and 56 deletions

View file

@ -1496,19 +1496,20 @@ impl AggregatorImpl for FMP4Mux {
// Queue buffers from all streams that are not filled for the current fragment yet
let fragment_start_pts = state.fragment_start_pts;
for (idx, stream) in state.streams.iter_mut().enumerate() {
'next_stream: for (idx, stream) in state.streams.iter_mut().enumerate() {
loop {
if stream.fragment_filled {
let buffer = stream.sinkpad.peek_buffer();
all_eos &= buffer.is_none() && stream.sinkpad.is_eos();
continue;
continue 'next_stream;
}
let buffer = stream.sinkpad.pop_buffer();
all_eos &= buffer.is_none() && stream.sinkpad.is_eos();
let buffer = match buffer {
None => continue,
None => continue 'next_stream,
Some(buffer) => buffer,
};
@ -1534,9 +1535,9 @@ impl AggregatorImpl for FMP4Mux {
// If we have a PTS with this buffer, check if a new force-keyunit event for the next
// fragment start has to be created
if let Some(pts) = pts {
if let Some(event) = self
.create_force_keyunit_event(aggregator, stream, &settings, &segment, pts)?
{
if let Some(event) = self.create_force_keyunit_event(
aggregator, stream, &settings, &segment, pts,
)? {
upstream_events.push((stream.sinkpad.clone(), event));
}
}
@ -1558,6 +1559,7 @@ impl AggregatorImpl for FMP4Mux {
}
}
}
}
if all_eos {
gst::debug!(CAT, obj: aggregator, "All streams are EOS now");

View file

@ -519,7 +519,6 @@ fn test_live_timeout() {
}
// Advance time and crank the clock: this should bring us to the end of the first fragment
h1.set_time(gst::ClockTime::from_seconds(5)).unwrap();
h1.crank_single_clock_wait().unwrap();
let header = h1.pull().unwrap();
@ -551,7 +550,6 @@ fn test_live_timeout() {
if j == 1 && i == 4 {
// Advance time and crank the clock another time. This brings us at the end of the
// EOS.
h1.set_time(gst::ClockTime::from_seconds(7)).unwrap();
h1.crank_single_clock_wait().unwrap();
continue;
}