Commit graph

322 commits

Author SHA1 Message Date
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é
ef9dc6c9e4 rtsp-client: mikey memory leaks
https://bugzilla.gnome.org/show_bug.cgi?id=739383
2014-10-30 10:34:56 +00: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
Aleix Conchillo Flaqué
6c0c90c9d2 client: set session media to NULL without the lock
We need to set session medias to NULL without the client lock otherwise
we can end up in a deadlock if another thread is waiting for the lock
and media unprepare is also waiting for that thread to end.

https://bugzilla.gnome.org/show_bug.cgi?id=737690
2014-10-01 10:31:04 +01:00
Sebastian Rasmussen
404a80e38a rtsp-client: Remove backlog limit while processings requests
If the backlog limit is kept two cases of deadlocks may be
encountered when streaming over TCP. Without the backlog
limit this deadlocks can not happen, at the expence of
memory usage.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=737631
2014-09-30 12:22:49 +02:00
Ognyan Tonchev
17f5785638 rtsp-client: do not free main context before rtsp watch
https://bugzilla.gnome.org/show_bug.cgi?id=737110
2014-09-24 10:42:16 +03:00
Branko Subasic
2218510cae rtsp-*: Treat sending packets to clients as keepalive
As long as gst-rtsp-server can successfully send RTP/RTCP data to
clients then the client must be reading. This change makes the server
timeout the connection if the client stops reading.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=736647
2014-09-24 10:37:59 +03:00
Branko Subasic
733ef1162b rtsp-client: Allow backlog to grow while expiring session
Allow the send backlog in the RTSP watch to grow to unlimited size while
attempting to bring the media pipeline to NULL due to a session
expiring.  Without this change the appsink element cannot change state
because it is blocked while rendering data in the new_sample callback.
This callback will block until it has successfully put the data into the
send backlog. There is a chance that the send backlog is full at this
point which means that the callback may block for a long time, possibly
forever. Therefore the media pipeline may also be prevented from
changing state for a long time.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=736647
2014-09-24 10:37:49 +03:00
Edward Hervey
980553547d rtsp-client: Make old compilers happy
rtsp-client.c:2553:50: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

Just in case that guint8 doesn't fit in a pointer. Just in case ...
2014-09-22 09:30:39 +02:00
Göran Jönsson
23b9d8fbb0 client: raise the backlog limits before pausing
We need to raise the backlog limits before pausing the pipeline or else
the appsink might be blocking in the render method in wait_backlog() and
we would deadlock waiting for paused.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=736322
2014-09-16 11:41:52 +02:00
Göran Jönsson
ebd9be59fe client: make define for the WATCH_BACKLOG
See https://bugzilla.gnome.org/show_bug.cgi?id=736322
2014-09-16 11:29:38 +02:00
Wim Taymans
0292be09ea client: simplify session transport handling
link/unlink of the transport in a session was done to keep track of all
TCP transports and to send RTP/RTCP data to the streams. We can simplify
that by putting all the TCP transports in a hashtable indexed with the
channel number.

We also don't need to link/unlink the transports when we pause/resume
the streams. The same effect is already achieved when we pause/play the
media. Indeed, when we pause the media, the transport is removed from
the media and the callbacks will not be called anymore.

See https://bugzilla.gnome.org/show_bug.cgi?id=736041
2014-09-16 10:46:13 +02:00
Göran Jönsson
09bf2025f8 rtsp-client: Protect saved clients watch with a mutex
Fixes a crash when close() is called while merging clients
in handle_tunnel(). In that case close() would destroy the
watch while it is still being used in handle_tunnel().

https://bugzilla.gnome.org/show_bug.cgi?id=735570
2014-09-04 10:35:56 +03:00
Wim Taymans
ced406cc28 client: expose _close() method
Expose a previously internal close method to close the client
connection.
2014-07-10 17:05:13 +02:00
Wim Taymans
945c93fde0 filter: Release lock in filter functions
Release the object lock before calling the filter functions. We need to
keep a cookie to detect when the list changed during the filter
callback. We also keep a hashtable to make sure we only call the filter
function once for each object in case of concurrent modification.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=732950
2014-07-10 11:36:55 +02:00
Ognyan Tonchev
6543082d2b client: check if watch is set in handle_teardown()
The unit tests run without a watch
2014-07-09 16:17:00 +02:00
Ognyan Tonchev
e0bc97e40c client: keep ref to client for the session removed handler
This extra ref will be dropped when all client sessions have been
removed. A session is removed when a client sends teardown, closes its
endpoint of the TCP connection or the sessions expires.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=732226
2014-07-09 16:16:50 +02:00
Wim Taymans
5aec4af1b9 client: manage media in session as a last step
Once we manage a media in a session, we can't unmanage it anymore
without destroying it. Therefore, first check everything before we
manage the media, otherwise if something is wrong we have no way to
unmanage the media.
If we created a new session and something went wrong, remove the session
again. Fixes a leak in the unit test.
2014-07-08 14:46:13 +02:00
Wim Taymans
99f670d8bc rtsp: fix for MIKEY api change 2014-07-02 16:04:53 +02:00
Wim Taymans
72a57e792f client: free watch context only once
The watch context is freed when the source is destroyed. Avoids
a CRITICAL when we try to unref the context twice.
2014-07-01 16:12:13 +02:00
Wim Taymans
517bb78ae3 client: fix build 2014-07-01 15:02:15 +02:00
Wim Taymans
5e2afcefdd client: protect sessions with lock
Protect the list of sessions with the lock.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=732226
2014-07-01 14:41:14 +02:00
Wim Taymans
fe081e7301 Client: keep a ref to the session
Don't just keep a weak ref to the session objects but use a hard ref. We
will be notified when a session is removed from the pool (expired) with
the new session-removed signal.
Don't automatically close the RTSP connection when all the sessions of
a client are removed, a client can continue to operate and it can create
a new session if it wants. If you want to remove the client from the
server, you have to use gst_rtsp_server_client_filter() now.

Based on patch from Ognyan Tonchev <ognyan.tonchev at axis.com>

See https://bugzilla.gnome.org/show_bug.cgi?id=732226
2014-07-01 12:28:41 +02:00
Evan Nemerson
cecc2cb4ff introspection: add missing allow-none annotations
https://bugzilla.gnome.org/show_bug.cgi?id=730952
2014-06-26 19:08:56 +02:00
Evan Nemerson
d08b46f4b7 gi: improve annotations
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=730953
2014-06-24 09:48:45 +02:00
Wim Taymans
661f4d928f signals: use generic marshal function
Use the generic C marshal function.
Use more explicit type instead of G_TYPE_POINTER
2014-06-24 09:43:44 +02:00
Wim Taymans
d676c56888 sdp: hide key length defines
They don't have a namespace.
2014-06-24 09:34:50 +02:00
Aleix Conchillo Flaqué
32432b5c61 mikey: add different key length parameters
Add encryption and authentication key length parameters to MIKEY. For
the encoders, the key lengths are obtained from the cipher and auth
algorithms set in the caps. For the decoders, they are obtained while
parsing the key management from the client.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=730472
2014-06-19 16:06:27 +02:00
Ognyan Tonchev
f2b1aa8c81 client: ref the context until rtsp watch is alive
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=731569
2014-06-18 15:23:15 +02:00
Ognyan Tonchev
9715252588 client: Destroy the rtsp watch after connection close 2014-06-18 15:21:23 +02:00
Wim Taymans
5aa06b8058 client: store TCP ports in transport
Store the TCP ports in the transport when we are doing RTSP over TCP.
This way, we can easily get to the ports from the transport.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=729776
2014-05-20 15:57:30 +02:00
Aleix Conchillo Flaqué
d01beef7c5 client: fix send-message signal marshaller
Use generic marshalling for the send-message signal. It has
two POINTER arguments, not just one.

https://bugzilla.gnome.org/show_bug.cgi?id=729900
2014-05-10 12:23:16 +01:00
Tim-Philipp Müller
efd079546a rtsp-client: handle Require headers and respond with OPTION_NOT_SUPPORTED
Servers must handle Require headers and must report a failure
if they don't handle any of the Required options, see RFC 2326,
section 12.32: https://tools.ietf.org/html/rfc2326#page-54

https://bugzilla.gnome.org/show_bug.cgi?id=729426
2014-05-09 13:55:21 +01:00
Wim Taymans
ea4543efc8 client: emit a signal before sending a message
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=728970
2014-05-01 06:17:06 +02:00
Wim Taymans
4c42aec6dd client: pass context to send_message
Pass the current context to send_message, we will need it later.
2014-05-01 06:07:08 +02:00
Wim Taymans
a646e278d3 client: fix typo in comment 2014-05-01 05:29:54 +02:00
Wim Taymans
e69241ac97 client: set the watch to flushing before going to NULL
First set the watch to flushing so that we unblock any current and
future attempt to send data on the watch, Then set the pipeline to
NULL.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=728153
2014-04-15 16:51:17 +02:00
Vincent Penquerc'h
adc3e8907e rtsp-client: indent cleanup
Coverity was moaning about unreachable code, and I think it was just
confused by { being before the label. We'll see if it pops up again.

Coverity 1197705
2014-04-10 16:39:11 +01:00
Göran Jönsson
11369d38ef client: Add drop-backlog property
When we have too many messages queued for a client (currently hardcoded
to 100) we overflow and drop the messages. Add a drop-backlog property
to control this behaviour. Setting this property to FALSE will retry
to send the messages to the client by waiting for more room in the
backlog.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=725898
2014-04-10 16:08:06 +02:00
Ognyan Tonchev
0493a63a65 client: support for POST before GET when setting up a tunnel 2014-04-08 16:20:44 +02:00
Ognyan Tonchev
132f77751d client: remove watch of the second client after http tunnel setup
The second client will be freed after the HTTP tunnel has been set up.
Make sure it's RTSP watch is never dispatched again.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=727488
2014-04-08 16:17:30 +02:00
Wim Taymans
248db04720 rtsp: update for MIKEY API changes 2014-04-04 17:39:36 +02:00
Wim Taymans
0d22b798ae client: parse the mikey response from the client
Parse the mikey response from the client and update the policy for
each SSRC.
2014-04-03 17:42:25 +02:00
Wim Taymans
f8a6a5668d client: cleanup error paths 2014-04-03 12:57:13 +02:00
Sebastian Rasmussen
b1b5301577 gobject-introspection: Add annotations to support language bindings
In addition a few cosmetic changes:

 * Adjust the order of arguments
 * Fix typo: occured -> occurred
 * Fix indentation after Return:-clauses

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=726941
2014-03-24 00:36:42 +00:00
David Svensson Fors
faf0b31cbb rtsp-client: vmethod for modifying tunnel GET response
Add a vmethod tunnel_http_response where the response to the HTTP GET
for tunneled connections can be modified.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=725879
2014-03-11 11:17:04 +01:00
Sebastian Dröge
957a4a65c6 rtsp-server: Fix lots of compiler warnings with clang 2014-02-09 10:45:28 +01:00
Wim Taymans
78c6648c96 client: let stream check supported transport
Delegate the check if a transport is allowed to the stream.

See https://bugzilla.gnome.org/show_bug.cgi?id=720696
2014-01-07 12:39:57 +01:00
Wim Taymans
4ca0b23a3f session-media: let the session-media make the RTPInfo
Add method to create the RTPInfo for a stream-transport.
Add method to create the RTPInfo for all stream-transports in a
session-media.
Use the session-media RTPInfo code in client. This allows us to refactor
another method to link the TCP callbacks.
2013-12-26 16:29:38 +01:00
Aleix Conchillo Flaqué
3fdae13fb7 media: add setup_sdp vmethod
gst/rtsp-server/rtsp-media.[ch]: added setup_sdp vmethod and public
gst_rtsp_media_setup_sdp.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720155
2013-12-19 15:10:30 +01:00
Edward Hervey
d3237dc9dc rtsp-client: Fix iteration
Wouldn't even enter the code block otherwise (i++ was used as the check
and not the postfix).
2013-12-19 14:24:54 +01:00
Wim Taymans
7a947e8dfe client: add vmethod to configure media and streams
Implement a vmethod that can be used to configure the media and the
streams based on the current context. Handle the blocksize handling in
the default handler.

See https://bugzilla.gnome.org/show_bug.cgi?id=720667
2013-12-18 15:57:03 +01:00
Wim Taymans
53859ac34b media: also handle prepare and range in suspended state
When we are suspended, we are already prepared.
We can get the range in the suspended state.
2013-11-29 10:53:08 +01:00
Wim Taymans
421499c102 client: store setup uri and use in PLAY response
Store the uri used when doing the setup and use that in the PLAY
response.

fixes https://bugzilla.gnome.org/show_bug.cgi?id=715168
2013-11-28 17:47:18 +01:00
Wim Taymans
b1e8172ef3 client: suspend after SDP and unsuspend before PLAYING
Based on patches by Ognyan Tonchev <ognyan@axis.com>

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=711257
2013-11-28 16:18:40 +01:00
Sebastian Rasmussen
08160e0913 rtsp-*: Refer to NULL as a constant in comments
Plus one typo fix.

https://bugzilla.gnome.org/show_bug.cgi?id=714988
2013-11-22 09:13:14 +00:00
Tim-Philipp Müller
33c4bdfa01 rtsp-server: sprinkle some allow-none annotations for g-i 2013-11-18 10:47:04 +00:00
Wim Taymans
b0f609ce7f rtsp: allow NULL func in filters
Passing a null function make the filters return a list of
refcounted objects.
2013-11-15 16:35:05 +01:00
Patricia Muscalu
adc02db975 client: allow absolute path in requests
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=711689
2013-11-12 12:21:50 +01:00
Patricia Muscalu
8ce453d97d client: make make_path_from_uri a vmethod 2013-11-12 12:08:06 +01:00
Wim Taymans
d4b8a8249c client: append query string in PAUSE/PLAY/TEARDOWN as well 2013-10-04 06:29:30 +02:00
Jonas Holmberg
1742399e23 client: Add query to control path
If the SETUP url contains a query it must be appended to the control
path so that it matches any already created stream in the media. The
query will also be appended to the session media path.
2013-10-04 06:14:32 +02:00
Jonas Holmberg
0cd24e2257 client: Reply 400 if media cannot be constructed
Reply 400 Bad Request instead of 503 Service Unavailable if media
cannot be constructed in SETUP.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=708821
2013-09-26 14:32:43 +02:00
Jonas Holmberg
74b8da9396 client: Send setup reply once only
If find_media() failed in handle_setup_request() two replies was sent.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=708819
2013-09-26 14:25:36 +02:00
Jonas Holmberg
e88b71aee4 client: Do not read beyond end of path string
If the setup was done without a control url, make sure we don't try to read the
non-existing control string and crash.
2013-09-19 15:44:26 +02:00
Wim Taymans
b41422bad7 client: Fix RTPInfo header
Refactor the method to make the content_base.
Use the content-base and the control url to construct the RTPInfo
url.
2013-09-17 14:39:44 +02:00
Wim Taymans
4d6c038fc7 client: map url to path only in describe
Only map the request url to a path in the DESCRIBE method. The SDP then
contains the base and control urls that should be used to SETUP/PAUSE/
PLAY/TEARDOWN the media.
2013-09-17 12:21:02 +02:00
Wim Taymans
fe3f63de7c Revert "client: map URL to path in requests"
This reverts commit e3fded2cec.

This is not correct, we only remap the URL to a path in DESCRIBE, the SDP then
contains the base and control urls which are used in the SETUP, PLAY,
PAUSE and TEARDOWN requests.
2013-09-17 11:41:57 +02:00
Wim Taymans
e3fded2cec client: map URL to path in requests 2013-09-16 17:17:35 +02:00
Wim Taymans
952aa309dc mount-points: make vmethod to make path from uri
Make a vmethod to transform an url into a path. The path is then used to lookup
the factory. This makes it possible to also use other bits of the url, such as
the query parameters, to locate the factory.
2013-09-16 17:17:34 +02:00
Jonas Holmberg
23b3f21595 client: free threadpool
https://bugzilla.gnome.org/show_bug.cgi?id=707638
2013-09-06 20:44:10 +01:00
Patricia Muscalu
ff10d24130 rtsp-client: remove query part from content-base string
Make sure that after the control url has been resolved, it's
not a part of the query-string.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=706568
2013-08-23 12:23:06 +02:00
Wim Taymans
1287b5f772 client: don't check url in response
There is no url or method in the response to check
2013-08-23 10:38:43 +02:00
Youness Alaoui
1f84618725 Add handle-response signal for when we receive a GET_PARAMETER response 2013-08-23 10:32:33 +02:00
Wim Taymans
1a838d6179 client: use protocols supported by stream 2013-08-16 16:20:00 +02:00
Wim Taymans
f124d11298 server: add method to iterate clients of server 2013-08-02 17:19:42 +02:00
Youness Alaoui
7618800088 Do not take range header if range is invalid 2013-08-02 16:58:20 +02:00
Wim Taymans
f78a65379c ClientState -> Context
Rename the clientstate to context and put the code in a separate file.
2013-07-22 14:25:04 +02:00
Wim Taymans
38d91a2bf8 client: support pushed context in handle_request
If we already have a pushed state, reuse it and add our own things. This makes
it easier to write tests.
2013-07-15 11:57:49 +02:00
Wim Taymans
9fe107a96a auth: let the auth module check client_settings
Let the auth module decide if client settings are allowed for the
current client.
2013-07-12 17:07:53 +02:00
Wim Taymans
5cf75e64af auth: handle unauthorized response
Move handling of the unauthorized response to the auth module, it can add
the appropriate headers to request authorization for the required method
much better than the client.
2013-07-12 15:19:29 +02:00
Wim Taymans
7532de687a client: allow for sending any message, not only requests
Change the _send_request() method to _send_message() so that we
can both send requests and replies.
2013-07-12 15:13:48 +02:00
Wim Taymans
a1e96c2269 client: add state push/pop 2013-07-12 12:38:54 +02:00
Wim Taymans
e1628a0515 client: add connection to state 2013-07-12 12:37:25 +02:00
Wim Taymans
0b3644a21b docs: improve docs 2013-07-11 16:57:14 +02:00
Wim Taymans
4e9c4d8bb7 client: pass thread from pool to media _prepare
Get a thread from the configured threadpool and pass it to the prepare method of
the media.
2013-07-10 17:09:27 +02:00
Wim Taymans
00997d956f client: add method to configure thread pool 2013-07-10 17:06:36 +02:00
Wim Taymans
d7dec33328 auth: simplify auth checks
Remove client from methods, it's now in the state
Perform the check specified by the string, use the information from the
thread local context.
2013-07-09 16:04:35 +02:00
Wim Taymans
c9d6455ad3 client: add state to current thread
Add the client to the ClientState object.
Place the ClientState on the current thread.
2013-07-09 16:01:29 +02:00
Wim Taymans
a63f4a2a4c auth: add auth checks
Add an enum with auth checks and implement the checks in the auth object.
Perform the checks from the client.
2013-07-08 16:29:01 +02:00
Wim Taymans
12583e819c media: add optional context for bus messages
Add an optional mainloop to _prepare that will handle the bus messages instead
of always using the shared mainloop.
2013-07-08 11:10:20 +02:00
Wim Taymans
19cffc7999 auth: remove auth from media and factory
Remove the auth object from media and factory. We want to have the RTSPClient
authenticate and authorize resources, there is no need to place another auth
manager on the media/factory.
2013-07-05 20:53:19 +02:00
Wim Taymans
a1e5bde58d client: error out on non-aggregate control
We require aggregate control (for now) for PLAY, PAUSE and TEARDOWN.
2013-07-03 16:15:04 +02:00
Wim Taymans
9182263532 client: rework setup request a little
Cache the media in DESCRIBE based on the longest matching path with the uri
that we can find in the mount points.

Rework the setup request a little to get the media from the session or from
the longest matching path, this way we can derive the control string as
everything after the path instead of hardcoding it.

Find the stream based on the control string and only open a session when all
this can be done.
2013-07-03 15:55:38 +02:00
Wim Taymans
5a833f503e session: use path matching for session media
Use a path string instead of a uri to lookup session media in the sessions. Also
use path matching to find the largest possible path that matches.
2013-07-03 12:37:48 +02:00
Wim Taymans
8f79daef5e mount-points: remove useless vmethod
Making lookups in the mount points should not be done with a URL, if there is a
mapping to be done from URL to mount points, we'll need to do it somewhere
else.
2013-07-03 11:10:27 +02:00
Wim Taymans
0248775c74 client: cleanups
Rename variables for clarity
Keep media in state when we can
2013-07-02 11:58:02 +02:00
Wim Taymans
a7fe63298c stream: add more support for IPv6
Rename _get_address to _get_multicast_address in GstRTSPStream to
make it clear that this function only deals with multicast.
Make it possible to have both an IPv4 and IPv6 multicast address on
a stream. Give the client an IPv4 or IPv6 address depending on the
address it used to connect to the server.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=702002
2013-07-01 16:46:39 +02:00
Wim Taymans
13016309b1 client: fix comment 2013-07-01 15:18:43 +02:00