Commit graph

382 commits

Author SHA1 Message Date
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
Sebastian Dröge
556e7ab210 flvdemux: Change a GST_ERROR_OBJECT() back to GST_DEBUG_OBJECT()
It was accidentally changed in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/436

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/624>
2020-06-12 09:52:56 +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
Sebastian Dröge
2c278bb2ab flvdemux: Send gap events if one of the streams falls behind the other by more than 3s
Same mechanism and threshold as in other demuxers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/597>
2020-05-20 18:46:41 +00:00
Sebastian Dröge
0bb9880b36 flvdemux: Remove unused audio_linked/video_linked booleans
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/597>
2020-05-20 18:46:41 +00:00
Edward Hervey
5dd3643d94 flvdemux: Answer bitrate queries from upstream
If upstream (such as queue2 in urisourcebin) asks for our bitrate, check if we
have stored audio/video bitrates, and use them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/596>
2020-05-20 16:51:47 +03:00
Edward Hervey
e8282661b6 flvdemux: Handle empty metadata strings
g_utf8_validate() errors out on empty string. But empty strings are valid,
so only check if they're not

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/596>
2020-05-20 10:48:06 +02:00
Edward Hervey
9f5f906515 flvdemux: Set ACCEPT_TEMPLATE flag on sinkpad
A demuxer can accept any caps matching its sinkpad template caps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/596>
2020-05-20 10:48:06 +02: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
Vivia Nikolaidou
9189cdcb1d flvdemux: Don't write an empty string as a tag
To stop warnings like:

GStreamer-WARNING **: 19:47:48.186: Trying to set empty string on
taglist field 'encoder'. Please file a bug.
2020-04-08 20:22:51 +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
Vivia Nikolaidou
7cbc351e05 flvdemux: Don't replace video codec data when we receive a PAR
Receiving a pixel-aspect-ratio should trigger a caps change, but not
replace the existing video codec tag
2019-12-16 21:51:38 +00: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
Tim-Philipp Müller
c9a47c0c8d Remove autotools build system 2019-10-14 11:04:18 +01:00
Aaron Boxer
46989dca96 documentation: fix a number of typos 2019-10-05 22:38:11 +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
af01988534 doc: Port documentation to hotdoc 2019-05-13 11:34:56 -04: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
Ilya Smelykh
b9c4c8bca5 flvdemux: set sample rate to 8KHz for G.711 audio 2019-02-08 20:33:55 +00:00
Thibault Saunier
bc8af2cca5 flvdemux: Do not error out if the first added and chained pad is not linked
And let it the oportunity to get its other pad linked

Example:

```
$ gst-launch-1.0 uridecodebin uri=file:///home/thiblahute/gst-validate.save/gst-integration-testsuites/testsuites/../medias/defaults/flv/819290236.flv caps=audio/x-raw expose-all-streams=FALSE ! fakesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstFlvDemux:flvdemux0: Internal data stream error.
Additional debug info:
../subprojects/gst-plugins-good/gst/flv/gstflvdemux.c(2760): gst_flv_demux_loop (): /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstFlvDemux:flvdemux0:
streaming stopped, reason not-linked (-1)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
```
2019-02-02 18:36:09 +00:00
Sebastian Dröge
ab8100e664 flvdemux: Handle the encoder metadata the same as metadatacreator
And store it in our ENCODER tag.
2019-01-13 13:22:41 +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
Maciej Wolny
ec655de288 Remove duplicate declarations
This causes 'redefinition of typedef ...' errors on GCC 4.5.3
2018-12-04 11:13:02 +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
bd6a4aa10d flvdemux: Use aac codec-data to adjust channels if needed
Flv does not support various channels in AAC stream format, for example
flvdemux detect an audio channels of 2(stereo) when the AAC really is 1(mono).

https://bugzilla.gnome.org/show_bug.cgi?id=797275
2018-10-12 14:35:37 -04: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
Xavier Claessens
edd9c8f6b8 Meson: Generate pc file for all plugins in good
https://bugzilla.gnome.org/show_bug.cgi?id=794568
2018-04-25 11:07:06 +01:00