rtsp-client: expose uri
[platform/upstream/gstreamer.git] / tests / check / gst / client.c
1 /* GStreamer
2  * Copyright (C) 2012 Wim Taymans <wim.taymans@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #include <gst/check/gstcheck.h>
21
22 #include <rtsp-client.h>
23
24 static gint cseq;
25
26 static gboolean
27 test_response_200 (GstRTSPClient * client, GstRTSPMessage * response,
28     gboolean close, gpointer user_data)
29 {
30   GstRTSPStatusCode code;
31   const gchar *reason;
32   GstRTSPVersion version;
33
34   fail_unless (gst_rtsp_message_get_type (response) ==
35       GST_RTSP_MESSAGE_RESPONSE);
36
37   fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
38           &version)
39       == GST_RTSP_OK);
40   fail_unless (code == GST_RTSP_STS_OK);
41   fail_unless (g_str_equal (reason, "OK"));
42   fail_unless (version == GST_RTSP_VERSION_1_0);
43
44   return TRUE;
45 }
46
47 static gboolean
48 test_response_400 (GstRTSPClient * client, GstRTSPMessage * response,
49     gboolean close, gpointer user_data)
50 {
51   GstRTSPStatusCode code;
52   const gchar *reason;
53   GstRTSPVersion version;
54
55   fail_unless (gst_rtsp_message_get_type (response) ==
56       GST_RTSP_MESSAGE_RESPONSE);
57
58   fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
59           &version)
60       == GST_RTSP_OK);
61   fail_unless (code == GST_RTSP_STS_BAD_REQUEST);
62   fail_unless (g_str_equal (reason, "Bad Request"));
63   fail_unless (version == GST_RTSP_VERSION_1_0);
64
65   return TRUE;
66 }
67
68 static gboolean
69 test_response_404 (GstRTSPClient * client, GstRTSPMessage * response,
70     gboolean close, gpointer user_data)
71 {
72   GstRTSPStatusCode code;
73   const gchar *reason;
74   GstRTSPVersion version;
75
76   fail_unless (gst_rtsp_message_get_type (response) ==
77       GST_RTSP_MESSAGE_RESPONSE);
78
79   fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
80           &version)
81       == GST_RTSP_OK);
82   fail_unless (code == GST_RTSP_STS_NOT_FOUND);
83   fail_unless (g_str_equal (reason, "Not Found"));
84   fail_unless (version == GST_RTSP_VERSION_1_0);
85
86   return TRUE;
87 }
88
89 static gboolean
90 test_response_454 (GstRTSPClient * client, GstRTSPMessage * response,
91     gboolean close, gpointer user_data)
92 {
93   GstRTSPStatusCode code;
94   const gchar *reason;
95   GstRTSPVersion version;
96
97   fail_unless (gst_rtsp_message_get_type (response) ==
98       GST_RTSP_MESSAGE_RESPONSE);
99
100   fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
101           &version)
102       == GST_RTSP_OK);
103   fail_unless (code == GST_RTSP_STS_SESSION_NOT_FOUND);
104   fail_unless (g_str_equal (reason, "Session Not Found"));
105   fail_unless (version == GST_RTSP_VERSION_1_0);
106
107   return TRUE;
108 }
109
110 static GstRTSPClient *
111 setup_client (void)
112 {
113   GstRTSPClient *client;
114   GstRTSPSessionPool *session_pool;
115   GstRTSPMountPoints *mount_points;
116   GstRTSPMediaFactory *factory;
117
118   client = gst_rtsp_client_new ();
119
120   session_pool = gst_rtsp_session_pool_new ();
121   gst_rtsp_client_set_session_pool (client, session_pool);
122
123   mount_points = gst_rtsp_mount_points_new ();
124   factory = gst_rtsp_media_factory_new ();
125   gst_rtsp_media_factory_set_launch (factory,
126       "videotestsrc ! video/x-raw,width=352,height=288 ! rtpgstpay name=pay0 pt=96");
127   gst_rtsp_mount_points_add_factory (mount_points, "/test", factory);
128   gst_rtsp_client_set_mount_points (client, mount_points);
129
130   g_object_unref (mount_points);
131   g_object_unref (session_pool);
132
133   return client;
134 }
135
136 GST_START_TEST (test_request)
137 {
138   GstRTSPClient *client;
139   GstRTSPMessage request = { 0, };
140   gchar *str;
141
142   client = gst_rtsp_client_new ();
143
144   /* OPTIONS with invalid url */
145   fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_OPTIONS,
146           "foopy://padoop/") == GST_RTSP_OK);
147   str = g_strdup_printf ("%d", cseq);
148   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CSEQ, str);
149   g_free (str);
150
151   gst_rtsp_client_set_send_func (client, test_response_400, NULL, NULL);
152   fail_unless (gst_rtsp_client_handle_message (client,
153           &request) == GST_RTSP_OK);
154
155   gst_rtsp_message_unset (&request);
156
157   /* OPTIONS with unknown session id */
158   fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_OPTIONS,
159           "rtsp://localhost/test") == GST_RTSP_OK);
160   str = g_strdup_printf ("%d", cseq);
161   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CSEQ, str);
162   g_free (str);
163   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_SESSION, "foobar");
164
165   gst_rtsp_client_set_send_func (client, test_response_454, NULL, NULL);
166   fail_unless (gst_rtsp_client_handle_message (client,
167           &request) == GST_RTSP_OK);
168
169   gst_rtsp_message_unset (&request);
170
171   g_object_unref (client);
172 }
173
174 GST_END_TEST;
175
176 static gboolean
177 test_option_response_200 (GstRTSPClient * client, GstRTSPMessage * response,
178     gboolean close, gpointer user_data)
179 {
180   GstRTSPStatusCode code;
181   const gchar *reason;
182   GstRTSPVersion version;
183   gchar *str;
184   GstRTSPMethod methods;
185
186   fail_unless (gst_rtsp_message_get_type (response) ==
187       GST_RTSP_MESSAGE_RESPONSE);
188
189   fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
190           &version)
191       == GST_RTSP_OK);
192   fail_unless (code == GST_RTSP_STS_OK);
193   fail_unless (g_str_equal (reason, "OK"));
194   fail_unless (version == GST_RTSP_VERSION_1_0);
195
196   fail_unless (gst_rtsp_message_get_header (response, GST_RTSP_HDR_CSEQ, &str,
197           0) == GST_RTSP_OK);
198   fail_unless (atoi (str) == cseq++);
199
200   fail_unless (gst_rtsp_message_get_header (response, GST_RTSP_HDR_PUBLIC, &str,
201           0) == GST_RTSP_OK);
202
203   methods = gst_rtsp_options_from_text (str);
204   fail_if (methods == 0);
205   fail_unless (methods == (GST_RTSP_DESCRIBE |
206           GST_RTSP_OPTIONS |
207           GST_RTSP_PAUSE |
208           GST_RTSP_PLAY |
209           GST_RTSP_SETUP |
210           GST_RTSP_GET_PARAMETER | GST_RTSP_SET_PARAMETER | GST_RTSP_TEARDOWN));
211
212   return TRUE;
213 }
214
215 GST_START_TEST (test_options)
216 {
217   GstRTSPClient *client;
218   GstRTSPMessage request = { 0, };
219   gchar *str;
220
221   client = gst_rtsp_client_new ();
222
223   /* simple OPTIONS */
224   fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_OPTIONS,
225           "rtsp://localhost/test") == GST_RTSP_OK);
226   str = g_strdup_printf ("%d", cseq);
227   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CSEQ, str);
228   g_free (str);
229
230   gst_rtsp_client_set_send_func (client, test_option_response_200, NULL, NULL);
231   fail_unless (gst_rtsp_client_handle_message (client,
232           &request) == GST_RTSP_OK);
233   gst_rtsp_message_unset (&request);
234
235   g_object_unref (client);
236 }
237
238 GST_END_TEST;
239
240 GST_START_TEST (test_describe)
241 {
242   GstRTSPClient *client;
243   GstRTSPMessage request = { 0, };
244   gchar *str;
245   GstRTSPUrl *uri_client;
246   gchar *uri_str;
247
248   client = gst_rtsp_client_new ();
249
250   /* simple DESCRIBE for non-existing url */
251   fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_DESCRIBE,
252           "rtsp://localhost/test") == GST_RTSP_OK);
253   str = g_strdup_printf ("%d", cseq);
254   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CSEQ, str);
255   g_free (str);
256
257   gst_rtsp_client_set_send_func (client, test_response_404, NULL, NULL);
258   fail_unless (gst_rtsp_client_handle_message (client,
259           &request) == GST_RTSP_OK);
260   gst_rtsp_message_unset (&request);
261
262   uri_client = gst_rtsp_client_get_uri (client);
263   fail_unless (uri_client == NULL);
264   gst_rtsp_url_free (uri_client);
265
266
267   g_object_unref (client);
268
269   /* simple DESCRIBE for an existing url */
270   client = setup_client ();
271   fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_DESCRIBE,
272             "rtsp://localhost/test") == GST_RTSP_OK);
273   str = g_strdup_printf ("%d", cseq);
274   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CSEQ, str);
275   g_free (str);
276
277   gst_rtsp_client_set_send_func (client, test_response_200, NULL, NULL);
278   fail_unless (gst_rtsp_client_handle_message (client,
279           &request) == GST_RTSP_OK);
280   gst_rtsp_message_unset (&request);
281
282   uri_client = gst_rtsp_client_get_uri (client);
283   fail_unless (uri_client != NULL);
284   uri_str = gst_rtsp_url_get_request_uri (uri_client);
285   gst_rtsp_url_free (uri_client);
286   fail_unless (g_strcmp0 (uri_str, "rtsp://localhost/test") == 0);
287   g_free (uri_str);
288
289   g_object_unref (client);
290 }
291
292 GST_END_TEST;
293
294 gchar *expected_transport = NULL;;
295
296 static gboolean
297 test_setup_response_200_multicast (GstRTSPClient * client,
298     GstRTSPMessage * response, gboolean close, gpointer user_data)
299 {
300   GstRTSPStatusCode code;
301   const gchar *reason;
302   GstRTSPVersion version;
303   gchar *str;
304   GstRTSPSessionPool *session_pool;
305   GstRTSPSession *session;
306
307   fail_unless (expected_transport != NULL);
308
309   fail_unless (gst_rtsp_message_get_type (response) ==
310       GST_RTSP_MESSAGE_RESPONSE);
311
312   fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
313           &version)
314       == GST_RTSP_OK);
315   fail_unless (code == GST_RTSP_STS_OK);
316   fail_unless (g_str_equal (reason, "OK"));
317   fail_unless (version == GST_RTSP_VERSION_1_0);
318
319   fail_unless (gst_rtsp_message_get_header (response, GST_RTSP_HDR_CSEQ, &str,
320           0) == GST_RTSP_OK);
321   fail_unless (atoi (str) == cseq++);
322
323   fail_unless (gst_rtsp_message_get_header (response, GST_RTSP_HDR_TRANSPORT,
324           &str, 0) == GST_RTSP_OK);
325
326   fail_unless (!strcmp (str, expected_transport));
327
328   fail_unless (gst_rtsp_message_get_header (response, GST_RTSP_HDR_SESSION,
329           &str, 0) == GST_RTSP_OK);
330
331   session_pool = gst_rtsp_client_get_session_pool (client);
332   fail_unless (session_pool != NULL);
333
334   fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 1);
335   session = gst_rtsp_session_pool_find (session_pool, str);
336   fail_unless (session != NULL);
337   g_object_unref (session);
338
339   g_object_unref (session_pool);
340
341
342   return TRUE;
343 }
344
345 static GstRTSPClient *
346 setup_multicast_client (void)
347 {
348   GstRTSPClient *client;
349   GstRTSPSessionPool *session_pool;
350   GstRTSPMountPoints *mount_points;
351   GstRTSPMediaFactory *factory;
352   GstRTSPAddressPool *address_pool;
353
354   client = gst_rtsp_client_new ();
355
356   session_pool = gst_rtsp_session_pool_new ();
357   gst_rtsp_client_set_session_pool (client, session_pool);
358
359   mount_points = gst_rtsp_mount_points_new ();
360   factory = gst_rtsp_media_factory_new ();
361   gst_rtsp_media_factory_set_launch (factory,
362       "audiotestsrc ! audio/x-raw,rate=44100 ! audioconvert ! rtpL16pay name=pay0");
363   address_pool = gst_rtsp_address_pool_new ();
364   fail_unless (gst_rtsp_address_pool_add_range (address_pool,
365           "233.252.0.1", "233.252.0.1", 5000, 5010, 1));
366   gst_rtsp_media_factory_set_address_pool (factory, address_pool);
367   gst_rtsp_mount_points_add_factory (mount_points, "/test", factory);
368   gst_rtsp_client_set_mount_points (client, mount_points);
369
370   g_object_unref (mount_points);
371   g_object_unref (session_pool);
372   g_object_unref (address_pool);
373
374   return client;
375 }
376
377 GST_START_TEST (test_client_multicast_transport_404)
378 {
379   GstRTSPClient *client;
380   GstRTSPMessage request = { 0, };
381   gchar *str;
382
383   client = setup_multicast_client ();
384
385   /* simple SETUP for non-existing url */
386   fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
387           "rtsp://localhost/test2/stream=0") == GST_RTSP_OK);
388   str = g_strdup_printf ("%d", cseq);
389   gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
390   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
391       "RTP/AVP;multicast");
392
393   gst_rtsp_client_set_send_func (client, test_response_404, NULL, NULL);
394   fail_unless (gst_rtsp_client_handle_message (client,
395           &request) == GST_RTSP_OK);
396   gst_rtsp_message_unset (&request);
397
398   g_object_unref (client);
399 }
400
401 GST_END_TEST;
402
403 GST_START_TEST (test_client_multicast_transport)
404 {
405   GstRTSPClient *client;
406   GstRTSPMessage request = { 0, };
407   gchar *str;
408
409   client = setup_multicast_client ();
410
411   /* simple SETUP with a valid URI and multicast */
412   fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
413           "rtsp://localhost/test/stream=0") == GST_RTSP_OK);
414   str = g_strdup_printf ("%d", cseq);
415   gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
416   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
417       "RTP/AVP;multicast");
418
419   expected_transport = "RTP/AVP;multicast;destination=233.252.0.1;"
420       "ttl=1;port=5000-5001;mode=\"PLAY\"";
421   gst_rtsp_client_set_send_func (client, test_setup_response_200_multicast,
422       NULL, NULL);
423   fail_unless (gst_rtsp_client_handle_message (client,
424           &request) == GST_RTSP_OK);
425   gst_rtsp_message_unset (&request);
426   expected_transport = NULL;
427
428   g_object_unref (client);
429 }
430
431 GST_END_TEST;
432
433 GST_START_TEST (test_client_multicast_ignore_transport_specific)
434 {
435   GstRTSPClient *client;
436   GstRTSPMessage request = { 0, };
437   gchar *str;
438
439   client = setup_multicast_client ();
440
441   /* simple SETUP with a valid URI and multicast and a specific dest,
442    * but ignore it  */
443   fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
444           "rtsp://localhost/test/stream=0") == GST_RTSP_OK);
445   str = g_strdup_printf ("%d", cseq);
446   gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
447   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
448       "RTP/AVP;multicast;destination=233.252.0.2;ttl=2;port=5001-5006;");
449
450   expected_transport = "RTP/AVP;multicast;destination=233.252.0.1;"
451       "ttl=1;port=5000-5001;mode=\"PLAY\"";
452   gst_rtsp_client_set_send_func (client, test_setup_response_200_multicast,
453       NULL, NULL);
454   fail_unless (gst_rtsp_client_handle_message (client,
455           &request) == GST_RTSP_OK);
456   gst_rtsp_message_unset (&request);
457   expected_transport = NULL;
458
459   g_object_unref (client);
460 }
461
462 GST_END_TEST;
463
464 static gboolean
465 test_setup_response_461 (GstRTSPClient * client,
466     GstRTSPMessage * response, gboolean close, gpointer user_data)
467 {
468   GstRTSPStatusCode code;
469   const gchar *reason;
470   GstRTSPVersion version;
471   gchar *str;
472
473   fail_unless (expected_transport == NULL);
474
475   fail_unless (gst_rtsp_message_get_type (response) ==
476       GST_RTSP_MESSAGE_RESPONSE);
477
478   fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
479           &version)
480       == GST_RTSP_OK);
481   fail_unless (code == GST_RTSP_STS_UNSUPPORTED_TRANSPORT);
482   fail_unless (g_str_equal (reason, "Unsupported transport"));
483   fail_unless (version == GST_RTSP_VERSION_1_0);
484
485   fail_unless (gst_rtsp_message_get_header (response, GST_RTSP_HDR_CSEQ, &str,
486           0) == GST_RTSP_OK);
487   fail_unless (atoi (str) == cseq++);
488
489
490   return TRUE;
491 }
492
493 GST_START_TEST (test_client_multicast_invalid_transport_specific)
494 {
495   GstRTSPClient *client;
496   GstRTSPMessage request = { 0, };
497   gchar *str;
498   GstRTSPSessionPool *session_pool;
499
500   client = setup_multicast_client ();
501
502   gst_rtsp_client_set_use_client_settings (client, TRUE);
503   fail_unless (gst_rtsp_client_get_use_client_settings (client));
504
505
506   /* simple SETUP with a valid URI and multicast, but an invalid ip */
507   fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
508           "rtsp://localhost/test/stream=0") == GST_RTSP_OK);
509   str = g_strdup_printf ("%d", cseq);
510   gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
511   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
512       "RTP/AVP;multicast;destination=233.252.0.2;ttl=1;port=5000-5001;");
513
514   gst_rtsp_client_set_send_func (client, test_setup_response_461, NULL, NULL);
515   fail_unless (gst_rtsp_client_handle_message (client,
516           &request) == GST_RTSP_OK);
517   gst_rtsp_message_unset (&request);
518
519   session_pool = gst_rtsp_client_get_session_pool (client);
520   fail_unless (session_pool != NULL);
521   /* FIXME: There seems to be a leak of a session here ! */
522   /* fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0); */
523   g_object_unref (session_pool);
524
525
526
527   /* simple SETUP with a valid URI and multicast, but an invalid prt */
528   fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
529           "rtsp://localhost/test/stream=0") == GST_RTSP_OK);
530   str = g_strdup_printf ("%d", cseq);
531   gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
532   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
533       "RTP/AVP;multicast;destination=233.252.0.1;ttl=1;port=6000-6001;");
534
535   gst_rtsp_client_set_send_func (client, test_setup_response_461, NULL, NULL);
536   fail_unless (gst_rtsp_client_handle_message (client,
537           &request) == GST_RTSP_OK);
538   gst_rtsp_message_unset (&request);
539
540   session_pool = gst_rtsp_client_get_session_pool (client);
541   fail_unless (session_pool != NULL);
542   /* FIXME: There seems to be a leak of a session here ! */
543   /* fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0); */
544   g_object_unref (session_pool);
545
546
547
548   /* simple SETUP with a valid URI and multicast, but an invalid ttl */
549   fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
550           "rtsp://localhost/test/stream=0") == GST_RTSP_OK);
551   str = g_strdup_printf ("%d", cseq);
552   gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
553   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
554       "RTP/AVP;multicast;destination=233.252.0.1;ttl=2;port=5000-5001;");
555
556   gst_rtsp_client_set_send_func (client, test_setup_response_461, NULL, NULL);
557   fail_unless (gst_rtsp_client_handle_message (client,
558           &request) == GST_RTSP_OK);
559   gst_rtsp_message_unset (&request);
560
561   session_pool = gst_rtsp_client_get_session_pool (client);
562   fail_unless (session_pool != NULL);
563   /* FIXME: There seems to be a leak of a session here ! */
564   /* fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0); */
565   g_object_unref (session_pool);
566
567
568   g_object_unref (client);
569 }
570
571 GST_END_TEST;
572
573 GST_START_TEST (test_client_multicast_transport_specific)
574 {
575   GstRTSPClient *client;
576   GstRTSPMessage request = { 0, };
577   gchar *str;
578   GstRTSPSessionPool *session_pool;
579
580   client = setup_multicast_client ();
581
582   gst_rtsp_client_set_use_client_settings (client, TRUE);
583   fail_unless (gst_rtsp_client_get_use_client_settings (client));
584
585   expected_transport = "RTP/AVP;multicast;destination=233.252.0.1;"
586       "ttl=1;port=5000-5001;mode=\"PLAY\"";
587
588   /* simple SETUP with a valid URI and multicast, but an invalid ip */
589   fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
590           "rtsp://localhost/test/stream=0") == GST_RTSP_OK);
591   str = g_strdup_printf ("%d", cseq);
592   gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
593   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
594       expected_transport);
595
596   gst_rtsp_client_set_send_func (client, test_setup_response_200_multicast,
597       NULL, NULL);
598   fail_unless (gst_rtsp_client_handle_message (client,
599           &request) == GST_RTSP_OK);
600   gst_rtsp_message_unset (&request);
601   expected_transport = NULL;
602
603   gst_rtsp_client_set_send_func (client, test_setup_response_200_multicast,
604       NULL, NULL);
605   session_pool = gst_rtsp_client_get_session_pool (client);
606   fail_unless (session_pool != NULL);
607   fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 1);
608   g_object_unref (session_pool);
609
610   g_object_unref (client);
611 }
612
613 GST_END_TEST;
614
615
616 static Suite *
617 rtspclient_suite (void)
618 {
619   Suite *s = suite_create ("rtspclient");
620   TCase *tc = tcase_create ("general");
621
622   suite_add_tcase (s, tc);
623   tcase_set_timeout (tc, 20);
624   tcase_add_test (tc, test_request);
625   tcase_add_test (tc, test_options);
626   tcase_add_test (tc, test_describe);
627   tcase_add_test (tc, test_client_multicast_transport_404);
628   tcase_add_test (tc, test_client_multicast_transport);
629   tcase_add_test (tc, test_client_multicast_ignore_transport_specific);
630   tcase_add_test (tc, test_client_multicast_invalid_transport_specific);
631   tcase_add_test (tc, test_client_multicast_transport_specific);
632
633   return s;
634 }
635
636 GST_CHECK_MAIN (rtspclient);