Commit graph

46 commits

Author SHA1 Message Date
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
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
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
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
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
Mark Nauwelaerts
dd3a25b473 srt: set cancellation in locked section
... to avoid race with wait which uses it with 'flushing' flag state semantics.
2019-05-11 22:38:46 +00:00
Mark Nauwelaerts
dbab2f9498 srt: avoid srtsrc segfault upon downward state change
... when it has not yet been connected to.

Also, a condition variable is not a semaphore, so a lock/wait/unlock
sequence is inherently racy without any state checking.  So switch to
a different lock and check the intended state.
2019-05-11 22:38:46 +00:00
Mark Nauwelaerts
cc11a7f9d7 srt: initialize list access within locked region 2019-05-11 22:38:46 +00:00
Mark Nauwelaerts
6d9398e87f srt: downgrade regular message to log level 2019-04-21 16:47:30 +02:00
Tim-Philipp Müller
679fa2d200 srt: fix uri and string leaks
And simplify property getter to avoid unnecessary copy.
2019-03-08 01:18:39 +00:00
Aaron Boxer
b9f070f796 srtobject: check for null local address to avoid SIGSEV 2019-02-24 10:50:14 -05:00
Justin Kim
e8fd000af0 srt: re-enable passphrase
With refactoring, supporting passphrase was removed accidently.
This commit re-enables srt encryption and validates 'passphrase'
by checking the return value of 'srt_setsockopt'.

fix: #694
2019-02-11 23:40:02 +00:00
Olivier Crête
73c6530d40 srt: Accepts URIs without host to go into listener mode
Just setting a URI without a hostname should directly go into listener mode.
2019-01-23 19:14:30 +00:00
Olivier Crête
5fee3a87c1 srt: Fix GClosure usage
One needs to set a marshaller as well as use the object setter when
setting objects.
2019-01-23 19:14:30 +00:00
Justin Kim
dc28105220 srt: Use default host and port if uri doesn't provide 2019-01-22 18:26:01 +09:00
Justin Kim
2bb907eb9c srt: Enable logs for srtobject 2019-01-22 12:44:07 +09:00
Justin Kim
f63643fcbf srt: Fix property names
Property name and its enum should match.
2019-01-22 12:42:47 +09:00
Justin Kim
b8610e72de srt: Fix a regression crash
Even in case that srt is working as a caller mode, uri can have no
hostname or ip address.

fix: #874
2019-01-22 11:35:03 +09:00
Jan Alexander Steffens (heftig)
484291b1b4
srt: Fix GCC function type error
gstsrtobject.c: In function ‘gst_srt_object_close’:
gstsrtobject.c:1036:7: error: function called through a non-compatible type [-Werror]
       (GDestroyNotify) g_closure_unref);
/usr/include/glib-2.0/glib/gmem.h:121:8: note: in definition of macro ‘g_clear_pointer’
       (destroy) (_ptr);                                                        \
        ^~~~~~~
gstsrtobject.c:1038:7: error: function called through a non-compatible type [-Werror]
       (GDestroyNotify) g_closure_unref);
/usr/include/glib-2.0/glib/gmem.h:121:8: note: in definition of macro ‘g_clear_pointer’
       (destroy) (_ptr);                                                        \
        ^~~~~~~

Arch Linux
gcc 8.2.1 20181127
glib 2.58.2
2019-01-14 14:48:50 +01:00
Justin Kim
0a350c610d srt: Integrate server and client element into one
We have srt{client,server}{src,sink} elements in accordance to the
norm of the connection oriented protocols. However, SRT connection
mode can be changed by uri parameters so it requires an integrated
element to handle the parameters.

fix: #740
2019-01-09 19:44:02 +00:00