Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mux
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2023-02-08 17:18:22 +0300
committerSebastian Dröge <sebastian@centricular.com>2023-02-09 21:36:42 +0300
commit5965ff43649a512c4cf1ab4a183ebcd06d7c1ff5 (patch)
treee10751ba5596198034c01774d636b685c5267e00 /mux
parentf55c32ed37b8d3de1432fcbf3b6764d85efb71f5 (diff)
fmp4mux: Accept more data on already filled streams if the remaining streams need more data for finishing a GOP
In other words, continue queueing buffers in sync from all streams until all of them are ready for draining instead of stopping to queue buffers on every stream that is already filled individually. Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/310 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1081>
Diffstat (limited to 'mux')
-rw-r--r--mux/fmp4/src/fmp4mux/imp.rs27
1 files changed, 14 insertions, 13 deletions
diff --git a/mux/fmp4/src/fmp4mux/imp.rs b/mux/fmp4/src/fmp4mux/imp.rs
index d6fede5d0..ce0ec41f5 100644
--- a/mux/fmp4/src/fmp4mux/imp.rs
+++ b/mux/fmp4/src/fmp4mux/imp.rs
@@ -602,6 +602,19 @@ impl FMP4Mux {
timeout: bool,
fragment_duration: gst::ClockTime,
) -> Result<Option<&'a mut Stream>, gst::FlowError> {
+ if state
+ .streams
+ .iter()
+ .all(|s| s.fragment_filled || s.chunk_filled)
+ {
+ gst::trace!(
+ CAT,
+ imp: self,
+ "All streams are currently filled and have to be drained"
+ );
+ return Ok(None);
+ }
+
let mut earliest_stream = None;
let mut all_have_data_or_eos = true;
@@ -620,16 +633,6 @@ impl FMP4Mux {
Err(err) => return Err(err),
};
- if stream.fragment_filled {
- gst::trace!(CAT, obj: stream.sinkpad, "Stream has current fragment filled");
- continue;
- }
-
- if stream.chunk_filled {
- gst::trace!(CAT, obj: stream.sinkpad, "Stream has current chunk filled");
- continue;
- }
-
gst::trace!(
CAT,
obj: stream.sinkpad,
@@ -682,8 +685,6 @@ impl FMP4Mux {
stream: &mut Stream,
mut pre_queued_buffer: PreQueuedBuffer,
) -> Result<(), gst::FlowError> {
- assert!(!stream.fragment_filled);
-
gst::trace!(CAT, obj: stream.sinkpad, "Handling buffer {:?}", pre_queued_buffer);
let delta_frames = stream.delta_frames;
@@ -1089,7 +1090,7 @@ impl FMP4Mux {
gst::trace!(
CAT,
obj: stream.sinkpad,
- "Current fragment start{}, current fragment end {}",
+ "Current fragment start {}, current fragment end {}",
fragment_start_pts,
fragment_start_pts + settings.fragment_duration,
);