Commit graph

94 commits

Author SHA1 Message Date
Jan Alexander Steffens (heftig)
4eeff95f92 srtsrc: Prevent delay from being negative
`delay` should be a GstClockTimeDiff since SRT time is int64_t.

All values are in local time so we should never see a srctime that's in
the future. If we do, clamp the delay to 0 and warn about it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1674>
2020-10-12 12:58:22 +00:00
Jan Alexander Steffens (heftig)
ec11ad9d55 srtsrc: Don't calculate a delay if the srctime is 0
A zero srctime is a missing srctime. Apparently this can happen when
["the connection is not between SRT peers or if Timestamp-Based Packet
Delivery mode (TSBPDMODE) is not enabled"][1] so it may not apply to us,
but it's best to be defensive.

[1]: https://github.com/Haivision/srt/blob/v1.4.2/docs/API.md#sending-and-receiving

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1674>
2020-10-12 12:58:22 +00:00
Jan Alexander Steffens (heftig)
6b2fcb52e5 srtsrc: Defend against missing clock
If we don't have a clock, stop the source instead of asserting in
gst_clock_get_time. This can happen when the element is removed from the
pipeline while it's playing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1674>
2020-10-12 12:58:22 +00:00
Jan Alexander Steffens (heftig)
c6eeead1e4 srt: Consume the error from gst_srt_object_write
Instead of leaking it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1668>
2020-10-09 07:47:47 +00:00
Jan Alexander Steffens (heftig)
2a7fa67693 srt: Check socket state before retrieving payload size
The connection might be broken, which we should detect instead of just
aborting the write.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1669>
2020-10-09 07:12:04 +00:00
Edward Hervey
dd11e91c3b srtsrc: Fix timestamping
SRT provides the original timestamp of a packet (with drift/skew corrected for
local clock), which is what should be used for timestamping the outgoing
buffers. This ensures that we output the packets with the same timestamp (and by
extension rate) as the original feed.

Also detect if packets were dropped (by checking the sequence number) and
properly set DISCONT flag on the outgoing buffer.

Finally answer the latency queries

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1658>
2020-10-08 21:12:17 +00:00
Jan Alexander Steffens (heftig)
92dc2f4192 srt: Remove unused sa_family tracking
Now that SRT no longer needs the family when creating the socket, this
code has become useless.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1659>
2020-10-06 13:56:32 +02:00
Niklas Hambüchen
13c8bda531 srt: Move off deprecated srt_socket().
See 73ee1e1a3e/docs/API-functions.md (srt_socket)

`srt_create_socket()` was added in
4b897ba92d
and srt `v1.3.0` is the first release that has it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1659>
2020-10-06 13:56:32 +02:00
Jan Alexander Steffens (heftig)
4e26b447f6 srt: Register a log handler
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1659>
2020-10-06 12:39:04 +02:00
Jan Alexander Steffens (heftig)
936f422764 srt: Avoid removing invalid sockets from the polls
This would provoke error messages from SRT.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1659>
2020-10-06 12:39:00 +02:00
Jan Alexander Steffens (heftig)
fda4cfd15e srt: Fix use of srt_startup
`srt_startup` can also return 1 if it was successful. Avoid warning in
this case.

Avoid a race when checking whether we need to call it at all.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1659>
2020-10-06 12:38:57 +02:00
Jan Alexander Steffens (heftig)
6b8c4a5f34 srt: Fix parameter types used for socket options
The [SRT documentation][1] specifies exact types for the socket options.
Make sure we match these.

This reverts the linger workaround in commit 84f8dbd932
and extends srt_constant_params to support other types than int.

[1]: https://github.com/Haivision/srt/blob/master/docs/APISocketOptions.md

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1659>
2020-10-06 12:36:40 +02:00
raghavendra
84f8dbd932 srtobject: typecast SRTO_LINGER to linger
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1615>
2020-09-25 22:00:26 +05:30
J. Kim
8e9f8c7f2c srtobject: set error when canceled waiting for a caller
To propagate error, this commit sets a reason. Otherwise, the function
caller should check if `error` is NULL when the return value is not normal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1522>
2020-08-19 12:01:37 +00:00
J. Kim
ebdb3447ce srtobject: fix typo, s/errorj/error
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1522>
2020-08-19 11:31:41 +00:00
Sebastian Dröge
e70ec38000 srt: Add support for using hostnames instead of IP addresses
If an address can't be parsed as IP address, try resolving it via
GResolver instead. SRT URIs more often than not contain hostnames and
without trying to resolve them we won't be able to handle such URIs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1493>
2020-08-06 07:29:14 +00:00
Francisco Javier Velázquez-García
97b5951d25 srtobject: Add support for IPv6
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1477>
2020-08-03 21:46:04 +00:00
Francisco Javier Velázquez-García
1ba379ded0 srtobject: Reset parameters before setting URI
This makes `gst_srt_object_validate_parameters` work properly since
`localaddress` and `localport` will be missing if the URL did not
provide them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1477>
2020-08-03 21:46:04 +00:00
Francisco Javier Velázquez-García
096c60f9c5 srtobject: Simplify gst_srt_object_set_*_value
This fixes `gst_srt_object_set_string_value` in particular because the
value might not be a static string.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1477>
2020-08-03 21:46:04 +00:00
Francisco Javier Velázquez-García
1a8e2cf981 srtobject: Store passphrase like other parameters
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1477>
2020-08-03 21:46:04 +00:00
Tim-Philipp Müller
a8ce8db982 srt: add "empty" subclasses for deprecated srt{client,server}{src,sink}
The doc system gets confused when we register the exact same
class as multiple elements, so make a subclass for each.

Also wrap registration of deprecated elements with #ifndef GST_REMOVE_DEPRECATED.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1354>
2020-06-19 17:20:02 +01:00
Thibault Saunier
ebababae03 srt: doc: Add missing gst_type_mark_as_plugin_api 2020-06-09 12:28:13 -04:00
Peter Workman
b98712c44a srtobject: continue polling or report error on failed receive
fixes #1277

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1260>
2020-06-03 09:31:42 +00:00
Jan Alexander Steffens (heftig)
a1bc9d4319 srt: Make logging regarding callers more useful
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1273>
2020-06-03 04:23:14 +00:00
Jan Schmidt
918ed75944 srt: Don't leak the connection_poll_id on close()
Attempting to reach an inactive SRT peer in caller mode
was leaking an fd every few seconds in the gst_srt_object_close()/open()
loop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1293>
2020-05-24 10:47:59 +00:00
J. Kim
4ccaa1ebbb srtobject: add streamid property
The stream id starts with '#!::' according to SRT Access Control[1],
but GstURI requires URI encoded string.This commit introduces additional
property to set the id by normal string.

[1] https://github.com/Haivision/srt/blob/master/docs/AccessControl.md
2020-05-13 14:13:48 +00:00
krivoguzovVlad
b769af0c4f Update gstsrtobject.c
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/999>
2020-04-30 18:57:13 +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
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
Francisco Javier Velázquez-García (francisv)
c7fe1e8164 gstsrtsink: Add wait-for-connection property to srtsink
Add `wait-for-connection` property to `srtsink` element.  This
property allows the element to process packets even when no clients
are connected.
2019-12-19 19:46:47 +00:00
Jakub Adam
19391ae4c7 srtobject: allow passing SRT Stream ID in stream URI
Based on Stream ID, the application can accept or reject the connection,
select the desired data stream, or set an appropriate passphrase for the
connection. Example usage:

  srt://127.0.0.1:1234?streamid=mystream
2019-11-20 17:09:34 +00:00
Niels De Graef
d8f61515d8 Don't pass default GLib marshallers for signals
By passing NULL to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-11-06 14:27:46 +00:00
Justin Kim
e6847b6d29 srt: split incoming buffer up into srt chunk 2019-11-06 13:14:26 +00:00
Aaron Boxer
6d3429af34 documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
Tim-Philipp Müller
f218ec2794 Remove autotools build system 2019-10-14 13:54:27 +01:00
Olivier Crête
fa842f2156 srt: Set latency property on SRT socket 2019-08-27 22:31:50 +00:00
Olivier Crête
177f1f95e1 srt: Add sender side statistics 2019-08-27 22:31:50 +00:00
Olivier Crête
54dc0b5579 srtobject: Remove pointless GMainLoop
Just use srt's blocking epoll function and fix locking while we're at it.
2019-08-27 22:31:50 +00:00
Mathieu Duponchelle
42adb02a10 docstrings: port ulinks to markdown links 2019-08-23 20:14:12 +02:00
Olivier Crête
15f2cdd750 srt: Remove msg-size property
Remove the now unused property
2019-07-08 16:00:51 -04:00
Olivier Crête
42fa4cb2ad srtsrc: Receive one frame per gstbuffer
Don't aggregate the received data, just receive it one packet at a
time. So it keeps the packetization boundaries
2019-07-08 16:00:51 -04:00
Nicolas Dufresne
1acd9c726a srt: Fix listener crash if no URI is specified 2019-07-08 13:52:48 -04:00
Nicolas Dufresne
b06f7824e1 srt: Use macro instead of duplicating a default value 2019-07-08 13:52:48 -04:00
Nicolas Dufresne
e5b6622546 srt: Fix confusing typo in FIXME comment
SRT does not support IPv6, but the comment said IPv4 which was the
opposite of the following code.
2019-07-08 13:52:48 -04:00
Tim-Philipp Müller
7853700b50 meson: add more plugins to plugins list
Makes sure their path gets added to the uninstalled environment
and makes sure they get included in the docs.
2019-05-30 20:41:57 +02:00
Mathieu Duponchelle
da6afdec9c doc: remove xml from comments 2019-05-29 22:58:08 +02:00