Commit graph

7742 commits

Author SHA1 Message Date
Edward Hervey f3d6026ad2 rtmp2src: Answer scheduling query
Just like for rtmpsrc, we must inform downstream that we are a
sequential (i.e. don't do random access efficiently) and
bandwith-limited (i.e. might need buffering downstream) element

Fixes buffering issues with playbin3

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1282>
2020-05-20 10:55:55 +02:00
Jan Alexander Steffens (heftig) 9b2ed3a3fc mpegtsdemux: Close a buffer leak and simplify input_done
tsparse leaked input buffers quite badly:

    GST_TRACERS=leaks GST_DEBUG=GST_TRACER:9 gst-launch-1.0 audiotestsrc num-buffers=3 ! avenc_aac ! mpegtsmux ! tsparse ! fakesink

The input_done vfunc was passed the input buffer, which it had to
consume. For this reason, the base class takes a reference on the buffer
if and only if input_done is not NULL.

Before 34af8ed66a, input_done was used in
tsparse to pass on the input buffer on the "src" pad. That commit
changed the code to packetize for that pad as well and removed the use
of input_done.

Afterwards, 0d2e908523 set input_done
again in order to handle automatic alignment of the output buffers to
the input buffers. However, it ignored the provided buffer and did not
even unref it, causing a leak.

Since no code makes use of the buffer provided with input_done, just
remove the argument in order to simplify things a bit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1274>
2020-05-18 14:11:40 +00:00
Alex Hoenig 0a2e026985 mpegtsmux: detect and ignore gap buffers
Fixes #1291.  Without this, when a stream has gaps and then resumes, the next buffer PTS that is written to the TS is given the PTS of the first gap.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1263>
2020-05-12 12:18:28 -04:00
Sebastian Dröge 79e65951a9 audiobuffersplit: Perform discont tracking on running time
Otherwise we would have to drain on every segment event. Like this we
can handle segment events that don't cause a discontinuity in running
time to be handled without draining.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1254>
2020-05-11 07:25:39 +00:00
Sebastian Dröge 20756e3387 audiobuffersplit: Keep incoming and outgoing segments separate
We might have to drain already queued input based on the old segment
before forwarding the new segment event. The new segment is only
forwarded after a discont as otherwise we might cause unnecessary
timestamp jumps as we output buffers timestamped based on sample counts.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1254>
2020-05-11 07:25:39 +00:00
Sebastian Dröge 2a2e48fd9e onviftimestamp: Add missing break in set_property()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1257>
2020-05-10 11:17:19 +03:00
Nicolas Dufresne 269ab891c5 h264/h265parse: Fix initial skip
Account for start codes possibly be 4 bytes. For HEVC, also take into
account that we might be missing only one of the two identification
bytes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1251>
2020-05-07 12:08:36 -04:00
Nicolas Dufresne 3784bd4a73 h265parse: Ensure correct timestamps
If the input has a miss-placed filler zero byte (e.g. a filler without a 4
bytes start code on the next NAL), we would endup using the same timestamp
twice. Ask the base class to read the timestamp from the buffer were the NAL
actually starts.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1251>
2020-05-07 12:08:36 -04:00
Nicolas Dufresne dc4c470d75 h264parse: Properly handle 4 bytes start code
This will stop stripping four bytes start code. This was fixed and broken
again as it was causing the a timestamp shift. We now call
gst_base_parse_set_ts_at_offset() with the offset of the first NAL to ensure
that fixing a moderatly broken input stream won't affect the timestamps. We
also fixes the unit test, removing a comment about the stripping behaviour not
being correct.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1251>
2020-05-07 12:08:36 -04:00
Sebastian Dröge 0dfd05e574 timecodestamper: Unref latency query after usage
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1249>
2020-05-06 20:05:06 +03:00
Tim-Philipp Müller 270f2f83a1 autoconvert: fix compiler warnings with g_atomic on recent GLib versions
The volatile is not needed here and causes compiler warnings
with newer GLib versions.

gstautoconvert.c: In function ‘gst_auto_convert_dispose’ (and elsewhere):
glib/gatomic.h:108:3: warning: initialization discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
gstautoconvert.c:224:24: note: in expansion of macro ‘g_atomic_pointer_get’
  224 |     GList *factories = g_atomic_pointer_get (&autoconvert->factories);

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1237>
2020-05-01 14:50:58 +01:00
Ederson de Souza 3ea0f694de clockselect: Add TAI clock support
Via new value for property clock-id, "tai", it's possible to use
GST_CLOCK_TYPE_TAI as pipeline clock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1009>
2020-04-30 19:21:37 +00:00
Olivier Crête d9512dc132 ristrtpdeext: Expose the largest sequence number received
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête f2e8d4dcf2 ristrtpdeext: Update RTP header extension packet to latest spec
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête a602eb7eea ristrtpext: Update RTP header extension packet to latest spec
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête 03a60a47b5 rist: Document main profile support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête 15f89cd088 ristsrc: Add ristrtpdeext to the pipeline
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête a0de749814 ristsink: Add ristrtpext to sink
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête f8bb1e0b85 ristsink: Receive RIST seqnum ext and feed it to rtxsend
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête fc76254dfc ristsink: Pass the session id to the on-app-rtcp callback
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête e873780a1f ristrtxsend: Use externally given seqnum extension when available
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête 58e31e116b ristrtxsend: Store sent packets with extended seqnum
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête efd78bb8d8 rist: Factor our seqnum extension code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête 59b01048ae rist: Drop packets that are more than G_MAXINT16 seqnum late
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête fa5d206c2c rist: Insert RTP seqnum extension header
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête 005bd960ee rist: Add element to remove the header extension
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête 7b0377c185 rist: Add element that inserts the RTP header extension
Currently can suppress the TS null packets, but can't insert
the seqnum extension yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Nicolas Dufresne 0d637c14c5 h264/h265parse: Fix handling of very last frame
Baseparse will never call us back on draining, so going into more: label will
cause the current frame to be discarded. So if we have a complete NAL, but not
a complete AU, make sure to terminate the frame properly.

This is a gression introduce by commit e88d848070 and
a194a87b26.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1275

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1208>
2020-04-23 12:28:54 +00:00
Guillaume Desmottes b5a28df0f3 transcodebin: fix caps NULL unref
gst_pad_get_current_caps() can return a NULL pointer which was raisin a CRITICAL.
2020-04-16 16:17:56 +00:00
Xavier Claessens 95134cfda8 h264parse: Remove unused arguments 2020-04-15 14:10:16 +00:00
Nicolas Dufresne 1ea21ad922 h264parse: Don't push NALs before we have HEADERS
Otherwise we may endup pushing incomplete caps, which cause a renegotiation.
Note that this has the effect that caps are no longer pushed twice in presence
of valid framerate in the headers.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne ff137a2059 h265parse: Don't push NALs before we have HEADERS
Otherwise we may endup pushing incomplete caps. Note that this has the side
effect that caps are no longer pushed twice in presence of VUI with valid
framerate.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne c51922b06c h265parse: Differentiate PREFIX SEI from SUFFIX
There is some code to fixup broken stream that uses the SEI location,
this code is meant to locate SUFFIX SEI only. This should prevent
unwanted side effect if SUFFIX SEI is used.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne 1aede43af6 h265parse: Don't add latency when not needed
We no longer add latency when doing AU->AU, AU->NAL and NAL->NAL
parsing.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne ceb68c4cf8 h265parse: Propagate MARKER flag 2020-04-15 14:10:16 +00:00
Nicolas Dufresne e88d848070 h265parse: Don't wait for next NAL if input is aligned
Waiting for the next NAL increases the latency. If alignment=nal/au
has been negotiated, assumes the the buffer contains a complete
NAL and don't expect a second start-code. This way, nal -> nal,
au -> au and au -> nal no longer introduce latency.

As a side effect, the collect_pad() function was not able to poke at the
following NAL. This call is now moved before processing the NAL, so
it's looking at the current NAL before it's ingested into the parser
state in order to dermin if the end of an AU has been reached. The AUD
injection state as been adapted to support this.

This change will break pipelines if alignment=nal is used without respecting the
alignment. Effectively, the parser will no longer fix the broken aligment
which will result in parser error and the termination of the pipeline. Such
issue existed in tsdemux element and might exist in any forks of that code.

Related to https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1193
2020-04-15 14:10:16 +00:00
Nicolas Dufresne 7cba3847ec h265parse: Set PTS/DTS and DISCONT on crafted NAL
When we inject a NAL in the bitstream before another one, make
sure to pass both DTS and PTS. Also make sure to transfer the
DISCONT flag properly.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne c52fdf994c h264parse: Don't add latency when not needed
We no longer add latency when doing AU->AU, AU->NAL and NAL->NAL
parsing.
2020-04-15 14:10:15 +00:00
Nicolas Dufresne ba8b605c6f h264parse: Propagate MARKER flag 2020-04-15 14:10:15 +00:00
Nicolas Dufresne a194a87b26 h264parse: Don't wait for next NAL if input is aligned
Waiting for the next NAL increases the latency. If alignment=nal/au
has been negotiated, assumes that the buffer contains a complete
NAL and don't expect a second start-code. This way, nal -> nal,
au -> au and au -> nal no longer introduce latency.

As a side effect, the collect_pad() function was not able to poke at the
following NAL. This call is now moved before processing the NAL, so
it's looking at the current NAL before it's ingested into the parser
state in order to dermin if the end of an AU has been reached. The AUD
injection state as been adapted to support this.

This change will break pipelines if alignment=nal is used without respecting the
alignment. Effectively, the parser will no longer fix the broken aligment
which will result in parser error and the termination of the pipeline. Such
issue existed in tsdemux element and might exist in any forks of that code.

Related to https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1193
2020-04-15 14:10:15 +00:00
Nicolas Dufresne ea99aee881 h264parse: Set PTS/DTS and DISCONT on crafted NAL
When we inject a NAL in the bitstream before another one, make
sure to pass both DTS and PTS. Also make sure to transfer the
DISCONT flag properly.
2020-04-15 14:10:15 +00:00
Nicolas Dufresne 596dfbdf37 h264parse: Remove no-op assignment
upstream was set to *out_ts, setting *out_ts to upstream here will
have no effect.
2020-04-15 14:10:15 +00:00
Sebastian Dröge 5394269c91 mpegtsmux: Chain up pad dispose function to the one of the parent class
Otherwise we will leak various memory.
2020-04-15 09:07:24 +00:00
Sebastian Dröge b41ed0fbb0 mpegtsmux: Properly release requests pads by chaining up to aggregators function 2020-04-15 09:07:24 +00:00
Vivia Nikolaidou fecd38c8f6 tsmux: Ability for streams to disappear and reappear
Until now, any streams in tsmux had to be present when the element
started its first buffer. Now they can appear at any point during the
stream, or even disappear and reappear later using the same PID.
2020-04-15 09:07:24 +00:00
Nicolas Dufresne 4a91a98ea1 mpegtsdemux: Don't pretend doing NAL alignment
Per specification in 2.14.2 "For PES packetization, no specific data
alignment constraints apply". So we should not advertise NAL
alignment.

This bug was introduced at the same moment the alignment field was introduced
10 years ago. The plan was that alignment=none (or no alignment field) was to
be used for mpegtsdemux, but no one noticed the error. The reason is that at
the same moment, everything dealing with H264 started defaulting to AU
alignment.

https://bugzilla.gnome.org/show_bug.cgi?id=606662#c22

This patch will have a side effect that a parser is now needed after the
tsdemux element. The following pipeline will not negotiate anymore as the
mpegtsmux element requires alignment={nal,au}.

  ... ! tsdemux ! mpegtsmux ! ...

As a side effect, anyone that forked from tsdemux should updated their code to
fix this bug.
2020-04-14 11:36:16 -04:00
Seungha Yang 462a8130a6 h264parse: Remove useless comparison
sei_pic_struct is unsigned and GST_H264_SEI_PIC_STRUCT_FRAME is zero.

CID: 1461467
2020-04-13 12:28:14 +00:00
Nicolas Dufresne eea520fe6d h264parse: Fix content light level value changes
Same as for H265, was found by Coverity.
2020-04-08 14:01:23 -04:00
Nicolas Dufresne 84a58b3633 h265parse: Fix content light level value changes
The comparision was not testing anything meaninful. This fixes the comparision
so we now update the caps whenever the value differ. This was detected by
coverity.

CID 1461291
2020-04-08 13:58:51 -04:00
Jan Alexander Steffens (heftig) 6680b70781
rtmp2: Avoid a deadlock when getting stats
We need to do this without holding the lock as the `g_async_queue_pop`
waits on the loop thread to deliver the stats. The loop thread might
attempt to take the lock as well, leading to a deadlock.

Taking a reference to the connection should be enough to keep this
safe.
2020-04-08 18:41:01 +02:00