2 * Copyright (C) 2012 Wim Taymans <wim.taymans@gmail.com>
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.
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.
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.
20 #include <gst/check/gstcheck.h>
22 #include <rtsp-client.h>
27 test_response_200 (GstRTSPClient * client, GstRTSPMessage * response,
28 gboolean close, gpointer user_data)
30 GstRTSPStatusCode code;
32 GstRTSPVersion version;
34 fail_unless (gst_rtsp_message_get_type (response) ==
35 GST_RTSP_MESSAGE_RESPONSE);
37 fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
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);
48 test_response_400 (GstRTSPClient * client, GstRTSPMessage * response,
49 gboolean close, gpointer user_data)
51 GstRTSPStatusCode code;
53 GstRTSPVersion version;
55 fail_unless (gst_rtsp_message_get_type (response) ==
56 GST_RTSP_MESSAGE_RESPONSE);
58 fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
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);
69 test_response_404 (GstRTSPClient * client, GstRTSPMessage * response,
70 gboolean close, gpointer user_data)
72 GstRTSPStatusCode code;
74 GstRTSPVersion version;
76 fail_unless (gst_rtsp_message_get_type (response) ==
77 GST_RTSP_MESSAGE_RESPONSE);
79 fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
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);
90 test_response_454 (GstRTSPClient * client, GstRTSPMessage * response,
91 gboolean close, gpointer user_data)
93 GstRTSPStatusCode code;
95 GstRTSPVersion version;
97 fail_unless (gst_rtsp_message_get_type (response) ==
98 GST_RTSP_MESSAGE_RESPONSE);
100 fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
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);
110 static GstRTSPClient *
111 setup_client (const gchar * launch_line)
113 GstRTSPClient *client;
114 GstRTSPSessionPool *session_pool;
115 GstRTSPMountPoints *mount_points;
116 GstRTSPMediaFactory *factory;
118 client = gst_rtsp_client_new ();
120 session_pool = gst_rtsp_session_pool_new ();
121 gst_rtsp_client_set_session_pool (client, session_pool);
123 mount_points = gst_rtsp_mount_points_new ();
124 factory = gst_rtsp_media_factory_new ();
125 if (launch_line == NULL)
126 gst_rtsp_media_factory_set_launch (factory,
127 "videotestsrc ! video/x-raw,width=352,height=288 ! rtpgstpay name=pay0 pt=96");
129 gst_rtsp_media_factory_set_launch (factory, launch_line);
131 gst_rtsp_mount_points_add_factory (mount_points, "/test", factory);
132 gst_rtsp_client_set_mount_points (client, mount_points);
134 g_object_unref (mount_points);
135 g_object_unref (session_pool);
140 GST_START_TEST (test_request)
142 GstRTSPClient *client;
143 GstRTSPMessage request = { 0, };
146 client = gst_rtsp_client_new ();
148 /* OPTIONS with invalid url */
149 fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_OPTIONS,
150 "foopy://padoop/") == GST_RTSP_OK);
151 str = g_strdup_printf ("%d", cseq);
152 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CSEQ, str);
155 gst_rtsp_client_set_send_func (client, test_response_400, NULL, NULL);
156 fail_unless (gst_rtsp_client_handle_message (client,
157 &request) == GST_RTSP_OK);
159 gst_rtsp_message_unset (&request);
161 /* OPTIONS with unknown session id */
162 fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_OPTIONS,
163 "rtsp://localhost/test") == GST_RTSP_OK);
164 str = g_strdup_printf ("%d", cseq);
165 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CSEQ, str);
167 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_SESSION, "foobar");
169 gst_rtsp_client_set_send_func (client, test_response_454, NULL, NULL);
170 fail_unless (gst_rtsp_client_handle_message (client,
171 &request) == GST_RTSP_OK);
173 gst_rtsp_message_unset (&request);
175 g_object_unref (client);
181 test_option_response_200 (GstRTSPClient * client, GstRTSPMessage * response,
182 gboolean close, gpointer user_data)
184 GstRTSPStatusCode code;
186 GstRTSPVersion version;
188 GstRTSPMethod methods;
190 fail_unless (gst_rtsp_message_get_type (response) ==
191 GST_RTSP_MESSAGE_RESPONSE);
193 fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
196 fail_unless (code == GST_RTSP_STS_OK);
197 fail_unless (g_str_equal (reason, "OK"));
198 fail_unless (version == GST_RTSP_VERSION_1_0);
200 fail_unless (gst_rtsp_message_get_header (response, GST_RTSP_HDR_CSEQ, &str,
202 fail_unless (atoi (str) == cseq++);
204 fail_unless (gst_rtsp_message_get_header (response, GST_RTSP_HDR_PUBLIC, &str,
207 methods = gst_rtsp_options_from_text (str);
208 fail_if (methods == 0);
209 fail_unless (methods == (GST_RTSP_DESCRIBE |
214 GST_RTSP_GET_PARAMETER | GST_RTSP_SET_PARAMETER | GST_RTSP_TEARDOWN));
219 GST_START_TEST (test_options)
221 GstRTSPClient *client;
222 GstRTSPMessage request = { 0, };
225 client = gst_rtsp_client_new ();
228 fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_OPTIONS,
229 "rtsp://localhost/test") == GST_RTSP_OK);
230 str = g_strdup_printf ("%d", cseq);
231 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CSEQ, str);
234 gst_rtsp_client_set_send_func (client, test_option_response_200, NULL, NULL);
235 fail_unless (gst_rtsp_client_handle_message (client,
236 &request) == GST_RTSP_OK);
237 gst_rtsp_message_unset (&request);
239 g_object_unref (client);
244 GST_START_TEST (test_describe)
246 GstRTSPClient *client;
247 GstRTSPMessage request = { 0, };
249 GstRTSPUrl *uri_client;
252 client = gst_rtsp_client_new ();
254 /* simple DESCRIBE for non-existing url */
255 fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_DESCRIBE,
256 "rtsp://localhost/test") == GST_RTSP_OK);
257 str = g_strdup_printf ("%d", cseq);
258 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CSEQ, str);
261 gst_rtsp_client_set_send_func (client, test_response_404, NULL, NULL);
262 fail_unless (gst_rtsp_client_handle_message (client,
263 &request) == GST_RTSP_OK);
264 gst_rtsp_message_unset (&request);
266 uri_client = gst_rtsp_client_get_uri (client);
267 fail_unless (uri_client == NULL);
268 gst_rtsp_url_free (uri_client);
271 g_object_unref (client);
273 /* simple DESCRIBE for an existing url */
274 client = setup_client (NULL);
275 fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_DESCRIBE,
276 "rtsp://localhost/test") == GST_RTSP_OK);
277 str = g_strdup_printf ("%d", cseq);
278 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CSEQ, str);
281 gst_rtsp_client_set_send_func (client, test_response_200, NULL, NULL);
282 fail_unless (gst_rtsp_client_handle_message (client,
283 &request) == GST_RTSP_OK);
284 gst_rtsp_message_unset (&request);
286 uri_client = gst_rtsp_client_get_uri (client);
287 fail_unless (uri_client != NULL);
288 uri_str = gst_rtsp_url_get_request_uri (uri_client);
289 gst_rtsp_url_free (uri_client);
290 fail_unless (g_strcmp0 (uri_str, "rtsp://localhost/test") == 0);
293 g_object_unref (client);
298 gchar *expected_transport = NULL;;
301 test_setup_response_200_multicast (GstRTSPClient * client,
302 GstRTSPMessage * response, gboolean close, gpointer user_data)
304 GstRTSPStatusCode code;
306 GstRTSPVersion version;
308 GstRTSPSessionPool *session_pool;
309 GstRTSPSession *session;
311 fail_unless (expected_transport != NULL);
313 fail_unless (gst_rtsp_message_get_type (response) ==
314 GST_RTSP_MESSAGE_RESPONSE);
316 fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
319 fail_unless (code == GST_RTSP_STS_OK);
320 fail_unless (g_str_equal (reason, "OK"));
321 fail_unless (version == GST_RTSP_VERSION_1_0);
323 fail_unless (gst_rtsp_message_get_header (response, GST_RTSP_HDR_CSEQ, &str,
325 fail_unless (atoi (str) == cseq++);
327 fail_unless (gst_rtsp_message_get_header (response, GST_RTSP_HDR_TRANSPORT,
328 &str, 0) == GST_RTSP_OK);
330 fail_unless (!strcmp (str, expected_transport));
332 fail_unless (gst_rtsp_message_get_header (response, GST_RTSP_HDR_SESSION,
333 &str, 0) == GST_RTSP_OK);
335 session_pool = gst_rtsp_client_get_session_pool (client);
336 fail_unless (session_pool != NULL);
338 fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 1);
339 session = gst_rtsp_session_pool_find (session_pool, str);
340 fail_unless (session != NULL);
341 g_object_unref (session);
343 g_object_unref (session_pool);
349 static GstRTSPClient *
350 setup_multicast_client (void)
352 GstRTSPClient *client;
353 GstRTSPSessionPool *session_pool;
354 GstRTSPMountPoints *mount_points;
355 GstRTSPMediaFactory *factory;
356 GstRTSPAddressPool *address_pool;
358 client = gst_rtsp_client_new ();
360 session_pool = gst_rtsp_session_pool_new ();
361 gst_rtsp_client_set_session_pool (client, session_pool);
363 mount_points = gst_rtsp_mount_points_new ();
364 factory = gst_rtsp_media_factory_new ();
365 gst_rtsp_media_factory_set_launch (factory,
366 "audiotestsrc ! audio/x-raw,rate=44100 ! audioconvert ! rtpL16pay name=pay0");
367 address_pool = gst_rtsp_address_pool_new ();
368 fail_unless (gst_rtsp_address_pool_add_range (address_pool,
369 "233.252.0.1", "233.252.0.1", 5000, 5010, 1));
370 gst_rtsp_media_factory_set_address_pool (factory, address_pool);
371 gst_rtsp_mount_points_add_factory (mount_points, "/test", factory);
372 gst_rtsp_client_set_mount_points (client, mount_points);
374 g_object_unref (mount_points);
375 g_object_unref (session_pool);
376 g_object_unref (address_pool);
381 GST_START_TEST (test_client_multicast_transport_404)
383 GstRTSPClient *client;
384 GstRTSPMessage request = { 0, };
387 client = setup_multicast_client ();
389 /* simple SETUP for non-existing url */
390 fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
391 "rtsp://localhost/test2/stream=0") == GST_RTSP_OK);
392 str = g_strdup_printf ("%d", cseq);
393 gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
394 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
395 "RTP/AVP;multicast");
397 gst_rtsp_client_set_send_func (client, test_response_404, NULL, NULL);
398 fail_unless (gst_rtsp_client_handle_message (client,
399 &request) == GST_RTSP_OK);
400 gst_rtsp_message_unset (&request);
402 g_object_unref (client);
407 GST_START_TEST (test_client_multicast_transport)
409 GstRTSPClient *client;
410 GstRTSPMessage request = { 0, };
413 client = setup_multicast_client ();
415 /* simple SETUP with a valid URI and multicast */
416 fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
417 "rtsp://localhost/test/stream=0") == GST_RTSP_OK);
418 str = g_strdup_printf ("%d", cseq);
419 gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
420 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
421 "RTP/AVP;multicast");
423 expected_transport = "RTP/AVP;multicast;destination=233.252.0.1;"
424 "ttl=1;port=5000-5001;mode=\"PLAY\"";
425 gst_rtsp_client_set_send_func (client, test_setup_response_200_multicast,
427 fail_unless (gst_rtsp_client_handle_message (client,
428 &request) == GST_RTSP_OK);
429 gst_rtsp_message_unset (&request);
430 expected_transport = NULL;
432 g_object_unref (client);
437 GST_START_TEST (test_client_multicast_ignore_transport_specific)
439 GstRTSPClient *client;
440 GstRTSPMessage request = { 0, };
443 client = setup_multicast_client ();
445 /* simple SETUP with a valid URI and multicast and a specific dest,
447 fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
448 "rtsp://localhost/test/stream=0") == GST_RTSP_OK);
449 str = g_strdup_printf ("%d", cseq);
450 gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
451 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
452 "RTP/AVP;multicast;destination=233.252.0.2;ttl=2;port=5001-5006;");
454 expected_transport = "RTP/AVP;multicast;destination=233.252.0.1;"
455 "ttl=1;port=5000-5001;mode=\"PLAY\"";
456 gst_rtsp_client_set_send_func (client, test_setup_response_200_multicast,
458 fail_unless (gst_rtsp_client_handle_message (client,
459 &request) == GST_RTSP_OK);
460 gst_rtsp_message_unset (&request);
461 expected_transport = NULL;
463 g_object_unref (client);
469 test_setup_response_461 (GstRTSPClient * client,
470 GstRTSPMessage * response, gboolean close, gpointer user_data)
472 GstRTSPStatusCode code;
474 GstRTSPVersion version;
477 fail_unless (expected_transport == NULL);
479 fail_unless (gst_rtsp_message_get_type (response) ==
480 GST_RTSP_MESSAGE_RESPONSE);
482 fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
485 fail_unless (code == GST_RTSP_STS_UNSUPPORTED_TRANSPORT);
486 fail_unless (g_str_equal (reason, "Unsupported transport"));
487 fail_unless (version == GST_RTSP_VERSION_1_0);
489 fail_unless (gst_rtsp_message_get_header (response, GST_RTSP_HDR_CSEQ, &str,
491 fail_unless (atoi (str) == cseq++);
497 GST_START_TEST (test_client_multicast_invalid_transport_specific)
499 GstRTSPClient *client;
500 GstRTSPMessage request = { 0, };
502 GstRTSPSessionPool *session_pool;
504 client = setup_multicast_client ();
506 gst_rtsp_client_set_use_client_settings (client, TRUE);
507 fail_unless (gst_rtsp_client_get_use_client_settings (client));
510 /* simple SETUP with a valid URI and multicast, but an invalid ip */
511 fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
512 "rtsp://localhost/test/stream=0") == GST_RTSP_OK);
513 str = g_strdup_printf ("%d", cseq);
514 gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
515 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
516 "RTP/AVP;multicast;destination=233.252.0.2;ttl=1;port=5000-5001;");
518 gst_rtsp_client_set_send_func (client, test_setup_response_461, NULL, NULL);
519 fail_unless (gst_rtsp_client_handle_message (client,
520 &request) == GST_RTSP_OK);
521 gst_rtsp_message_unset (&request);
523 session_pool = gst_rtsp_client_get_session_pool (client);
524 fail_unless (session_pool != NULL);
525 /* FIXME: There seems to be a leak of a session here ! */
526 /* fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0); */
527 g_object_unref (session_pool);
531 /* simple SETUP with a valid URI and multicast, but an invalid prt */
532 fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
533 "rtsp://localhost/test/stream=0") == GST_RTSP_OK);
534 str = g_strdup_printf ("%d", cseq);
535 gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
536 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
537 "RTP/AVP;multicast;destination=233.252.0.1;ttl=1;port=6000-6001;");
539 gst_rtsp_client_set_send_func (client, test_setup_response_461, NULL, NULL);
540 fail_unless (gst_rtsp_client_handle_message (client,
541 &request) == GST_RTSP_OK);
542 gst_rtsp_message_unset (&request);
544 session_pool = gst_rtsp_client_get_session_pool (client);
545 fail_unless (session_pool != NULL);
546 /* FIXME: There seems to be a leak of a session here ! */
547 /* fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0); */
548 g_object_unref (session_pool);
552 /* simple SETUP with a valid URI and multicast, but an invalid ttl */
553 fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
554 "rtsp://localhost/test/stream=0") == GST_RTSP_OK);
555 str = g_strdup_printf ("%d", cseq);
556 gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
557 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
558 "RTP/AVP;multicast;destination=233.252.0.1;ttl=2;port=5000-5001;");
560 gst_rtsp_client_set_send_func (client, test_setup_response_461, NULL, NULL);
561 fail_unless (gst_rtsp_client_handle_message (client,
562 &request) == GST_RTSP_OK);
563 gst_rtsp_message_unset (&request);
565 session_pool = gst_rtsp_client_get_session_pool (client);
566 fail_unless (session_pool != NULL);
567 /* FIXME: There seems to be a leak of a session here ! */
568 /* fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0); */
569 g_object_unref (session_pool);
572 g_object_unref (client);
577 GST_START_TEST (test_client_multicast_transport_specific)
579 GstRTSPClient *client;
580 GstRTSPMessage request = { 0, };
582 GstRTSPSessionPool *session_pool;
584 client = setup_multicast_client ();
586 gst_rtsp_client_set_use_client_settings (client, TRUE);
587 fail_unless (gst_rtsp_client_get_use_client_settings (client));
589 expected_transport = "RTP/AVP;multicast;destination=233.252.0.1;"
590 "ttl=1;port=5000-5001;mode=\"PLAY\"";
592 /* simple SETUP with a valid URI and multicast, but an invalid ip */
593 fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
594 "rtsp://localhost/test/stream=0") == GST_RTSP_OK);
595 str = g_strdup_printf ("%d", cseq);
596 gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
597 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
600 gst_rtsp_client_set_send_func (client, test_setup_response_200_multicast,
602 fail_unless (gst_rtsp_client_handle_message (client,
603 &request) == GST_RTSP_OK);
604 gst_rtsp_message_unset (&request);
605 expected_transport = NULL;
607 gst_rtsp_client_set_send_func (client, test_setup_response_200_multicast,
609 session_pool = gst_rtsp_client_get_session_pool (client);
610 fail_unless (session_pool != NULL);
611 fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 1);
612 g_object_unref (session_pool);
614 g_object_unref (client);
620 test_response_sdp (GstRTSPClient * client, GstRTSPMessage * response,
621 gboolean close, gpointer user_data)
625 GstSDPMessage *sdp_msg;
626 const GstSDPMedia *sdp_media;
627 const GstSDPBandwidth *bw;
628 gint bandwidth_val = GPOINTER_TO_INT (user_data);
630 fail_unless (gst_rtsp_message_get_body (response, &data, &size)
632 gst_sdp_message_new (&sdp_msg);
633 fail_unless (gst_sdp_message_parse_buffer (data, size, sdp_msg)
636 /* session description */
638 fail_unless (gst_sdp_message_get_version (sdp_msg) != NULL);
640 fail_unless (gst_sdp_message_get_origin (sdp_msg) != NULL);
642 fail_unless (gst_sdp_message_get_session_name (sdp_msg) != NULL);
644 fail_unless (gst_sdp_message_times_len (sdp_msg) == 0);
646 /* verify number of medias */
647 fail_unless (gst_sdp_message_medias_len (sdp_msg) == 1);
649 /* media description */
650 sdp_media = gst_sdp_message_get_media (sdp_msg, 0);
651 fail_unless (sdp_media != NULL);
654 fail_unless (gst_sdp_media_get_media (sdp_media) != NULL);
656 /* media bandwidth */
658 fail_unless (gst_sdp_media_bandwidths_len (sdp_media) == 1);
659 bw = gst_sdp_media_get_bandwidth (sdp_media, 0);
660 fail_unless (bw != NULL);
661 fail_unless (g_strcmp0 (bw->bwtype, "AS") == 0);
662 fail_unless (bw->bandwidth == bandwidth_val);
664 fail_unless (gst_sdp_media_bandwidths_len (sdp_media) == 0);
667 gst_sdp_message_free (sdp_msg);
673 test_client_sdp (const gchar * launch_line, guint * bandwidth_val)
675 GstRTSPClient *client;
676 GstRTSPMessage request = { 0, };
679 /* simple DESCRIBE for an existing url */
680 client = setup_client (launch_line);
681 fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_DESCRIBE,
682 "rtsp://localhost/test") == GST_RTSP_OK);
683 str = g_strdup_printf ("%d", cseq);
684 gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CSEQ, str);
687 gst_rtsp_client_set_send_func (client, test_response_sdp, (gpointer) bandwidth_val, NULL);
688 fail_unless (gst_rtsp_client_handle_message (client,
689 &request) == GST_RTSP_OK);
690 gst_rtsp_message_unset (&request);
692 g_object_unref (client);
696 GST_START_TEST (test_client_sdp_with_max_bitrate_tag)
698 test_client_sdp ("videotestsrc "
699 "! taginject tags=\"maximum-bitrate=(uint)50000000\" "
700 "! video/x-raw,width=352,height=288 ! rtpgstpay name=pay0 pt=96", GUINT_TO_POINTER (50000));
703 /* max-bitrate=0: no bandwidth line */
704 test_client_sdp ("videotestsrc "
705 "! taginject tags=\"maximum-bitrate=(uint)0\" "
706 "! video/x-raw,width=352,height=288 ! rtpgstpay name=pay0 pt=96", GUINT_TO_POINTER (0));
711 GST_START_TEST (test_client_sdp_with_bitrate_tag)
713 test_client_sdp ("videotestsrc "
714 "! taginject tags=\"bitrate=(uint)7000000\" "
715 "! video/x-raw,width=352,height=288 ! rtpgstpay name=pay0 pt=96", GUINT_TO_POINTER (7000));
717 /* bitrate=0: no bandwdith line */
718 test_client_sdp ("videotestsrc "
719 "! taginject tags=\"bitrate=(uint)0\" "
720 "! video/x-raw,width=352,height=288 ! rtpgstpay name=pay0 pt=96", GUINT_TO_POINTER (0));
725 GST_START_TEST (test_client_sdp_with_max_bitrate_and_bitrate_tags)
727 test_client_sdp ("videotestsrc "
728 "! taginject tags=\"bitrate=(uint)7000000,maximum-bitrate=(uint)50000000\" "
729 "! video/x-raw,width=352,height=288 ! rtpgstpay name=pay0 pt=96", GUINT_TO_POINTER (50000));
731 /* max-bitrate is zero: fallback to bitrate */
732 test_client_sdp ("videotestsrc "
733 "! taginject tags=\"bitrate=(uint)7000000,maximum-bitrate=(uint)0\" "
734 "! video/x-raw,width=352,height=288 ! rtpgstpay name=pay0 pt=96", GUINT_TO_POINTER (7000));
736 /* max-bitrate=bitrate=0o: no bandwidth line */
737 test_client_sdp ("videotestsrc "
738 "! taginject tags=\"bitrate=(uint)0,maximum-bitrate=(uint)0\" "
739 "! video/x-raw,width=352,height=288 ! rtpgstpay name=pay0 pt=96", GUINT_TO_POINTER (0));
744 GST_START_TEST (test_client_sdp_with_no_bitrate_tags)
746 test_client_sdp ("videotestsrc "
747 "! video/x-raw,width=352,height=288 ! rtpgstpay name=pay0 pt=96", NULL);
753 rtspclient_suite (void)
755 Suite *s = suite_create ("rtspclient");
756 TCase *tc = tcase_create ("general");
758 suite_add_tcase (s, tc);
759 tcase_set_timeout (tc, 20);
760 tcase_add_test (tc, test_request);
761 tcase_add_test (tc, test_options);
762 tcase_add_test (tc, test_describe);
763 tcase_add_test (tc, test_client_multicast_transport_404);
764 tcase_add_test (tc, test_client_multicast_transport);
765 tcase_add_test (tc, test_client_multicast_ignore_transport_specific);
766 tcase_add_test (tc, test_client_multicast_invalid_transport_specific);
767 tcase_add_test (tc, test_client_multicast_transport_specific);
768 tcase_add_test (tc, test_client_sdp_with_max_bitrate_tag);
769 tcase_add_test (tc, test_client_sdp_with_bitrate_tag);
770 tcase_add_test (tc, test_client_sdp_with_max_bitrate_and_bitrate_tags);
771 tcase_add_test (tc, test_client_sdp_with_no_bitrate_tags);
776 GST_CHECK_MAIN (rtspclient);