Commit graph

79 commits

Author SHA1 Message Date
Sebastian Dröge
f5d633d293 Update versions to 0.9.12
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1387>
2023-11-10 17:47:41 +02:00
Stéphane Cerveau
ac3ca76c9f 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/1387>
2023-11-10 17:47:41 +02:00
Sebastian Dröge
32a730f6fa fmp4mux: Don't overflow negative composition offset calculation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1338>
2023-09-27 20:28:03 +03:00
Sebastian Dröge
36cdf84655 Update version to 0.9.11 2023-07-20 15:15:07 +03:00
Sebastian Dröge
b6168c7255 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/1285>
2023-07-19 09:41:58 +03:00
François Laignel
460d6e1a74 mp4, fmp4: fix byte order for opus extension
The "Encapsulation of Opus in ISO Base Media File Format" [1] specifications,
§ 4.3.2 Opus Specific Box, indicates that data must be stored as big-endian.

In `write_dops`, `to_le_bytes` variants were used.

Related to [2].

[1] https://opus-codec.org/docs/opus_in_isobmff.html#4.3.2
[2] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4875

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1249>
2023-06-19 19:02:55 +03:00
Sebastian Dröge
9ae514f986 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/1234>
2023-06-06 22:53:28 +03:00
Sebastian Dröge
e8bd521154 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/1234>
2023-06-06 22:53:19 +03:00
Arun Raghavan
d2947ed1f3 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/1234>
2023-06-06 22:52:02 +03:00
Antonio Kevo
5bbbd7bd23 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/1216>
2023-05-18 18:28:08 +03:00
Tim-Philipp Müller
2d56989f5c git: replace LICENSE file symlinks with copies
Git will de-duplicate the contents for us anyway, and
symlinks can cause problems with some versions of git
and also on Windows.

https://github.com/mesonbuild/meson/issues/11646
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4326

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1161>
2023-04-05 18:17:16 +03:00
Josef Kolář
748b0530c4 fmp4mux: fix hls_live example
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1135>
2023-03-14 13:44:30 +02:00
Arun Raghavan
6d248c70dd 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/1135>
2023-03-14 13:44:13 +02:00
Sebastian Dröge
9a779607c7 Update versions to 0.9.10 2023-03-02 13:18:00 +02:00
Seungha Yang
8f612b9003 mp4mux: Ignore framerate update
like mp4mux in -good does already

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1098>
2023-02-21 16:17:59 +02:00
Seungha Yang
365dcfa730 fmp4mux: Ignore framerate update
like mp4mux in -good does already

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1098>
2023-02-21 16:17:52 +02:00
Sebastian Dröge
eb3d3b3088 Update versions to 0.9.9 2023-02-09 22:08:17 +02:00
Sebastian Dröge
58a6dbacca fmp4mux: Pass one more buffer in test_buffer_multi_stream_short_gops test
This works around non-determinism in aggregator where depending on
timing it can happen that it consumes all buffers from both pads or
waits for another buffer on one pad while the other one already has one.

The effect in this test was that it sometimes timed out. By providing
one more buffer it is guaranteed now that at this point the muxer is
beyond the end of the first fragment.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:43:57 +02:00
Sebastian Dröge
e52bb160c7 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/1086>
2023-02-09 21:43:57 +02:00
Sebastian Dröge
da7743d2e7 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/1086>
2023-02-09 21:17:51 +02:00
Sebastian Dröge
7ba1100a92 mp4: Add support for AV1
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:17:23 +02:00
Sebastian Dröge
a65feb7ef9 fmp4: Add support for AV1
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:16:40 +02:00
Sebastian Dröge
1029669427 fmp4: Add support for VP8
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:15:50 +02:00
Sebastian Dröge
40cada5f69 mp4: Add support for VP8
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:15:05 +02:00
Sebastian Dröge
68bec4a0db fmp4mux: Fix a couple of assertions by handling these cases cleaner
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:06:56 +02:00
Sebastian Dröge
adbb8b6495 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/1086>
2023-02-09 21:06:56 +02:00
Sebastian Dröge
a01437b675 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/1086>
2023-02-09 21:06:56 +02:00
Guillaume Desmottes
b9e203d6c1 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/1086>
2023-02-09 21:06:08 +02:00
Sebastian Dröge
4eeb8ffb63 fmp4mux: Don't write the first sample flags into any trun but the first
The flags are based on the first sample of this fragment so writing it
into any trun but the first is not very useful.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:05:48 +02:00
Sebastian Dröge
01aa9380d4 fmp4mux: Fix decision whether per-sample flags are needed in the trun
Previously it would never use per-sample flags if any later sample
needed different flags than the first two.

Also comment the code a bit better.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:05:40 +02:00
Sebastian Dröge
5c2582d105 Update version to 0.9.8 2023-01-23 11:30:27 +02:00
Sebastian Dröge
4ba452dcc3 Update versions to 0.9.7 2023-01-19 19:06:43 +02:00
Sebastian Dröge
c818a575b4 Update versions to 0.9.6 2023-01-18 17:19:17 +02:00
Sebastian Dröge
2a8a90f76f Update versions to 0.9.5 2023-01-07 16:06:17 +02:00
Sebastian Dröge
85a03f5ff0 fmp4mux: Remove obsolete comment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1038>
2023-01-07 13:25:44 +02:00
Sebastian Dröge
b0bd55c4d2 Update versions to 0.9.4 2022-12-27 13:14:59 +02:00
Johan Bjäreholt
d9d5571641 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/1027>
2022-12-27 12:39:56 +02:00
Sebastian Dröge
bae5294e8f Update versions to 0.9.3 2022-12-16 20:22:17 +02:00
Sebastian Dröge
fb745f077b 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/1017>
2022-12-16 18:59:32 +02:00
Sebastian Dröge
1eea2219c6 mp4mux: Adjust durations and possibly stream start time on encountering a gap buffer
If there was a previous sample in this stream then its duration needs to
be extended by the gap position, and if there was none then the start
time of the whole stream has to be shifted by the duration.

Not doing so causes timestamps to be offset wrongly by the duration of
the gap.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1017>
2022-12-16 18:52:03 +02:00
Sebastian Dröge
9b2d9ba4f9 mp4mux: Fix edit list shift for streams with initial DTS smaller earliest PTS but initial DTS positive
This would be a stream where the initial DTS is negative if the initial
PTS was zero, but it is offset so the initial DTS became positive now.
The edit list shift has to happen exactly the same way though.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1017>
2022-12-16 18:51:57 +02:00
Sebastian Dröge
00615ab478 mp4mux: Don't write gap edit lists if their duration would be zero
The track might start later than the earliest track by less than one
timescale units, in which case writing an empty gap edit list would be
useless and confusing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1017>
2022-12-16 18:51:50 +02:00
Sebastian Dröge
6ceccac1be mp4mux: Don't write empty chunks at the end if the last buffer of a stream started a new chunk and happened to be a from a gap event
Empty chunks are not valid in MP4.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1017>
2022-12-16 18:51:30 +02:00
Sebastian Dröge
b4185134d1 Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1017>
2022-12-16 18:51:00 +02:00
Jordan Petridis
b8d2d98027 mux/{mp4, fmp4}: Hard depend on feature v1_18
Else --no-default-features was failing to compile.

v1_18 is needed to for the aggregator code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1008>
2022-12-12 13:32:02 +02:00
Sebastian Dröge
a7c75f8066 fmp4mux: Crank clock for the first fragment in more tests
Due to how aggregator works, it depends on how buffers are pulled
whether aggregate() is called again or it is waiting for a timeout or EOS:

works:
  - pad 1: 4 buffers, pad 2: 4 buffers
  - aggregate ready: take all 4/4 buffers
  - pad 1: 1 buffers, pad 2: 1 buffer
  - aggregate ready: take all 1/1 buffers

waits:
  - pad 1: 5 buffers, pad 2: 4 buffers
  - aggregate ready: take all 5/4 buffers
  - pad 1: 0 buffers, pad 2: 1 buffer
  - aggregate not ready: waiting for timeout or EOS

Also don't manually set the clock time as that's unnecessary.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/999>
2022-12-05 00:47:51 +00:00
Sebastian Dröge
6a05b7f56a mp4: Add version to gst-plugin-version-helper dependency 2022-11-28 11:46:29 +02:00
Sebastian Dröge
1f4a035dc0 Update versions to 0.9.2 2022-11-28 11:44:33 +02:00
Sebastian Dröge
649434bd04 mp4mux: For video with N/1001 framerates use N as timescale
See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3049

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/987>
2022-11-28 10:47:02 +02:00
Sebastian Dröge
10813ed621 mp4mux: Factor out running time to UTC time calculation into a function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/987>
2022-11-28 10:47:02 +02:00