Commit graph

157 commits

Author SHA1 Message Date
Stéphane Cerveau
6fdbe19b3f flv: allow per feature registration
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/876>
2021-03-29 12:45:22 +02:00
Sebastian Dröge
917bf649cc flvmux: Release pads via GstAggregator
See https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/797

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/801>
2020-11-02 08:46:21 +00:00
Jan Alexander Steffens (heftig)
a73ede42cf flvmux: Correct time types
- last_dts is in milliseconds, not nanoseconds as expected for
  GstClockTime. Make it a generic guint64.
- Use GstClockTime for the fields that actually contain nanoseconds.
  None of them should become negative.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/766>
2020-10-09 07:10:47 +00:00
Jan Alexander Steffens (heftig)
953ceba80d flvmux: Improve logging of gst_flv_mux_buffer_to_tag_internal
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/722>
2020-09-10 09:20:46 +00:00
Jan Alexander Steffens (heftig)
deeb3917a5 flvmux: Move stream skipping to GstAggregatorPadClass.skip_buffer
Besides looking like the correct place to put this, it allows us to drop
the entire aggregator queue. The old implementation only dropped at most
one buffer for each call of aggregate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/722>
2020-09-10 09:20:46 +00:00
Jan Alexander Steffens (heftig)
2d08d16002 flvmux: Avoid crash when best pad gets flushed
The 'best' pad might receive a flush event between us picking it and us
popping the buffer. In this case, the buffer will be missing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/711>
2020-08-31 14:19:14 +00:00
Jan Alexander Steffens (heftig)
01594d19b8 flvmux: Correct breaks in gst_flv_mux_find_best_pad
The code seems to use `continue` and `break` as if both refer to the
surrounding `while` loop. But because `break` breaks out of the
`switch`, they actually have the same effect.

This may have caused the loop not to terminate when it should. E.g. when
`skip_backwards_streams` drops a buffer we should abort the aggregation
and wait for all pads to be filled again. Instead, we might have just
selected a subsequent pad as our new "best".

Replace `break` with `done = TRUE; break`, and `continue` with `break`.
Then simplify the code a bit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/710>
2020-08-31 15:14:56 +02:00
Vivia Nikolaidou
c95cc6a015 flvmux: Return NEED_DATA when we drop a buffer
When we are dropping a buffer in find_best_pad (e.g. waiting for a
keyframe, or skipping backwards timestamp), return
GST_AGGREGATOR_FLOW_NEED_DATA to make sure we have enough data at the
next run. Otherwise, a stream that accidentally fell behind (e.g.
relinking race, or just waiting for a keyframe) will never get the
opportunity to catch up to the other one, because the other one will
always keep advancing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/696>
2020-08-10 20:36:51 +03:00
Vivia Nikolaidou
75f6ca8a11 flvmux: Return NEED_DATA when no best pad is found
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/696>
2020-08-10 20:20:04 +03:00
Vivia Nikolaidou
59aab55e71 flvmux: Fix possible crash on GST_ITERATOR_RESYNC
Wrong pointer type

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/696>
2020-08-10 20:18:30 +03:00
Mathieu Duponchelle
f63299ff2f plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:42:25 +02:00
Mathieu Duponchelle
37c619f995 plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-03 22:44:09 -04:00
Vivia Nikolaidou
6a38961561 flvmux: Add skip-backwards-streams property
Backwards timestamps confuse librtmp, even if they're only backwards
relative to the other stream. If the timestamp of a stream is going
backwards related to the other stream, this property allows the muxer to
skip a few buffers until it reaches the timestamp of the other stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/572>
2020-04-27 16:18:34 +03:00
Vivia Nikolaidou
b0855113c6 flvmux: Allow requesting streamable pads after header is written
Allows us to request pads after writing header for streamable flv's.

For non-streamable it doesn't make sense to request a new pad after
writing the header, because the headers have been written already and we
can't add the new stream. But for streamable, any clients that connect
after the new pad has been added will be able to see both streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/572>
2020-04-27 14:11:10 +03:00
Jan Schmidt
a3933ea53d flvmux: Fix invalid padlist accesses.
Request pads can released at any time, so make sure to hold
the object lock when iterating the element sinkpads list where
that's safe, or to use other safe pad iteration patterns in
other places.

When choosing a best pad, return a reference to the pad to make sure it
stays alive for output in the aggregator srcpad task.

Should fix a spurious valgrind error in the CI flvmux tests and some
other potential problems if the request sink pads are released while
the element is running..

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/714
2020-04-05 11:50:43 +00:00
Yeongjin Jeong
e836640bd5 flvmux: Support rollover in timestamp
For live streams, if we keep the stream for a long time, the timestamp
will be larger than max_uint32. In that case, timestamp should be handled
as a rollover timestamp rather than a backward timestamp.
2020-02-18 18:39:31 +09:00
Jan Alexander Steffens (heftig)
9e0eb77810
flvmux: Use the last DTS for the metadata timestamp
This avoids creating a timestamp regression during a stream.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/429
2019-12-12 11:09:31 +01:00
Seungha Yang
5009cad220 flvmux: Use thread-safe gmtime_r if available
gmtime on *nix is not thread-safe.
2019-12-10 23:48:35 +09:00
Jan Alexander Steffens (heftig)
06600b2cd9
flvmux: Correct metadata handling in file and stream mode
In file mode, only push one onMetaData at the start of the stream.

In stream mode, always push complete onMetaData. They get replaced, not
merged.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/418
2019-12-03 14:01:19 +01:00
Jan Alexander Steffens (heftig)
6fdb6ece6e
flvmux: Don't calculate duration in streamable mode
There's no header to rewrite, so the duration is left unused.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/418
2019-12-03 14:01:14 +01:00
Edward Hervey
8e1c224fbc good: Avoid usage of deprecated API
GTimeval and related functions are now deprecated in glib.
Replacement APIs have been present since 2.26
2019-10-16 07:46:58 +00:00
Jan Alexander Steffens (heftig)
152b002658
flvmux: Clear new_tags if sending metadata in header
This avoids sending an additional metadata object right after the
headers.
2019-06-24 17:37:51 +02:00
Jan Alexander Steffens (heftig)
9528bfd78f
flvmux: Simplify an if-else chain
Merge the identical branches and turn the condition around to make it
easier to read.
2019-06-19 14:36:21 +02:00
Jan Alexander Steffens (heftig)
9a70ce87db
flvmux: Avoid crash when changing caps without both streams
mux->video_pad and mux->audio_pad can be NULL if the corresponding pad
has not been requested.
2019-06-19 14:36:21 +02:00
Thibault Saunier
0a6a62aa76 docs: Port all docstring to gtk-doc markdown 2019-05-13 10:24:40 -04:00
Andreas Frisch
3160713abf flvmux: Fix scale of time values in warning message 2019-03-15 09:55:32 +00:00
Ilya Smelykh
6db7bb1539 flvmux: Use 8kHz sample rate for alaw/mulaw audio 2019-02-08 20:33:55 +00:00
Sebastian Dröge
c28a9d5d9c flvmux: Add encoder metadata to the header
And also add a property for setting this. By default it has the same
value as the metadatacreator metadata.

Various software is using encoder instead of metadatacreator, others are
using them both for different purposes. As such it's useful to have
support for setting both here.
2019-01-13 13:22:41 +00:00
Olivier Crête
fea0d0b1a4 flvmux: Force timestamps to always be increasing
https://bugzilla.gnome.org/show_bug.cgi?id=796382
2018-11-05 18:17:01 -05:00
Yeongjin Jeong
8cae95a22d flvmux: Don't refuse caps changes after starting to write headers in streamable mode.
Flv does support changing the stream type and stream properties
after the headers were started to be written, and for example H264
codec_data changes can be supported.

https://bugzilla.gnome.org/show_bug.cgi?id=797256
2018-10-11 15:35:24 -04:00
Seungha Yang
916ad09009 flvmux: Don't leak codec_data buffer
Use gst_buffer_replace() to prevent buffer leak

https://bugzilla.gnome.org/show_bug.cgi?id=797179
2018-09-20 11:35:31 +03:00
Seungha Yang
1cd5a5241f flvmux: Don't omit streamheader from caps on downstream reconfigure
The reconfigured downstream elements (e.g., dynamically added sink element)
most likely require the flv streamheader

https://bugzilla.gnome.org/show_bug.cgi?id=797089
2018-09-06 15:52:09 -04:00
Olivier Crête
87b2b35fac flvmux: Remove custom get_next_time implementation
GstAggregator now does the same thing in the simple implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=795486
2018-05-16 22:23:36 +02:00
Olivier Crête
c2c7d110e5 flvmux: Don't wake up the muxer unless there is data
https://bugzilla.gnome.org/show_bug.cgi?id=795332
2018-04-26 15:41:54 -04:00
Olivier Crête
11297c3337 flvmux: Save the current position in the output segment
https://bugzilla.gnome.org/show_bug.cgi?id=795332
2018-04-26 15:41:54 -04:00
Olivier Crête
168fae813b flvmux: Wait for caps from both srcs before writing header
Wait for caps on all pads to start writing data even when source is live.

Includes unit test by Havard Graff that simulates it.

https://bugzilla.gnome.org/show_bug.cgi?id=794722
2018-04-26 15:41:54 -04:00
Mathieu Duponchelle
fc9db36a1f flvmux: unref return of aggregator_pad_peek_buffer
We ended up leaking every single buffer going through the
muxer, which is far from ideal
2018-04-13 23:01:20 +02:00
Mathieu Duponchelle
acb6090e47 flvmux: aggregate should not push EOS itself
Instead it is expected to return GST_FLOW_EOS, and let the
base class handle that.
2018-04-13 22:44:14 +02:00
Olivier Crête
96261ce220 flvmux: Duration & unit tests
The muxed buffers will not carry the duration of the
incoming buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=793457
2018-03-01 18:25:02 -05:00
Olivier Crête
c0bf793c05 flvmux: Set PTS based on running time
https://bugzilla.gnome.org/show_bug.cgi?id=793457
2018-03-01 17:15:02 -05:00
Mathieu Duponchelle
273d2c23d9 Port to latest GstAggregator segment API
The aggregator segment is now exposed on the src pad

https://bugzilla.gnome.org/show_bug.cgi?id=793945
2018-03-01 15:35:24 +01:00
Tim-Philipp Müller
f459438278 Update for renamed aggregator pad API
https://bugzilla.gnome.org/show_bug.cgi?id=791204
2018-01-23 09:46:32 +00:00
Vincent Penquerc'h
8b814f6351 flv: flvmux ported to the GstAggregator
This makes it possible to create a flv file from a live source and not stop
when there are packet drops.

https://bugzilla.gnome.org/show_bug.cgi?id=782920
2017-12-20 15:34:11 -05:00
Sean DuBois
2f707370d4 flvmux: Add metadatacreator property
Allow users to set metadatacreator value in the meta packet

https://bugzilla.gnome.org/show_bug.cgi?id=774131
2016-11-10 13:11:05 +02:00
Nicolas Dufresne
ad9e9bedfb flvmux: Assume PTS is DTS when PTS is missing
This fixes issue for encoders that only sets the DTS. We assume that
there was no re-ordering when that happens.

https://bugzilla.gnome.org/show_bug.cgi?id=762207
2016-10-24 11:54:30 -04:00
Thibault Saunier
dd9bfd03ec flv: Handle the case where we do not get any CollectData in handle_buffer
https://bugzilla.gnome.org/show_bug.cgi?id=765320
2016-04-22 08:39:02 -03:00
Vineeth TM
1071309870 good: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763076
2016-03-24 14:32:20 +02:00
Dave Craig
211c8492b3 gst: Don't assume that get_current_caps() returns non-NULL caps after has_current_caps()
Remove calls to gst_pad_has_current_caps() which then go on to call
gst_pad_get_current_caps() as the caps can go to NULL in between. Instead just
use gst_pad_get_current_caps() and check for NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=759539
2016-02-23 18:11:42 +02:00
Tim-Philipp Müller
df341f41dc flvmux, rtpvp9depay: fix indentation 2016-02-19 15:04:15 +00:00
Havard Graff
7787f439fc flvmux: plug leak(s) in error-scenario
https://bugzilla.gnome.org/show_bug.cgi?id=762210
2016-02-19 14:59:09 +00:00