Commit graph

79 commits

Author SHA1 Message Date
Philippe Normand 4254920b72 webrtc: Expose RTCError enum
The error codes not complying with the spec are now notified with the
GST_WEBRTC_ERROR_INTERNAL_FAILURE code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1485>
2022-01-29 14:42:22 +00:00
Jakub Adam bea8cba5e6 webrtcbin: Chain up to parent constructed method
Failing to do so makes GstWebRTCBin invisible to the leaks tracer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1587>
2022-01-27 17:43:18 +00:00
Sangchul Lee 5cedf017f5 webrtc: Fix memory leaks
Redundant condition and unreachable codes are also removed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1544>
2022-01-22 11:21:18 +00:00
Robert Mader e7c9960783 waylandsink: Ensure correct mapping of area_surface
If the `area_surface` got unmapped when changing to the `READY` or
`NULL` state, we currently don't remap it when playback resumes and
`wp_viewporter` is supported. Without `wp_viewporter` we do remap
it, but rather unintentionally and also when not wanted.

On Weston this has not been a big problem as it so far wrongly maps
subsurfaces of unmapped surfaces anyway - i.e. only the black
background was missing on resume. On other compositors and future
Weston this prevents the `video_surface` to get remapped.

Shuffle things around to ensure `area_surface` is mapped in the
right situations and do some minor cleanup.

See also https://gitlab.freedesktop.org/wayland/weston/-/issues/426

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1483>
2022-01-17 13:17:57 +00:00
Robert Mader f0b04f1ef1 waylandsink: Use wl_surface_damage_buffer() instead of wl_surface_damage()
The later, doing damage in surface coordinates instead of buffer
coordinates, has been deprecated. The reason for that is that it
is more prone to bugs, both on the client and the compositor side,
especially when paired with buffer scale, `wp_viewporter` or
buffer transforms.

Unfortunately, on Weston this risks running into
https://gitlab.freedesktop.org/wayland/weston/-/issues/446
(which causes trouble for several other projects as well). However,
that bug only affects cases where we run in sync mode, i.e. only
during resizes. In practise I haven't been able to observe the
issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1446>
2022-01-13 19:39:59 +00:00
Robert Mader 1249362f96 waylandsink: Use G_MAXINT32 for surface damage
Each time we call `wl_surface_damage()` we want to do full surface
damage. Like Mesa, just use `G_MAXINT32` to ensure we always do
full damage, reducing the need to track the right dimensions.

`window->video_rectangle` is now unused, but we keep it around for
now as we may need it again in the future.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1446>
2022-01-13 19:39:59 +00:00
Robert Mader 3bbd091bb4 waylandsink: Only call wl_surface_damage() when buffer content changed
From the spec:
> This request is used to describe the regions where the pending
> buffer is different from the current surface contents

We currently also call `wl_surface_damage()` on surfaces without
new or still compositor-hold buffers, e.g. when resizing the window.
In that case we call it on `area_surface_wrapper`, even though it
gets resized via `wp_viewport_set_destination()`, in which case
the compositor is in charge of repainting the area on screen.

Doing so is currently not forbidden by the spec, however it might
be in the future, see
https://gitlab.freedesktop.org/wayland/wayland/-/issues/267

Thus lets stay close to the spec and only call `wl_surface_damage()`
when we just attached a buffer.

Right now this prevents runtime assertions in Mutter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1446>
2022-01-13 19:39:59 +00:00
Robert Mader b03c7edfcf waylandsink: Simplify input region handling
We only need to unset the input region for the area surface when
we don't have our own toplevel surface. By default, the input region
covers the whole surface, thus no need to change it on resize.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1446>
2022-01-13 19:39:59 +00:00
Robert Mader 1e2bc68171 waylandsink: Use G_MAXINT32 for opaque regions
`gst_wl_window_set_opaque` does not get called on window resizes,
potentially leaving opaque regions too small.
According to the spec opaque regions can be bigger than the surface
size - parts that fall outside of the surface will get ignored.
Thus we can can simply use `G_MAXINT32` and be sure that the whole
surfaces will always be covered.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1446>
2022-01-13 19:39:59 +00:00
Dave Piché 574cbbf0b5 webrtc: fix log error message in function gst_webrtc_bin_set_local_description
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1511>
2022-01-13 15:11:35 +00:00
Mathieu Duponchelle d8c8737e71 cccombiner: fix s334-1a scheduling
The previous code was mistakenly trying to compute a cc_type out
of the first byte in the byte triplet, whereas it is to be interpreted
as:

> Bit b7 of the LINE value is the field number (0 for field 2; 1 for field 1).
> Bits b6 and b5 are 0. Bits b4-b0 form a 5-bit unsigned integer which
> represents the offset

The same mistake was made when creating padding packets.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1496>
2022-01-12 14:34:22 +00:00
Mathieu Duponchelle 6861ea8fe1 cccombiner: merge buffers for both fields with caption type s334-1a
Other elements such as line21encoder expect both fields to be present
in the same meta, not one meta per field.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1496>
2022-01-12 14:34:22 +00:00
Nirbheek Chauhan 1be6d6ccf5 meson: Add explicit check: kwarg to all run_command() calls
This is required since Meson 0.61.0, and causes a warning to be
emitted otherwise:

2c079d855e
https://github.com/mesonbuild/meson/issues/9300

This exposed a bunch of places where we had broken run_command()
calls, unnecessary run_command() calls, and places where check: true
should be used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1507>
2022-01-09 18:12:47 +05:30
Rafał Dzięgiel 8889b6351d assrender: Support RFC8081 mime types
Old "application/*" are now as per RFC8081 deprecated in favor of
new "font/*" mime types. Some new encoders are already using the
updated mime types. We need to also add them to the support list
in order for assrender to correctly identify them as fonts.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1481>
2022-01-03 06:42:23 +00:00
Rafał Dzięgiel a2719d79ff assrender: Handle ".ttc" attachment extension
TTC stands for "TrueType Collection" file. We can pass it
into libass as any other attachment. Add it to the supported
extensions list, so the fonts it contains will be used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1481>
2022-01-03 06:42:23 +00:00
Philippe Normand f0e6959bba webrtcdatachannel: Notify buffered-amount property updates
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1484>
2022-01-02 10:18:35 +00:00
Philippe Normand 43856a0735 webrtcstats: Fix null pointer dereference
If there is no jitterbuffer stats we should not attempt to store them in the
global stats structure.

Also add a g_return_if_fail in _gst_structure_take_structure() about this
because it is a programmer error to pass an invalid pointer address there.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1479>
2021-12-29 15:55:57 +00:00
Olivier Crête 818a185b5d webrtcstats: Fall back to last packet ssrc if caps dont provide it
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1448>
2021-12-23 23:48:17 -05:00
Olivier Crête 4e32d6bf3e webrtcstats: Use our own caps instead of the sticky event
The sticky event seems to get cleared sometimes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1448>
2021-12-23 23:48:17 -05:00
Olivier Crête 29befed685 webrtcbin: Store the ssrc of the last received packet
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1448>
2021-12-23 23:48:17 -05:00
Olivier Crête fc7e7f5ccc webrtc stats: Remove duplicate structure get
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1448>
2021-12-23 23:48:17 -05:00
Olivier Crête f35435f1f7 webrtc stats: Add more details about codecs into the stats
This makes the output a little closer to what the upstream stats are.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1448>
2021-12-23 23:48:17 -05:00
Seungha Yang 796007f75d av1enc: Update for newly designed AV1 profile signalling
Accept named AV1 profiles (i.e., main, high, and professional)
as well

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1456>
2021-12-21 22:20:34 +09:00
Mathieu Duponchelle abd61732bf webrtcbin: bind transceiver's fec-percentage to encoder percentage
Allows for dynamic control of the applied FEC overhead

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1429>
2021-12-14 17:34:53 +00:00
Mathieu Duponchelle 06893b8b5e webrtcbin: fix ulpfec / red for the BUNDLE case
* Add fec / red encoders as direct children of webrtcbin, instead
  of providing them to rtpbin through the request-fec-encoder signal.

  That is because they need to be placed before the rtpfunnel, which
  is placed upstream of rtpbin.

* Update configuration of red decoders to set a list of RED payloads
  on them, instead of setting the pt property.

  That is because there may be one RED pt per media in the same session.

* Connect to request-fec-decoder-full instead of request-fec-decoder,
  in order to instantiate FEC decoders according to the payload type
  of the stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1429>
2021-12-14 17:34:53 +00:00
Thibault Saunier d82efb47aa pitch: Specify layout as required for negotiation
There are cases where it might negotiate 'non-interleaved' while it
is wrong.

```
gst-launch-1.0 audiotestsrc !  "audio/x-raw, format=(string)F32LE, layout=(string)non-interleaved" ! audioconvert ! audioresample ! pitch tempo=1.2 ! audioconvert ! "audio/x-raw,format=S16LE" ! fakesink

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
(gst-launch-1.0:3029628): GStreamer-Audio-CRITICAL **: 11:42:22.477: gst_audio_buffer_map: assertion '(!meta && info->layout == GST_AUDIO_LAYOUT_INTERLEAVED) || (meta && info->layout == meta->info.layout)' failed
ERROR: from element /GstPipeline:pipeline0/GstAudioConvert:audioconvert1: The stream is in the wrong format.
Additional debug info:
../subprojects/gst-plugins-base/gst/audioconvert/gstaudioconvert.c(876): gst_audio_convert_transform (): /GstPipeline:pipeline0/GstAudioConvert:audioconvert1:
failed to map input buffer
ERROR: pipeline doesn't want to preroll.
ERROR: from element /GstPipeline:pipeline0/GstAudioTestSrc:audiotestsrc0: Internal data stream error.
Setting pipeline to NULL ...
Additional debug info:
../subprojects/gstreamer/libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstAudioTestSrc:audiotestsrc0:
streaming stopped, reason error (-5)
ERROR: pipeline doesn't want to preroll.
Freeing pipeline ...
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1441>
2021-12-11 19:09:09 -03:00
Philippe Normand 86719e25a4 wpevideosrc: Use basesrc event vfunc
Allows for basic default handling from the base class.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1422>
2021-12-07 11:43:26 +00:00
Tim-Philipp Müller 26169cee0e teletextdec: fix minor string leak
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1416>
2021-12-06 13:07:37 +00:00
Mathieu Duponchelle e90859f4d8 webrtcbin: deduplicate extmaps
When an extmap is defined twice for the same ID, firefox complains and
errors out (chrome is smart enough to accept strict duplicates).

To work around this, we deduplicate extmap attributes, and also error
out when a different extmap is defined for the same ID.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1383>
2021-11-25 18:38:22 +00:00
Seungha Yang 2a17618dcc openjpegenc: Fix build warning
Compiling C object subprojects/gst-plugins-bad/ext/openjpeg/gstopenjpeg.dll.p/gstopenjpegenc.c.obj
../subprojects/gst-plugins-bad/ext/openjpeg/gstopenjpegenc.c(416):
  warning C4133: '=': incompatible types - from 'GstFlowReturn (__cdecl *)(GstVideoEncoder *,GstVideoCodecFrame *)' to
  'gboolean (__cdecl *)(GstVideoEncoder *,GstVideoCodecFrame *)'

../subprojects/gst-plugins-bad/ext/openjpeg/gstopenjpegenc.c(418):
  warning C4133: '=': incompatible types - from 'GstFlowReturn (__cdecl *)(GstVideoEncoder *,GstVideoCodecFrame *)' to
  'gboolean (__cdecl *)(GstVideoEncoder *,GstVideoCodecFrame *)'

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1378>
2021-11-24 13:11:23 +00:00
Guillaume Desmottes d67a63a298 gssink: add metadata property
This property can be used to set metadata on the storage object.

Similar API has been added to the S3 sink already, see
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/613

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1377>
2021-11-23 16:00:53 +01:00
Philippe Normand a6fd767025 wpevideosrc: Fix frame stuttering in GL rendering path
Make sure the EGLImage we're rendering to the GL memory stays alive long enough,
until the the GL memory has been destroyed.

This change fixes tearing and black flashes artefacts that were happening
because the EGLImage was sometimes destroyed before the sink actually rendered
the associated texture.

Fixes #889

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1354>
2021-11-16 21:55:41 +00:00
Philippe Normand 053dd564a1 wpevideosrc: Run through gst-indent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1354>
2021-11-16 21:55:41 +00:00
Tim-Philipp Müller 972615cf22 docs: fix unnecessary ampersand, < and > escaping in code blocks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1340>
2021-11-12 11:39:19 +00:00
Timo Wischer 8e7ce64a6e avtp: crf: Process also local CRF streams
Without this patch locally generated CRF streams will be ignored.
Therefore the same network interface could not be CRF talker and
CRF listener.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1074>
2021-11-10 16:53:04 +00:00
Timo Wischer 36006c61e9 avtpsrc: Use correct size for provided buffers
Without this patch the following pipeline would send packets containing
garbage in the data section.
$ gst-launch-1.0 avtpsrc ! avtpsink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1077>
2021-11-09 16:59:10 +00:00
Timo Wischer de95d3a1c4 avtp: crfsync: Warn when CRF package not yet received
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1075>
2021-11-09 15:36:25 +01:00
Timo Wischer 5a25eb61b7 avtp: crf: Use double for average period calculation
to also support CRF intervals like every 1,333,333ns 64 events

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1073>
2021-11-09 10:59:00 +00:00
Timo Wischer 5a9e9895ab avtp: crf: Properly handling one timestamp per PDU
The average_period should always represent the time between two
events. The specification defines the event time as the time
between audio samples, video frame sync, video line sync, etc.
In case of one timestamp per PDU the timestamp_interval identifies
the amount of events between the timestamp of one PDU and the
timestamp of the next PDU.
As described in IEEE 1722-2016 chapter
"10.4.12 timestamp_interval field" timestamp_interval shall be
nonzero.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1076>
2021-11-09 09:07:01 +01:00
Martin Reboredo 2546cef4be aom: Set fixed_qp_offsets to a deactivated value
aom only uses fixed_qp_offsets with the
Constant Quality (Q) Rate Control mode,
previously this was locking any usage
with another Rate Control mode.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1198>
2021-11-08 16:42:17 +00:00
Sebastian Dröge f9a97efbe1 webrtcbin: Clear errors from finding codec preferences before the next iteration
The media is just skipped and the error is not propagated to the caller,
so keeping it around here would cause assertions a bit later when trying
to set a new error over the old one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1291>
2021-11-04 10:51:15 +00:00
Sebastian Dröge 30153f1591 webrtcbin: Move addition of attributes to the caps after making sure they're not empty or any
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1291>
2021-11-04 10:51:15 +00:00
Sebastian Dröge d628ccf0e5 webrtcbin: Don't require fixed caps when querying caps for a transceiver pad to match it with a media
Upstream caps might for example be
  application/x-rtp,media=audio,encoding-name={OPUS, X-GST-OPUS-DRAFT-SPITTKA-00, multiopus}
and while that is not fixed caps it is enough to match it with a media.

Only caps structures that have the correct structure name and that have
the media and encoding-name field are preserved, but if both are present
then these caps are used as "codec preferences".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1291>
2021-11-04 10:51:15 +00:00
Tim-Philipp Müller 1f560af76b dtls: don't use deprecated g_binding_get_source() with newer GLib versions
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1279>
2021-10-30 00:52:42 +01:00
Heiko Becker b83e85ab67 neon: Allow building against neon 0.32.x
No API/ABI changes: https://github.com/notroj/neon/blob/0.32.0/NEWS#L3

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1267>
2021-10-29 00:14:53 +00:00
Mathieu Duponchelle 303c8025c6 webrtcbin: fix check_negotiation computing on caps event
It seems logical that check_negotiation be true if received_caps
is *not* equal to the new caps.

Also clean up handling of transceivers' ssrc events, as this
patch triggered a leaky code path.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1233>
2021-10-28 19:05:59 +00:00
Mathieu Duponchelle be0b5c54fd webrtcbin: connect input stream when receiving caps
.. if a current direction has already been set

When `webrtcbin` has created an offer based on codec_preferences,
it might not have received caps on its sinkpads by the time a
remote description is set, in which case we want to connect the
input stream upon actual reception of the caps instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1233>
2021-10-28 19:05:59 +00:00
Mathieu Duponchelle a9506f20d3 webrtcbin: consider pads with trans->codec_preferences ready
.. when determining whether we can emit on-negotiation-needed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1233>
2021-10-28 19:05:59 +00:00
Rob Agar 641b319fd6 webrtcbin: Also check data channel transport when collating connection state
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/838

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1224>
2021-10-28 05:05:44 +00:00
Timo Wischer 20b87e39e9 avtpsrc: Retry receive with same buffer size
Without this patch in case of a retry recv() will be called with a
negative size argument.

Signed-off-by: Timo Wischer <timo.wischer@de.bosch.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1078>
2021-10-26 22:46:46 +00:00