Commit graph

25609 commits

Author SHA1 Message Date
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
Jan Alexander Steffens (heftig) 97c05d3f4b
srt: Accumulate total bytes sent/received over all connections/callers
So we don't lose them. Split gst_srt_object_open_internal for internal
reconnections that don't reset the accumulated bytes.
2020-04-15 10:42:48 +02:00
Jan Alexander Steffens (heftig) d19b3fccb5
srt: Fix type of bytes-received-lost
The field is a uint64_t.
2020-04-15 10:42:47 +02:00
Jan Alexander Steffens (heftig) 132e3a1af9
srt: Remove use of closures for signal emission
It seems overly complicated.
2020-04-15 10:42:47 +02:00
Jan Alexander Steffens (heftig) d2d00e07ac
srt: Clean up locking
Use GST_OBJECT_LOCK (srtobject->element) to protect only the fields
involved in property access.

Introduce a new mutex srtobject->sock_lock to go with
srtobject->sock_cond and protect the list of callers from concurrent
access.
2020-04-15 10:42:47 +02:00
Jan Alexander Steffens (heftig) 37ee389913
srt: Remove trailing whitespace 2020-04-15 10:42:47 +02: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
Seungha Yang eeb3dd6605 h265parser: Fix some coverity issues
- Remove useless comparison
- Fix invalid memory access

CID: 1461477, 1461476, 1461475, 1461474, 1461279
2020-04-13 12:28:14 +00:00
Philippe Normand 991bcb22d5 wpe: Add support for SHM without requiring EGLDisplay
The previous version of the SHM export support still required a valid
EGLDisplay. The upcoming WPEBackend-FDO 1.8.x aims to remove this requirement,
hence allowing wpesrc to be used without GPU.
2020-04-13 11:53:16 +00:00
J. Kim 04f3f4be4f srtobject: fix mutex lock target
GstSRTObject is a structure that has an actual GstElement
which is extended to srt{src,sink}.
2020-04-13 15:23:46 +09:00
Víctor Manuel Jáquez Leal 691fdb85c0 v4l2codecs: fix v4l2codecdevice get type
Currently the GType of v4l2codecdevice is hardcoded to zero, but it
rather should be delivered by the GType system.
2020-04-10 21:05:19 +02:00
Jordan Petridis 87fc038f67
gstmsdkdec: fix logical operation that misses parenthesis
in C, & is weaker than the ! operator and clang is giving the following
error about it.

```
../subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.c:731:7: error: logical not is only applied to the left hand side of this bitwise operator [-Werror,-Wlogical-not-parentheses]
  if (!gst_msdk_context_get_job_type (thiz->context) & GST_MSDK_JOB_DECODER) {
      ^                                              ~
../subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.c:731:7: note: add parentheses after the '!' to evaluate the bitwise operator first
  if (!gst_msdk_context_get_job_type (thiz->context) & GST_MSDK_JOB_DECODER) {
      ^
       (                                                                   )
../subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.c:731:7: note: add parentheses around left hand side expression to silence this warning
  if (!gst_msdk_context_get_job_type (thiz->context) & GST_MSDK_JOB_DECODER) {
      ^
      (                                             )
1 error generated.
```
2020-04-10 18:22:21 +03:00
Seungha Yang 5a29917a63 codecs: Add minimal state validation
... to prevent requesting decoding before the preparation.
For instance, baseclass should not request decoding a picture if there
is no parsed valid headers, since subclass is most likely
not ready to decoding it.
2020-04-09 19:33:56 +00:00
Seungha Yang a2f68762b0 h265parser: Add APIs to allow update VPS/SPS/PPS
gst_h265_parser_parse_{vps,sps,pps} APIs were used to parse VPS/SPS/PPS and
also in order to update parser's internal state at once. Meanwhile
gst_h265_parse_{vps,sps,pps} APIs are to parse VPS/SPS/PPS without state update.
This commit introduces new APIs so that only accepted VPS/SPS/PPS by user
can be updated to be used by parser.
2020-04-09 19:33:56 +00:00
Seungha Yang a61549cbde h264parser: Add APIs to allow update SPS/PPS
gst_h264_parser_parse_{sps,pps} APIs were used to parse SPS/PPS and
also in order to update parser's internal state at once. Meanwhile
gst_h264_parse_{sps,pps} APIs are to parse SPS/PPS without state update.
This commit introduces new APIs so that only accepted SPS/PPS by user
can be updated to be used by parser.
2020-04-09 19:33:56 +00:00
Seungha Yang 430848548d meson: kmssink: Allow fallback only on linux
Otherwise fallback will waste meson configure time on non-linux
2020-04-09 18:36:12 +00:00
Zeid Bekli 663cd44ef0 srtp: Added support for BYE packet
SRTCP can't get SSRC from BYE packet, this will make srtpdec element
to drop the package. Adding support to get the SSRC from BYE packets.
2020-04-09 15:11:19 +00:00
Seungha Yang b4efdeba11 nvdec: Don't hardcode DPB size
Too many decode surface would waste GPU memory. Also it seems to be
introducing additional latency depending on stream. Since nvcodec
sdk version 9.0, CUVID parser API has been providing the minimum
required number of surface. By using it, we can save GPU memory
and reduce possible latency.
2020-04-09 16:30:58 +09:00
Nicolas Dufresne 8f0ceba251 v4l2codecs: Fix FD leak during device enumeration
This was revealed by Coverity.

CID 1461248
2020-04-08 20:25:44 +00:00
Stéphane Cerveau d59bd5f674 dash: fix VARARGS coverity error
va_end was not called in every code path due to
g_return_val_if_fail.

API usage errors  (VARARGS)
va_end was not called for "myargs".

CID: 1461294
2020-04-08 20:02:57 +00:00
Xavier Claessens b462870094 Meson: Change extra-checks to feature option and make it yielding 2020-04-08 18:51:12 +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
Seungha Yang be8cec5348 h264parse: Add support for inband timecode update
Add new property "update-timecode" to allow updating timecode
in picture timing SEI depending on timecode meta. Since the picture
timing SEI message requires proper VUI setting but we don't support
re-writing SPS, this might not work for some streams
2020-04-08 15:39:12 +00:00
Seungha Yang fffbec11e4 h264parse: Don't unconditionally append timecode meta
If upstream buffer has its own timecode metatdata, don't append
new timecode meta into the buffer.
2020-04-08 15:39:12 +00:00
Seungha Yang 1a09251699 h264parser: Parse all SEI payload type even if it's not handled by parser
... so that user can handle it from outside of parser API
2020-04-08 15:39:12 +00:00
Seungha Yang db1ea18276 h264parser: Add support for creating picture timing SEI
This new method can make it possible to inject timecode meta into
h264 bitstream
2020-04-08 15:39:12 +00:00
Seungha Yang 72854261bb tests: h264parser: Fix picture timing SEI
The payloadSize don't need to include rbsp_trailing_bits()
2020-04-08 15:39:12 +00:00
Seungha Yang 28ce6c2a40 h264parser: Make GstH264PicTiming self-containing all the syntax information
... and store all parsed values.

We are storing pic_struct_present_flag although it's not part of
this SEI message but GstH264PicTiming includes it to clarify
following syntax values.
In addition to that, by adding CpbDpbDelaysPresentFlag, we don't need to
refer to VUI anymore.
2020-04-08 15:39:12 +00:00
Seungha Yang c272dd3462 h264parser: Fix some misleading debug messages 2020-04-08 15:39:12 +00:00
Seungha Yang 5a675080c5 h264parser: Fix mismatched argument of declaration and definition 2020-04-08 15:39:12 +00:00
Michael Olbrich 01628fa847 sdpdemux: don't send EOS for unknown SSRC
The rtpbin sends signals for all SSRCs. Don't send an EOS when the SSRC
does not match the stream SSRC.

This avoids problems when an SSRC from another receiver times out.
2020-04-08 13:24:34 +00:00
Thibault Saunier b9e0ccd8b7 codecs: Add basic documentation stubs 2020-04-08 08:47:46 -04:00
Nicolas Dufresne f5da12bcf5 v4l2decoder: Fix file descriptor leak
A copy paste error was leading to file descriptor leak. This was detected by
Coverity.

CID 1461285
2020-04-07 17:10:08 -04:00
Philippe Normand 12ff0a4797 fakevideosink: Allow allocation meta flags fine-tuning
In some scenarios the fakevideosink shouldn't advertize the overlay-composition
meta for instance, so that overlay elements perform subtitles blending
themselves.
2020-04-07 14:40:37 -04:00