Commit graph

44 commits

Author SHA1 Message Date
Sebastian Dröge 4ad101b53b Use once_cell crate directly again
The glib crate does not depend on it anymore and also does not re-export
it anymore.

Also switch some usages of OnceCell to OnceLock from std.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1441>
2024-01-31 18:07:57 +02:00
Sebastian Dröge 1ef47cb48e Fix a few new clippy 1.75 warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1415>
2023-12-22 16:40:18 +02:00
Sebastian Dröge 763739e3ae Update for Buffer / Memory API changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1409>
2023-12-17 14:07:12 +02:00
Stéphane Cerveau 68c2d27e8d fmp4mux: specify the fragment duration unit
The fragment duration is expressed in nanoseconds.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1348>
2023-10-04 12:47:15 +02:00
Sebastian Dröge 3661b4f95b fmp4mux: Fix draining in chunk mode if keyframes are too late
We would create another chunk that ends after the fragment end, and
would from then on consider the stream always filled for the chunk
because it starts after the current fragment end (i.e. nothing would go
into this fragment).

This is obviously wrong because the actual fragment end moved further
ahead because of the additional chunk.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1277>
2023-07-18 07:57:20 +00:00
Bilal Elmoussaoui dd2d7d9215 Use re-exported once_cell
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1268>
2023-07-06 17:50:49 +03:00
Sebastian Dröge 2e83107c18 fmp4mux: Don't wait for more data if a stream has no GOP starting before fragment end
Simply don't output anything for this stream and only include it in the
future.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1229>
2023-06-01 19:46:06 +03:00
Sebastian Dröge a5fcd66c95 fmp4mux: Consider a stream filled if the earliest GOP starts after the current chunk
There's not going to be any buffer to output for this stream in the
current chunk.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1229>
2023-06-01 19:25:44 +03:00
Arun Raghavan b05c21680d Revert "fmp4: Return a running time in get_next_time()"
This reverts commit 04bb7b4db0.

As Sebastian points out, the chunk PTS is already in running time, so
this was wrong from the start.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/363
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1219>
2023-05-23 09:27:00 -04:00
François Laignel 7ba0073052 use Pad builders for optional name definition
Also, apply auto-naming in the following cases

* When building from a non wildcard-named template, the name of the template is
  automatically assigned to the Pad. User can override with a specific name by
  calling `name()` on the `PadBuilder`.
* When building with a target and no name was provided via the above, the
  GhostPad is named after the target.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/448
Auto-naming discussion: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1255#note_1891181

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1197>
2023-05-12 12:55:31 +02:00
Antonio Kevo cf21bfabf2 fmp4: Use updated start_pts when checking stream filled
After calculating the earliest pts, the fragment_start_pts and
chunk_start_pts in State are updated. However, when checking if the
stream is filled, the previous start_pts (set to None) is used instead.
This means that chunk_filled and fragment_filled will be false the first
time aggregate() is called, assuming timeout is false, all_eos is false,
and the sinkpad is not EOS. This requires aggregate() having to be
called a second time before the first fragment is sent.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1207>
2023-05-10 16:09:25 +02:00
Arun Raghavan 04bb7b4db0 fmp4: Return a running time in get_next_time()
We were currently returning a value based on the next chunk PTS, but the
expectation in GstAggregator is that we return a running time. This
resulted in spurious wakeups and warnings like:

0:00:01.501685123 1552995 0x55899715c1e0 WARN                 fmp4mux mux/fmp4/src/fmp4mux/imp.rs:1818:gstfmp4::fmp4mux:👿:FMP4Mux::drain_buffers:<fmp4mux0:sink_1> Don't have a complete GOP for the first stream on timeout in a live pipeline

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1127>
2023-03-10 10:58:38 -05:00
Seungha Yang 6b15e772ac fmp4mux: Ignore framerate update
like mp4mux in -good does already

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1094>
2023-02-16 02:23:56 +09:00
Sebastian Dröge 5965ff4364 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>
2023-02-09 20:36:42 +02:00
Sebastian Dröge 3a408c0146 fmp4mux: Handle GOPs ending after the desired fragment end correctly
Either create further chunks if enough data is queued or simply start
the new fragment at a later time if the keyframe is later.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1077>
2023-02-06 19:20:34 +02:00
Sebastian Dröge 4c3ae6f8ce fmp4: Add support for AV1
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1075>
2023-02-04 13:48:37 +00:00
Sebastian Dröge cef6fef079 fmp4: Add support for VP8
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1075>
2023-02-04 13:48:37 +00:00
Sebastian Dröge ecb26a0b16 fmp4mux: Fix a couple of assertions by handling these cases cleaner
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1071>
2023-02-01 14:57:00 +02:00
Sebastian Dröge 1998ecab45 fmp4mux: Refactor and clean up code
Split many longer functions into multiple functions and simplify various
parts. Overall this is functionally still the same as before.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1068>
2023-01-30 14:41:33 +00:00
Sebastian Dröge 2a3d962dc5 fmp4mux: Add support for sub-fragments / chunking
Allow outputting sub-fragments (chunks in CMAF terms) that are shorter
than the fragment duration and don't usually start on a keyframe. By
this the buffering requirements of the element is reduced to one chunk
duration, as is the latency.

This is used for formats like low-latency / LL-HLS and DASH.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1059>
2023-01-27 19:28:27 +00:00
Guillaume Desmottes abe4efc4a2 fmp4mux: add 'offset-to-zero' property
Add it only to 'isofmp4mux', the onvif variant already does this and
CMAF and DASH are always single-stream so you rely on inter-container
synchronization via the running-time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1063>
2023-01-25 12:29:30 +00:00
Sebastian Dröge 458b2386ed Update for glib API changes 2023-01-21 18:13:48 +02:00
Sebastian Dröge 6132788b02 Update for caps/structure-related string API changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1048>
2023-01-15 22:58:44 +02:00
Sebastian Dröge e9bbf804ba fmp4mux: Remove obsolete comment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1037>
2023-01-06 14:52:56 +02:00
Sebastian Dröge af9d9c0a5c fmp4: Fix compilation after glib::List API changes 2023-01-02 19:22:51 +02:00
Johan Bjäreholt 71c268da14 fmp4mux: Only push fragment_offset if write_mfra is true
This is done so that the fragment_offset vector does not infinitely
build up when write_mfra is disabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1023>
2022-12-22 10:31:27 +01:00
Sebastian Dröge 13b6f8fad4 fmp4mux: Skip gap buffers earlier to consider them for the sample durations and fragment start durations
Otherwise dropping the gap buffers would offset the timestamps of
following samples.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1016>
2022-12-16 17:43:44 +02:00
Sebastian Dröge 6b3bb2c747 fmp4mux: Handle EOS correctly if it happens before a fragment start time was determined
Whatever earliest time we have at that point is going to be the start
time.

Also handle the case correctly where all inputs are EOS before any
buffers were received at all.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/270

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/982>
2022-11-19 19:24:43 +02:00
Sebastian Dröge e3f645af19 fmp4mux: Don't overflow negative composition offset calculation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/982>
2022-11-19 19:24:04 +02:00
Sebastian Dröge c553ac7402 fmp4mux: Re-work buffer dequeueing and calculations of timestamps
Especially simplify calculation of ONVIF UTC times. As a side-effect
this reduces the number of times the running times of a buffer are
calculated, and also causes streams to be interleaved correctly in ONVIF
mode if there is a non-constant UTC-to-running-time difference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/979>
2022-11-18 15:00:00 +02:00
Sebastian Dröge f062b7cf0d fmp4mux: Make media/trak timescales configurable
And refactor a bit of code for easier extensibility.
2022-11-07 18:06:29 +00:00
Sebastian Dröge 7ac29827d2 fmp4mux: Don't allow VP9 for CMAF
This would require setting the correct compatible band for VP9 in CMAF,
which is not implemented yet.
2022-11-03 16:53:01 +02:00
Sebastian Dröge 6706f3a4b4 fmp4mux: Add initial Opus support
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/239
2022-11-03 16:53:01 +02:00
Sebastian Dröge a8250abbf1 Fix various new clippy warnings 2022-11-01 10:27:48 +02:00
Sebastian Dröge 938f4e4f1c fmp4mux: Clip negative PTS to zero/last PTS instead of erroring out
This can happen at the beginning of a stream if upstream is
rtpjitterbuffer and it has problems figuring out timestamps in the
beginning due to resetting / skew.
2022-10-27 14:47:16 +03:00
Sebastian Dröge 627bf756b1 fmp4mux: Send force-keyunit events for now if the ideal position has already passed 2022-10-27 12:53:09 +03:00
Sebastian Dröge a56435801d fmp4mux: Add debug log when writing the mfra box 2022-10-26 17:22:20 +00:00
Sebastian Dröge 27fac33c44 fmp4mux: Reset timing infos to None if a stream only contained gap events for a whole fragment 2022-10-26 17:22:20 +00:00
Sebastian Dröge cab4cd3b8c fmp4mux: If a stream is longer than the main stream at EOS, simply include all of its buffers in the last fragment nonetheless 2022-10-26 17:22:20 +00:00
Matthew Waters d067fb2ec8 fmp4mux: don't require dts for predictive-only formats like vp9 2022-10-26 11:42:13 +00:00
Matthew Waters 8c8384c711 fmp4: add support for muxing VP9 streams in cmaf, dash and iso fmp4
As specified in https://www.webmproject.org/vp9/mp4/
2022-10-25 18:33:42 +11:00
Sebastian Dröge 9a68f6e221 Move from imp.instance() to imp.obj()
It's doing the same thing and is shorter.
2022-10-23 23:08:46 +03:00
François Laignel 86776be58c Remove & for obj in log macros
This is no longer necessary.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1137
2022-10-23 21:22:31 +02:00
Sebastian Dröge 211cd095d6 Add new mux subdirectory for container formats
Contains the (incomplete) flavors FLV demuxer and the fragmented MP4
muxer for now.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/173
2022-10-23 20:25:08 +03:00
Renamed from generic/fmp4/src/fmp4mux/imp.rs (Browse further)