Commit graph

1001 commits

Author SHA1 Message Date
Sebastian Dröge
74c8a9f4cf rtsp-stream: Remove unused _locked() variant of a function
It was added during refactoring.
2016-09-07 18:44:34 +03:00
Xavier Claessens
e882fe9e06 stream: cosmetic cleanup
https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-07 18:40:57 +03:00
Xavier Claessens
f5f350645a stream: Compare IP addresses case insensitive in more places
https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-07 18:40:57 +03:00
Xavier Claessens
f90ab92547 stream: Fix leaked joined_bin
There is no need to keep a strong ref on it, and _leave_bin() was
setting it to NULL before calling g_clear_object() so it was leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-07 18:40:57 +03:00
Sebastian Dröge
d33eca6156 rtsp-stream: Compare IP address strings case insensitive
Otherwise IPv6 addresses might fail this comparision.
2016-09-06 19:15:23 +03:00
Sebastian Dröge
e5a49efa7f rtsp-stream: Bind multicast sockets to ANY as before
https://bugzilla.gnome.org/show_bug.cgi?id=766612#c48
2016-09-06 19:10:21 +03:00
Kseniia
6136ef66d4 rtsp-session: Fix segfault when doing keep-alive after removing the session
If keep-alive happens after removing the session but before finalizing the
stream transport, we would segfault.

https://bugzilla.gnome.org/show_bug.cgi?id=750544
2016-09-05 22:57:52 +03:00
Sebastian Dröge
ca855abae1 rtsp-stream: Always create multicast UDP elements if the protocol flag is set
Adding them later will cause deadlocks due to
1) pre-rolling and staying in PAUSED with the unicast/TCP sinks
2) adding the multicast sink
3) waiting for it to get data to preroll again

3) never happens because the queues after the tee are full.
2016-09-05 18:09:22 +03:00
Sebastian Dröge
be4b9718e3 rtsp-stream: Fix up various multicast related issues 2016-09-05 16:32:57 +03:00
Xavier Claessens
8495c47a9d stream: revert back to create udpsrc/udpsink on DESCRIBE for unicast
This is basically reverting changes introduced in commit f62a9a7,
because it was introducing various regressions:

- It introduces a leak of udpsrc elements that got wrongly fixed by adding
  an hash table in commit cba045e. We should have at most 4 udpsrc for unicast:
  ipv4/ipv6, rtp/rtcp. They can be reused for all unicast clients.
- If a mcast client connects, it creates a new socket in SETUP to try to respect
  the destination/port given by the client in the transport, and overrides the
  socket already set on the udpsink element. That means that if we already had a
  client connected, the source address on the udp packets it receives suddenly
  changes.
- If a 2nd mcast client connects, the destination/port in its transport is
  ignored but its transport wasn't updated.

What this patch does:

- Revert back to create udpsrc/udpsink for unicast clients on DESCRIBE.
- Always have a tee+queue when udp is enabled. This could be optimized
  again in a later patch, but is more complicated. If no unicast clients
  connects then those elements are useless, this could be also optimized
  in a later patch.
- When mcast transport is added, it creates a new set of udpsrc/udpsink,
  seperated from those for unicast clients. Since we already support only
  one mcast address, we also create only one set of elements.

https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-05 13:36:17 +03:00
Xavier Claessens
aa0e60445d stream: factor our plug_src function
https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-05 13:26:08 +03:00
Xavier Claessens
47a3956b48 stream: factor out plug_sink function
https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-05 13:26:02 +03:00
Xavier Claessens
a44f198ffc stream: small documentation clarification
https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-05 13:25:57 +03:00
Xavier Claessens
82a618c2e6 stream: rename addr_v4/6 to mcast_addr_v4/6 for clarity
https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-05 13:25:51 +03:00
Xavier Claessens
55a1df5724 stream: Keep a ref on joined bin
https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-05 13:25:39 +03:00
Xavier Claessens
3ff4529a92 stream: code cleanup
https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-05 13:24:06 +03:00
Xavier Claessens
2b223af792 stream: small fix in error code path
https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-05 13:24:01 +03:00
Xavier Claessens
07f17c2cce Revert "rtsp-stream: Fix crash on cleanup with shared media and multiple udpsrc"
This partly reverts commit cba045e1b1,
but keeps unit tests.

https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-05 13:23:53 +03:00
Tim-Philipp Müller
a353e50747 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson
2016-08-31 00:04:43 +01:00
Nikita Bobkov
de3d0c4522 rtsp-client: Fix leaking of media in error cases
With additional fixes by Kseniya Vasilchuk <vasilchukkseniia@gmail.com>
and myself to make the media refcounting a bit easier to follow.

https://bugzilla.gnome.org/show_bug.cgi?id=755632
2016-08-02 17:46:49 +03:00
Sebastian Dröge
687301af86 rtsp-client: Fix leaking of session in error cases
https://bugzilla.gnome.org/show_bug.cgi?id=755632
2016-08-02 15:18:30 +03:00
Aleix Conchillo Flaqué
85c52e194b sdp: add rollover counters for all sender SSRC
We add different crypto sessions in MIKEY, one for each sender
SSRC. Currently, all of them will have the same security policy, 0.

The rollover counters are obtained from the srtpenc element using the
"stats" property.

https://bugzilla.gnome.org/show_bug.cgi?id=730539
2016-06-14 11:14:48 +02:00
Tim-Philipp Müller
fc2554404b docs: fix some typos 2016-06-07 20:44:42 +01:00
Tim-Philipp Müller
7de0d6580a g-i: pass compiler env to g-ir-scanner
It's what introspection.mak does as well. Should
fix spurious build failures on gnome-continuous
(caused by g-ir-scanner getting compiler details
via python which is broken in some environments
so passing the compiler details bypasses that).
2016-05-25 10:28:43 +01:00
Ian
178f2d6fe5 rtsp-session: RFC2326 does not allow a space between ; and timeout in the Session header
This works with rtspsrc and live555, but fails with e.g. ffmpeg.

https://bugzilla.gnome.org/show_bug.cgi?id=766619
2016-05-19 11:57:33 +03:00
Edward Hervey
2639fbdb7f rtspclientsink: Check return value of sscanf
And just make sure we always have 0/0 if we have an error

CID #1352031
2016-04-29 11:45:19 +02:00
Jake Foytik
fe5f8077c1 rtsp-stream: Fix crash on cleanup with shared media and multiple udpsrc
- Unicast udpsrcs are now managed in a hash table. This allows for proper cleanup in with shared streams and fixes a memory leak.
 - Unicast udpsrcs are now properly cleaned up when shared connections exit. See the update_transport() function.
 - Create unit test for shared media.

https://bugzilla.gnome.org/show_bug.cgi?id=764744
2016-04-29 11:49:14 +03:00
Sebastian Dröge
aa9a2443a1 rtsp-stream: Always bind to ANY when address is a multicast address and not only on Windows
For IPv6 addresses, binding to a multicast group does not work on Linux
either. Always bind to ANY and then later join the multicast group.

https://bugzilla.gnome.org/show_bug.cgi?id=764679
2016-04-29 11:48:57 +03:00
Patricia Muscalu
f0891e2cdf rtsp-thread-pool: explained why GSource is a part of ThreadImpl
Clarified why it is necessary to add source information to
GstRTSPThreadImpl. See the reported bug in GLib:
https://bugzilla.gnome.org/show_bug.cgi?id=720186
for more information.

https://bugzilla.gnome.org/show_bug.cgi?id=761702
2016-04-06 09:46:34 +01:00
Sebastian Dröge
60dd95849f rtsp-server: Use $(GST_NET_LIBS) / $(GST_NET_CFLAGS) 2016-04-03 12:06:29 +03:00
Sebastian Dröge
9fab555cc5 rtsp-server: Implement clock signalling according to RFC7273
For NTP and PTP clocks we signal the actual clock that is used and signal
the direct media clock offset.

For all other clocks we at least signal that it's the local sender clock.

This allows receivers to know which clock was used to generate the media and
its RTP timestamps. Receivers can then implement network synchronization,
either absolute or at least relative by getting the sender clock rate directly
via NTP/PTP instead of estimating it from RTP timestamps and packet receive
times.

https://bugzilla.gnome.org/show_bug.cgi?id=760005
2016-04-03 11:22:31 +03:00
Sebastian Dröge
b63a6f029f rtspclientsink: Add support for setting the multicast interface
https://bugzilla.gnome.org/show_bug.cgi?id=763000
2016-03-25 12:52:12 +02:00
Sebastian Dröge
69d04f3838 rtsp-media: Add support for setting the multicast interface
https://bugzilla.gnome.org/show_bug.cgi?id=763000
2016-03-25 12:52:12 +02:00
Vineeth TM
1796ce2f03 rtspclientsink: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763196
2016-03-24 14:38:56 +02:00
Sebastian Dröge
8e72e69eec rtsp-stream: Don't set the state of the appsrc from PLAYING to PAUSED again during setup
This would get us NO_PREROLL in the bin again and break seeking.
Thanks to Carlos Rafael Giani for helping to debug this!

https://bugzilla.gnome.org/show_bug.cgi?id=740509
2016-03-16 23:36:30 +02:00
Sebastian Dröge
8b68edd138 rtsp-stream: Ensure that the pipeline is live and later-added udpsrcs are syncing the state with the parent bin
Without this, RECORD pipelines are broken because
a) we wait for ASYNC_DONE which never happens anymore because udpsrc would be
added later. Previously it was there earlier and due to NO_PREROLL caused the
pipeline to preroll immediately
b) the udpsrc for the pipeline is added later and never set to PLAYING state,
as the corresponding code previously was only for PLAY pipelines.

https://bugzilla.gnome.org/show_bug.cgi?id=763281
2016-03-10 19:47:13 +02:00
Jan Schmidt
4a6f63ad03 rtsp-stream: Fix typo in the docstring
gst_rtsp_stream_set_client_side -> gst_rtsp_stream_is_client_side
2016-03-11 01:23:15 +11:00
Sebastian Dröge
206d2ded09 rtsp-stream: Disable multicast loopback for all our sockets
On Windows this is a receiver-side setting, on Linux a sender-side setting. As
we provide a socket ourselves to udpsrc, udpsrc is never setting the multicast
loopback setting on the socket... while udpsink does which unfortunately has
no effect here on Windows but on Linux.

https://bugzilla.gnome.org/show_bug.cgi?id=757488
2016-03-05 10:53:15 +02:00
Sebastian Dröge
9794822549 rtsp-stream: Only bind multicast sockets to ANY on Windows
On Linux it is still needed to bind to the multicast address
to filter out random other packets, while on Windows binding
to multicast addresses just fails.
2016-03-04 13:51:12 +02:00
Sebastian Dröge
a7ced98346 rtsp-stream: Only use the address pool for unicast UDP if it contains unicast addresses
Otherwise we fail to allocate UDP ports if the pool only contains multicast
addresses, which is something that used to work before. For unicast addresses
if the pool contains none, we just allocate them as if there is no pool at
all.

https://bugzilla.gnome.org/show_bug.cgi?id=757488
2016-03-03 10:43:13 +02:00
Sebastian Dröge
406ed190ac rtsp-server: Fix indentation 2016-03-02 11:48:49 +02:00
Sebastian Dröge
bcee3202d3 rtsp-stream: Don't bind the sockets to multicast addresses
This works on Linux but fails completely on Windows. You're supposed
to bind to ANY and then join the multicast group.

https://bugzilla.gnome.org/show_bug.cgi?id=757488
2016-03-02 11:47:47 +02:00
Jan Schmidt
b96e4e16a7 rtspsink: Fix some leaks in rtspclientsink and the unit test.
https://bugzilla.gnome.org/show_bug.cgi?id=762525
2016-02-24 02:12:08 +11:00
Patricia Muscalu
f62a9a7eb9 rtsp-stream: postpone UDP socket allocation until SETUP
Postpone the allocation of the UDP sockets until we know
what transport has been chosen by the client.
Both unicast and multicast UDP sources are created in one
function.

https://bugzilla.gnome.org/show_bug.cgi?id=757488
2016-02-23 17:05:15 +02:00
Patricia Muscalu
d10ba734cd rtsp-stream: postpone the creation of the UDP sources
Code refactoring: allocate the UDP ports after the sender and
the reciver parts have been created.
We postpone the creation of the UDP sources until the UDP
ports have been allocated.

https://bugzilla.gnome.org/show_bug.cgi?id=757488
2016-02-23 17:05:15 +02:00
Patricia Muscalu
66389cb900 rtsp-stream: added function for setting UDP sources to PLAYING state
Code refactoring: Introduced a function for setting UDP sources
to PLAYING state.

https://bugzilla.gnome.org/show_bug.cgi?id=757488
2016-02-23 17:05:15 +02:00
Patricia Muscalu
c0cadc6ec3 rtsp-stream: added function for creating and configuring UDP sources
Code refactoring: create and configure UDP sources in a separate function.

https://bugzilla.gnome.org/show_bug.cgi?id=757488
2016-02-23 17:05:15 +02:00
Patricia Muscalu
b26c16c824 rtsp-stream: added function for RTP/RTCP socket configuration
Code refactoring: configure RTP and RTCP sockets for UDP sinks
in a separate function.

https://bugzilla.gnome.org/show_bug.cgi?id=757488
2016-02-23 17:05:15 +02:00
Patricia Muscalu
6b6970ab23 rtsp-stream: added function for creating and configuring UDP sinks
Code refactoring: create and configure UDP sinks in a separate function.

https://bugzilla.gnome.org/show_bug.cgi?id=757488
2016-02-23 17:05:15 +02:00
Patricia Muscalu
89bc8009dd rtsp-stream: added helper function for creating the sender/receiver parts
Code refactoring: introduced helper function for creating
the receiver and the sender parts of the streaming pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=757488
2016-02-23 17:05:15 +02:00
Luis de Bethencourt
fb9e957cc2 rtspclientsink: remove check for impossible condition
Goto error label checks stream to see if it needs to be unreferenced before
returning, but this goto jumps happens before the stream is ever set, so it
will always be NULL in this error label.

CID #1352034
2016-02-09 10:36:56 +00:00
Luis de Bethencourt
4922b7f6b2 rtspclientsink: clean switch statements
Coverity demands for fallthrough statements to be clearly commented,
to distinguish from accidental fall throughs. And it also needs all
cases to finish with a break, even if the break is never going to be
executed like in the case of a continue jump.

CID #1352039
CID #1352040
2016-02-08 23:33:22 +00:00
Steven Hoving
aea624b6f8 rtsp-media: fix state_lock not locked again when preroll fails
https://bugzilla.gnome.org/show_bug.cgi?id=761399
2016-02-02 10:36:05 +00:00
Jan Schmidt
b55fafdfbf rtspclientsink: Simplify slightly using new -base API
Use the new Mikey and SDP API in the base plugins libs
to simplify some code.

https://bugzilla.gnome.org/show_bug.cgi?id=758180
2016-01-29 01:44:26 +11:00
Jan Schmidt
f54dd50203 rtspsink: Add rtspclientsink element
Add an rtspclientsink element that accepts streams for which
there is a registered payloader and sends them to
an RTSP server using RECORD.

Sending is synchronised to the pipeline clock. Payload-types
are automatically selected. The 'new-payloader' signal is fired
for custom configuration of payloaders when they are created.

Can now stream a movie like this:

receiver:
  ./test-record "( decodebin name=depay0 ! videoconvert ! autovideosink \
       decodebin name=depay1 ! audioconvert ! autoaudiosink )"
sender:
  gst-launch-1.0 filesrc location=file-with-aac-and-h264.mp4 ! qtdemux name=d ! \
       queue ! aacparse ! rtspclientsink location=rtsp://127.0.0.1:8554/test name=s \

https://bugzilla.gnome.org/show_bug.cgi?id=758180
2016-01-29 01:44:26 +11:00
Jan Schmidt
b6ca057c72 rtsp-stream: Add functions for using rtsp-stream from the client
Add a boolean to indicate that the rtsp-stream is running on the
'client' side of an RTSP connection, for sending streams via
RECORD. In that case, the roles of the client/server ports
in transport setup are swapped.

https://bugzilla.gnome.org/show_bug.cgi?id=758180
2016-01-29 01:44:26 +11:00
Jan Schmidt
192a1eea34 rtsp-sdp: Add gst_rtsp_sdp_from_stream()
A new function that adds info from a GstRTSPStream into an SDP message.

https://bugzilla.gnome.org/show_bug.cgi?id=758180
2016-01-29 01:44:26 +11:00
Steven Hoving
fefc011dfb rtsp-media: Fix mutex beeing unlocked while they should be locked
https://bugzilla.gnome.org/show_bug.cgi?id=761226
2016-01-28 09:34:32 +01:00
Tim-Philipp Müller
ac1d35b147 rtsp-media-factory: add missing break in "clock" property setter
CID 1348453
2016-01-15 07:01:37 +00:00
Srimanta Panda
fdbda049c6 rtsp-stream: fixed assert during update transport
When RTSP server trying update transport during multicast, it throws an
assert. The assert is thrown because it is trying to get the parent of
an non-existing funnel element.

https://bugzilla.gnome.org/show_bug.cgi?id=760150
2016-01-07 14:31:03 +02:00
Tim-Philipp Müller
bec94861b0 docs: remove dummy function declarations with G_INLINE_FUNC for gtk-doc
gtk-doc can handle static inline functions just fine these days,
there's no need for this stuff any more.
2016-01-03 17:26:31 +00:00
Hyunjun Ko
924f914172 sdp: replace duplicated codes to call new base sdp apis
https://bugzilla.gnome.org/show_bug.cgi?id=745880
2015-12-31 17:13:39 +02:00
Sebastian Dröge
7a41d396ae rtsp-media: Add API to directly configure a clock on the media pipelines 2015-12-30 18:40:43 +02:00
Sebastian Dröge
cbf3f3888f rtsp-media: Fix typo in docs gst_rtsp_media_set_latncy() -> latency() 2015-12-30 16:43:17 +02:00
Sebastian Dröge
6b76c02552 rtsp-media-factory: Add FIXME for 2.0 2015-12-30 16:30:38 +02:00
Sebastian Dröge
3d6b93bcd3 rtsp-stream: Fix indentation 2015-12-30 16:29:45 +02:00
Sebastian Rasmussen
b2abb97043 rtsp-media: Do not prepare media after media times out
Deferred calls to start_prepare() can be deferred past the point until
which wait_preroll() and by proxy gst_rtsp_media_get_status() is
prepared to wait. Previously there was no lock and no check for this
situation. This meant that a media could be prepared and unprepared
simultaneously by two different threads. Now a lock is in place and a
suitable check is done.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=759773
2015-12-28 14:08:09 +02:00
Sebastian Dröge
c8f179948e rtsp-media: Add property to decide if sending media should be stopped when a client disconnects without TEARDOWN
Without TEARDOWN it might be desireable to keep the media running and continue
sending data to the client, even if the RTSP connection itself is
disconnected.

Only do this for session medias that have only UDP transports. If there's at
least on TCP transport, it will stop working and cause problems when the
connection is disconnected.

https://bugzilla.gnome.org/show_bug.cgi?id=758999
2015-12-28 10:51:56 +02:00
Olivier Crête
ee3a7b61ef rtsp-session-pool: Avoid dollar sign ($) in session ids
Live555 in VLC strips off dollar signs and then gets very confused,
we don't loose too much entropy by just skipping it.
2015-12-15 16:57:37 -05:00
Xavier Claessens
0ea68a1b0f rtsp-server: Add g_autoptr() support to all types
https://bugzilla.gnome.org/show_bug.cgi?id=754464
2015-12-14 13:52:17 -05:00
Srimanta Panda
f96947b350 rtsp-stream: fixed valgrind error
Fixed the valgrind error in unit test. The UDP source created during
gst_rtsp_stream_join_bin() was not released while destroying the rtp
bin.

https://bugzilla.gnome.org/show_bug.cgi?id=759010
2015-12-08 09:47:53 +02:00
Srimanta Panda
ed70572c6c rtsp-client: suspend media during setup request
SETUP request from clients needs to suspend the media to clear the
prerolled buffers. Otherwise it will not affect the prerolled buffer
and the prerolled buffers will be incorrect (for example block-size
from setup request will not affect the prerolled buffer unless the
media is suspended).

https://bugzilla.gnome.org/show_bug.cgi?id=758268
2015-12-04 15:48:23 +02:00
Srimanta Panda
82dffd17b3 rtsp-stream: create stream pipeline based on transport
Based on the protocol, create the rtsp stream pipeline. If only TCP or
only UDP is set as the transport protocol, it will not add the extra tee
or queue element to the pipeline. Both these elements will be added, if
it supports both TCP and UDP protocols. This improves the pipeline
performance when one protocol is present.

https://bugzilla.gnome.org/show_bug.cgi?id=758179
2015-12-04 14:13:10 +02:00
Sebastian Dröge
61772cb326 rtsp-stream: Only create RTP sending/receiving rtpbin pads if needed
Adding them when not needed will start some logic inside rtpbin that might be
problematic. Also if e.g. for a sender media we suddenly receive RTP data, we
would start up a rtpjitterbuffer and behave in weird ways.

We still set up the UDP sources for RTP receiving for a sender media to be
able to receive any packets sent by the client for NAT traversal. They will
all go to a fakesink though.

Having an rtpjitterbuffer in the media pipeline will cause the pipeline to be
NO_PREROLL, which will cause deadlocks when seeking the media as it will never
receive ASYNC_DONE after a seek.

https://bugzilla.gnome.org/show_bug.cgi?id=758319
2015-12-01 15:32:45 +02:00
Sebastian Dröge
cdc0849dfe rtsp-stream: Disable multicast loopback for the multicast udp sources too
On POSIX this setting is for sender sockets, on Windows for receiver sockets.
Previously we were only setting this for sender sockets, which caused looped
back packets to be received on Windows if a multicast transport was used.
2015-11-17 12:45:58 +02:00
Jan Schmidt
9e92a0307c rtsp-client: Report RECORD and ANNOUNCE as supported in the OPTIONS 2015-11-17 01:12:28 +11:00
Marcus Prebble
b90d4ba917 rtsp-server: Change the logic so we don't pop a NULL context
When doing a port scan (e.g. with nmap) the call to GST_RTSP_CHECK()
will sometimes fail. This call is made before any context is pushed
resulting in an attempt to pop a NULL context.

https://bugzilla.gnome.org/show_bug.cgi?id=757949
2015-11-11 15:58:27 +01:00
David Svensson Fors
81ae320383 rtsp-stream: Always unref return value of gst_object_get_parent()
Fixes a leak of a GstBin in the udp-mcast case.

https://bugzilla.gnome.org/show_bug.cgi?id=756968
2015-10-22 19:28:15 +03:00
Hyunjun Ko
a51337974c stream: listen to sender ssrc signals
https://bugzilla.gnome.org/show_bug.cgi?id=746747
2015-10-02 16:40:31 +03:00
Sebastian Rasmussen
6f1cad9237 rtsp-media: Take reference to media that will be prepared
default_prepare() takes a transfer-none reference GstRTSPMedia object.
Later on a g_idle_source_new() is created and a pointer to the media
object is passed as user data. If the media is freed before the idle
source is dispatched the media object pointer is invalid, but the idle
source callback expects it to still be valid. To fix this a reference to
the media object is taken when registering the source callback function
and a corresponding release of the reference is done when the souce is
destroyed.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=755748
2015-09-29 11:23:06 +01:00
Tim-Philipp Müller
da8a31ac88 stream: fix docs for recently-added get/set_buffer_size API
https://bugzilla.gnome.org/show_bug.cgi?id=749095
2015-09-17 20:07:34 +01:00
Jan Schmidt
315c2f93bb rtsp-media: Don't crash on encrypted RTX SDP
In parse_keymgmt(), don't mutate the input string that's been passed
as const, especially since we might need the original value again if
the same key info applies to multiple streams (RTX, for example).

https://bugzilla.gnome.org/show_bug.cgi?id=754753
2015-09-09 17:57:15 +10:00
Jan Schmidt
27736d406e rtsp-stream: Implement UDP buffer size setting.
Add gst_rtsp_stream_(get|set)_buffer_size and use it to configure the
UDP TX buffer size.

Incorporates a patch by Hyunjun Ko <zzoon.ko@samsung.com>
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=749095
2015-09-03 22:19:40 +10:00
Jan Schmidt
9bfcdba42b rtsp-media: Fix small typo causing gtk-doc to complain 2015-09-03 22:16:30 +10:00
Hyunjun Ko
4c6b1faa6a media-factory: get port number through gst_rtsp_url_get_port
https://bugzilla.gnome.org/show_bug.cgi?id=753473
2015-08-16 12:08:49 +02:00
Xavier Claessens
8511ffe178 Document that source keeps a ref on server until it's destroyed
https://bugzilla.gnome.org/show_bug.cgi?id=749227
2015-08-10 12:18:53 -04:00
Nicolas Dufresne
707ac9c487 media: Only add fakesink once per pipeline
The intention is to prevent going PLAYING state before pads are created.
If there was mutilple dynamic payload, it would leak few fakesink and
actually prevent from ever reaching playing state.

https://bugzilla.gnome.org/show_bug.cgi?id=753385
2015-08-08 09:46:40 -04:00
Nicolas Dufresne
160b87430f Revert "rtsp-media: Only add 1 fakesink per pipeline"
This reverts commit 22bf61f16c.
2015-08-08 09:08:37 -04:00
Nicolas Dufresne
22bf61f16c rtsp-media: Only add 1 fakesink per pipeline
There should be only one fakesink per pipeline, not per dynpay. This
would lead to element naming clash.
2015-08-07 09:33:55 -04:00
Vineeth TM
3920e21cd0 rtsp-media: assertion error due to wrong condition check
In media to caps function, reserved_keys array is being used for variable i,
leading to GLib-CRITICAL **: g_ascii_strcasecmp: assertion 's1 != NULL' failed
changed it to variable j

https://bugzilla.gnome.org/show_bug.cgi?id=753009
2015-07-30 15:52:08 +03:00
Sebastian Dröge
ae7bec97cb rtsp-media: Strip keys from the fmtp that we use internally in our caps
Skip keys from the fmtp, which we already use ourselves for the
caps. Some software is adding random things like clock-rate into
the fmtp, and we would otherwise here set a string-typed clock-rate
in the caps... and thus fail to create valid RTP caps

https://bugzilla.gnome.org/show_bug.cgi?id=753009
2015-07-29 11:28:21 +01:00
Xavier Claessens
5585dc5878 threadpool: Fix possible warning in gst_rtsp_thread_pool_cleanup()
https://bugzilla.gnome.org/show_bug.cgi?id=752640
2015-07-20 16:47:05 -04:00
Ognyan Tonchev
8922afb88d rtsp-client: allow application to decide what requirements are supported
Add "check-requirements" signal and vfunc to allow application
(and subclasses) to check the requirements.

Based on patch from Hyunjun Ko <zzoon.ko@samsung.com>

https://bugzilla.gnome.org/show_bug.cgi?id=749417
2015-06-23 14:38:29 +01:00
Ognyan Tonchev
fb71b9c4e9 rtsp-media: Always use real payloader when creating streams
A bin that contains the real payloader might be used as payloader. In this
case we have to get the real payloader for the various properties it provides.

Example use cases for this are bins that payload some media and then have
additional elements that add metadata or RTP extension headers to the stream.

https://bugzilla.gnome.org/show_bug.cgi?id=750800
2015-06-16 11:09:37 +02:00
Hyunjun Ko
2a3dd3d38f rtsp-stream: add description for gst_rtsp_stream_request_aux_sender
https://bugzilla.gnome.org/show_bug.cgi?id=750764
2015-06-11 11:37:03 +01:00
Xavier Claessens
6ec8fe44b2 GstRTSPAuth: Add client certificate authentication support
https://bugzilla.gnome.org/show_bug.cgi?id=750471
2015-06-09 19:51:46 -04:00
Göran Jönsson
08e0c79cee rtsp-client: No flush during Teardown.
When calling gst_rtsp_watch_write_data in gstrtspconnection.c and
backlog is empty it can happen that just a part of a message will be
sent and rest is in backlog queue. If then flush during teardown
just a part of message will be sent.This can lead to client miss
teardown response since it expect to get the last part of message.

The flushing during teardown was introduced to fix a deadlock that now
is fixed more generally in handle_request by temporary  setting backlog
size to unlimited.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=749845
2015-06-03 15:09:10 +02:00
Sebastian Dröge
8700468499 rtsp-server: Use single-include rtsp header to make sure we get all definitions 2015-05-20 17:05:47 +03:00
Sebastian Dröge
1c30c60e64 rtsp-media: Mark some more functions static 2015-05-05 16:46:57 +02:00
Sebastian Dröge
bbdf0a47d1 rtsp-media: Only unblock the media in suspend() when actually changing the state
Otherwise we're going to lose a few packets for live streams during DESCRIBE.
2015-05-05 16:46:19 +02:00
Sebastian Dröge
ec2c500a9d rtsp-sdp: Only add RTX to the SDP when using a feedback profile 2015-05-04 16:31:20 +02:00
Hyunjun Ko
4ff22ef6d2 rtsp-stream: get valid clock-rate from last-sample
clock-rate in last-sample's caps is integer, not unsigned.
To get this value properly, variable needs to be type-casted to int.

https://bugzilla.gnome.org/show_bug.cgi?id=747614
2015-04-27 12:41:59 +02:00
Hyunjun Ko
de590b4b2a rtsp-stream: fix to get valid each stream data for request-aux-sender signal
Because of duplicated g_signal_connect for request-aux-sender signal,
wrong stream pointer is passed to the signal handler.
Instead of passing each stream, pass stream array and get the relevant stream.

https://bugzilla.gnome.org/show_bug.cgi?id=747839
2015-04-15 15:14:04 +02:00
Sebastian Dröge
ef3bfd757b rtsp-stream: Limit the queues to 1 buffer
We only need them to be able to pre-roll, queueing up more data here
is only going to harm latency and memory usage.
2015-03-23 21:04:43 +01:00
Sebastian Dröge
357af7aea6 rtsp-stream: Update comment and ASCII art to the latest code
We have a queue in front of the udpsink too to prevent the pipeline from
locking up.
2015-03-23 20:59:52 +01:00
Nicolas Dufresne
dfb053add3 rtsp-media: Properly return first rtptime
Instead we where returning first GstBuffer timestamp. This would result
in clock skew and unwanted behaviour in RTSP playback.

https://bugzilla.gnome.org/show_bug.cgi?id=746479
2015-03-21 11:04:05 -04:00
Nicolas Dufresne
01562286ba rtsp-stream: Don't leave buffer mapped
If the seq is NULL, the RTP buffer was left mapped. We should always
unmap the buffer.
2015-03-18 16:44:19 -04:00
Tim-Philipp Müller
896767b041 Fix double semicolons 2015-03-10 09:39:22 +00:00
Sebastian Dröge
852cc09f54 rtsp-stream: Get the seqnum-base and other information from the last buffer in the sink
This gives more accurate values than asking the payloader. There might be
queueing happening between the payloader and the sink.

https://bugzilla.gnome.org/show_bug.cgi?id=745704
2015-03-09 16:00:38 +01:00
Sebastian Dröge
b58af93d83 rtsp-media: Don't seek for PLAY if the position will not change
https://bugzilla.gnome.org/show_bug.cgi?id=745704
2015-03-09 13:00:25 +01:00
Sebastian Dröge
93bdbb6acd rtsp-media: Don't include payload type in the caps for framesize
When the sdp media attribute framesize are converted to caps
the <payload> should not be included.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=725335

Based on the patch for rtspsrc by Linus Svensson <linussn@axis.com>
2015-03-09 10:21:49 +01:00
Linus Svensson
9dadaed2fd rtsp-sdp: add payload type to the sdp framesize attribute
The sdp framesize attribute is desribed in RFC6064. It is specified
for payloading of H263 and has the following form
a=framesize:<payload type> <width>-<height>. The <width>-<height> part
should be added to the caps in a payloader and the <payload type> should
be added by the rtsp-server.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=725334
2015-03-09 09:26:38 +01:00
Jan Schmidt
db42945c2c rtsp-media-factory: Add functions to set/get the media gtype
Allow specifying the GType of a GstRtspMedia subclass to create
as a simpler way to get the factory to create a custom
GstRtspMedia sub-class, without subclassing GstRtspMediaFactory.
2015-03-03 11:53:16 +11:00
Gregor Boirie
bc7765eee7 rtsp-media: fix double unlock in _get_buffer_size()
Fixes an abort when calling gst_rtsp_media_get_buffer_size()
because of double g_mutex_unlock () usage.

https://bugzilla.gnome.org/show_bug.cgi?id=745434
2015-03-02 10:50:57 +00:00
Kent-Inge Ingesson
d2f1997c4b rtsp-session: Use monotonic time for RTSP session timeout
Changed RTSP session timeout handling to monotonic time
and deprecating the API for current system time.

This fixes timeouts when the system time changes.

https://bugzilla.gnome.org/show_bug.cgi?id=743346
2015-02-19 10:43:30 +02:00
Sebastian Dröge
51ed357597 rtsp-client: Only error out in PLAY if seeking actually failed
If the media was just not seekable, we continue from whatever position we are
and let the client decide if that is what is wanted or not.

Only if the actual seek failed, we can't really recover and should error out.
2015-02-13 12:21:16 +02:00
Andreas Frisch
bac59c52f1 rtsp-stream: Add necessary queues between tee and multiudpsink
https://bugzilla.gnome.org/show_bug.cgi?id=744379
2015-02-13 11:28:43 +02:00
Sebastian Dröge
98b162f54b rtsp-media: If seeking fails, don't wait forever for the media to preroll again
Instead error out properly the same way as if the SEEKING query already
failed.
2015-02-12 16:53:27 +02:00
Tim-Philipp Müller
dc43f427a9 rtsp-stream: minor code formatting fix 2015-02-11 17:25:35 +00:00
Luis de Bethencourt
ec7bf5379e rtsp-media: fix logic for collect_streams
Fix the logic of gst_rtsp_media_collect_streams() so after looping collecting
all streams it knows if it got any, and can check if the transport mode is OK.

CID #1268400
2015-02-10 16:45:23 +00:00
Sebastian Dröge
8405cfad3a rtsp-media: Don't set the transport mode based on what elements we find
Just print a warning if the one that was set before disagrees with what
elements we found. It must already be set to something before as this
function is called after we received the SDP from ANNOUNCE in RECORD mode,
and we would reject ANNOUNCE if the RECORD flag was not set.
2015-02-09 10:21:50 +01:00
Tim-Philipp Müller
57c21c8f9e rtsp-client: fix awkward if clause 2015-02-08 12:08:36 +00:00
Sebastian Dröge
a93ed7e5d4 rtsp-media: Use flags to distinguish between PLAY and RECORD media 2015-02-06 09:42:50 +01:00
Tim-Philipp Müller
e9ce91634c rtsp-client: fix a couple of leaks in handle_announce 2015-02-06 09:42:50 +01:00
Sebastian Dröge
35b2b10cf4 rtsp-media: Expose latency setting for setting the rtpbin latency 2015-02-06 09:42:50 +01:00
Sebastian Dröge
844add610d rtsp-stream: Put the timestamp of receival of the initial packet over TCP on the first buffer 2015-02-06 09:42:50 +01:00
Sebastian Dröge
ccf6c6eb53 Add initial support for RECORD
We currently only support media that is RECORD or PLAY only, not both at once.

https://bugzilla.gnome.org/show_bug.cgi?id=743175
2015-02-06 09:42:42 +01:00
Anila Balavan
18668bf495 rtsp-stream: RTCP and RTP transport cache cookies seperated
RTCP packets were not sent because the same tr_cache_cookie was used for
both RTP and RTCP. So only one of the tr_cache lists were populated
depending on which one was sent first. If the tr_cache list is not
populated then no packets can be sent. Most often this happened to be
RTCP. Now seperate RTCP and RTP transport cache cookies are added which
resulted in both the tr_cache_lists to be populated regardless of which
one was sent first.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=743734
2015-01-30 18:26:44 +01:00
Tim-Philipp Müller
6987a00fa9 rtsp-stream: fix false compiler warning
rtsp-stream.c:3034: error: ‘visited’ may be used uninitialized in this function
2015-01-21 14:58:19 +00:00
Tim-Philipp Müller
cc3e0ed39b rtsp-client: log interleaved data received 2015-01-19 23:24:28 +00:00
Tim-Philipp Müller
47eaac5b9e rtsp-client: fix unintentional fallthrough to debug warning when receiving interleaved data 2015-01-19 23:18:02 +00:00
Sebastian Dröge
fcef562f35 rtsp-client: If we have a single-stream media and SETUP contains no control, use the one and only stream 2015-01-19 13:09:20 +01:00
Sebastian Dröge
69e346419a rtsp-client: Use a random session ID in the SDP
RFC4566 Section 5.2 says that it should make the username, session id,
nettype, addrtype and unicast address tuple globally unique. Always using
1188340656180883 is not going to guarantee that: https://xkcd.com/221/

Instead let's create a 64 bit random number, which at least brings us
closer to the goal of global uniqueness.

https://tools.ietf.org/html/rfc4566#section-5.2
2015-01-18 19:08:36 +01:00
Sebastian Dröge
586fe4ea4b rtsp-client: Drop trailing \0 of RTSP DATA messages
We add a trailing \0 in GstRTSPConnection to make parsing of
string message bodies easier (e.g. the SDP from DESCRIBE) but
for actual data this means we have to drop it or otherwise
create invalid data.
2015-01-16 20:06:57 +01:00
Göran Jönsson
0d2de69db9 rtsp-stream: Have one copy of the transports cache for RTP and RTCP each
Fixes crash when two threads access handle_new_sample() at the same
time, one for RTP, one for RTCP.

Otherwise, when iterating over the transports cache, it might be modified by
another thread at the same time if the transports cookie has changed.

https://bugzilla.gnome.org/show_bug.cgi?id=742954
2015-01-16 12:52:43 +01:00
Sebastian Dröge
fe8e877dd9 rtsp-stream: Set format=TIME on our app sources for TCP 2015-01-15 19:35:01 +01:00
Sebastian Rasmussen
94f3e18c5b Revert "rtsp-session-pool: Make sure session IDs are properly URI-escaped"
This reverts commit 935e8f852d.

RFC 2326 states that session IDs may consist of alphanumeric as well as
the safe characters $-_.+ -- N.B. the percent character is not allowed.

Previously the session ID was URI-escaped, this meant that any character
which was not alphanumeric or any of the characters +-._~ would be
percent encoded. While the RFC (surprisingly) mentions that linear white
space in session IDs should be URI-escaped, it does not say anything
about other characters. Moreover no white space is allowed in the
session ID. Finally the percent character which is the result of
URI-escaping is not allowed in a session ID.

So there is no reason to do any URI-escaping, and now it is removed.

https://bugzilla.gnome.org/show_bug.cgi?id=742869
2015-01-14 18:43:37 +01:00
Sebastian Dröge
79e41bc2be rtsp-client: Add a send_message default signal handler
This allows subclasses to easily hook into the response sending
mechanism without doing everything from a signal, which seems
awkward from subclasses.
2014-12-29 12:06:50 +01:00
Sebastian Dröge
a44b564f59 rtsp-stream: Fix some minor memory leaks 2014-12-16 16:46:15 +01:00
Sebastian Dröge
8ae3566591 rtsp-media: Some minor cleanup 2014-12-16 16:46:06 +01:00
Sebastian Dröge
06bfc0697b rtsp-stream: Fix compiler warnings
rtsp-stream.c:1351:3: error: non-void function 'gst_rtsp_stream_get_retransmission_time' should return a value [-Wreturn-type]
  g_return_if_fail (GST_IS_RTSP_STREAM (stream));
  ^

rtsp-stream.c:1384:3: error: non-void function 'gst_rtsp_stream_get_retransmission_pt' should return a value [-Wreturn-type]
  g_return_if_fail (GST_IS_RTSP_STREAM (stream));
  ^
2014-12-16 16:42:13 +01:00
Matthew Waters
4f40781fff media: implement ssrc-multiplexed retransmission support
based off RFC 4588 and the server-rtpaux example in -good
2014-12-16 16:41:08 +01:00
Göran Jönsson
058698c9cf rtsp: Ref transports in hash table.
Also ref streams for transports.
This solves a crash when reciving a rtcp after teardown but before
client finalize.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=740845
2014-12-02 16:29:24 +01:00
Wim Taymans
bd8b2d3fb9 client: refactor cleanup of cached media 2014-11-07 12:48:53 +01:00
Linus Svensson
088eee6590 client: Configure transport after creating session media
The default implementation of configure_client_transport() in
rtsp-client uses the session media when it chooses channels for
interleaved traffic.

https://bugzilla.gnome.org/show_bug.cgi?id=739112
2014-11-07 12:42:48 +01:00
Linus Svensson
a455181aff client: Stop caching media in client when doing setup
If the media has been managed by a session media, it should not be
cached in the client any longer. The GstRTSPSessionMedia object is now
responsible for unpreparing the GstRTSPMedia object using
gst_rtsp_media_unprepare(). Unprepare the media when finalizing the
session media.

https://bugzilla.gnome.org/show_bug.cgi?id=739112
2014-11-07 12:34:23 +01:00
Aleix Conchillo Flaqué
7c267928ff rtsp-stream: unref srtp decoder when leaving bin
https://bugzilla.gnome.org/show_bug.cgi?id=739481
2014-11-01 11:26:14 +00:00
Aleix Conchillo Flaqué
ef9dc6c9e4 rtsp-client: mikey memory leaks
https://bugzilla.gnome.org/show_bug.cgi?id=739383
2014-10-30 10:34:56 +00:00
Vincent Penquerc'h
f803be2dc8 rtsp-media: deactivate media when shutting down from paused
This was only done when going directly from playing.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=737829
2014-10-21 11:52:27 +02:00
Aleix Conchillo Flaqué
0aad92531d rtsp-client: add stream transport to context
We add the stream transport to the context so we can get the configured
client stream transport in the setup request signal.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=738905
2014-10-21 11:44:40 +02:00