1 /* GStreamer RTP payloader unit tests
2 * Copyright (C) 2008 Nokia Corporation and its subsidary(-ies)
3 * contact: <stefan.kost@nokia.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
20 #include <gst/check/gstcheck.h>
24 #define RELEASE_ELEMENT(x) if(x) {gst_object_unref(x); x = NULL;}
29 * RTP pipeline structure to store the required elements.
35 GstElement *capsfilter;
40 const char *frame_data;
46 * Number of bytes received in the chain list function when using buffer lists
48 static guint chain_list_bytes_received;
51 * Chain list function for testing buffer lists
54 rtp_pipeline_chain_list (GstPad * pad, GstBufferList * list)
56 GstBufferListIterator *it;
59 it = gst_buffer_list_iterate (list);
62 * Count the size of the payload in the buffer list.
65 /* Loop through all groups */
66 while (gst_buffer_list_iterator_next_group (it)) {
69 /* Skip the first buffer in the group, its the RTP header */
70 fail_if (!gst_buffer_list_iterator_next (it));
72 /* Loop through all payload buffers in the current group */
73 while ((paybuf = gst_buffer_list_iterator_next (it))) {
74 chain_list_bytes_received += GST_BUFFER_SIZE (paybuf);
78 gst_buffer_list_iterator_free (it);
79 gst_buffer_list_unref (list);
88 rtp_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
90 GMainLoop *mainloop = (GMainLoop *) data;
92 switch (GST_MESSAGE_TYPE (message)) {
93 case GST_MESSAGE_ERROR:
101 element_name = (message->src) ? gst_object_get_name (message->src) : NULL;
102 gst_message_parse_error (message, &err, &debug);
103 /* FIXME: should we fail the test here? */
104 g_print ("\nError from element %s: %s\n%s\n\n",
105 GST_STR_NULL (element_name), err->message, (debug) ? debug : "");
108 g_free (element_name);
110 g_main_loop_quit (mainloop);
114 case GST_MESSAGE_EOS:
116 g_main_loop_quit (mainloop);
131 * Creates a RTP pipeline for one test.
132 * @param frame_data Pointer to the frame data which is used to pass thru pay/depayloaders.
133 * @param frame_data_size Frame data size in bytes.
134 * @param frame_count Frame count.
135 * @param filtercaps Caps filters.
136 * @param pay Payloader name.
137 * @param depay Depayloader name.
139 * Returns pointer to the RTP pipeline.
140 * The user must free the RTP pipeline when it's not used anymore.
142 static rtp_pipeline *
143 rtp_pipeline_create (const char *frame_data, int frame_data_size,
144 int frame_count, const char *filtercaps, const char *pay, const char *depay)
146 gchar *pipeline_name;
152 /* Check parameters. */
153 if (!frame_data || !pay || !depay) {
157 /* Allocate memory for the RTP pipeline. */
158 p = (rtp_pipeline *) malloc (sizeof (rtp_pipeline));
160 p->frame_data = frame_data;
161 p->frame_data_size = frame_data_size;
162 p->frame_count = frame_count;
164 /* Create elements. */
165 pipeline_name = g_strdup_printf ("%s-%s-pipeline", pay, depay);
166 p->pipeline = gst_pipeline_new (pipeline_name);
167 g_free (pipeline_name);
168 p->fdsrc = gst_element_factory_make ("fdsrc", NULL);
169 p->capsfilter = gst_element_factory_make ("capsfilter", NULL);
170 p->rtppay = gst_element_factory_make (pay, NULL);
171 p->rtpdepay = gst_element_factory_make (depay, NULL);
172 p->fakesink = gst_element_factory_make ("fakesink", NULL);
174 /* One or more elements are not created successfully or failed to create p? */
175 if (!p->pipeline || !p->fdsrc || !p->capsfilter || !p->rtppay || !p->rtpdepay
176 || !p->fakesink || pipe (p->fd) == -1) {
177 /* Release created elements. */
178 RELEASE_ELEMENT (p->pipeline);
179 RELEASE_ELEMENT (p->fdsrc);
180 RELEASE_ELEMENT (p->capsfilter);
181 RELEASE_ELEMENT (p->rtppay);
182 RELEASE_ELEMENT (p->rtpdepay);
183 RELEASE_ELEMENT (p->fakesink);
194 /* Release allocated memory. */
200 /* Set fdsrc properties. */
201 g_object_set (p->fdsrc, "fd", p->fd[0], NULL);
202 g_object_set (p->fdsrc, "do-timestamp", TRUE, NULL);
203 g_object_set (p->fdsrc, "blocksize", p->frame_data_size, NULL);
204 g_object_set (p->fdsrc, "num-buffers", p->frame_count * LOOP_COUNT, NULL);
206 /* Set caps filters. */
207 caps = gst_caps_from_string (filtercaps);
209 g_object_set (p->capsfilter, "caps", caps, NULL);
210 gst_caps_unref (caps);
212 /* Add elements to the pipeline. */
213 gst_bin_add (GST_BIN (p->pipeline), p->fdsrc);
214 gst_bin_add (GST_BIN (p->pipeline), p->capsfilter);
215 gst_bin_add (GST_BIN (p->pipeline), p->rtppay);
216 gst_bin_add (GST_BIN (p->pipeline), p->rtpdepay);
217 gst_bin_add (GST_BIN (p->pipeline), p->fakesink);
220 gst_element_link (p->fdsrc, p->capsfilter);
221 gst_element_link (p->capsfilter, p->rtppay);
222 gst_element_link (p->rtppay, p->rtpdepay);
223 gst_element_link (p->rtpdepay, p->fakesink);
229 * Destroys the RTP pipeline.
230 * @param p Pointer to the RTP pipeline.
233 rtp_pipeline_destroy (rtp_pipeline * p)
235 /* Check parameters. */
240 /* Release pipeline. */
241 RELEASE_ELEMENT (p->pipeline);
252 /* Release allocated memory. */
257 * Runs the RTP pipeline.
258 * @param p Pointer to the RTP pipeline.
261 rtp_pipeline_run (rtp_pipeline * p)
263 GMainLoop *mainloop = NULL;
269 /* Check parameters. */
274 /* Create mainloop. */
275 mainloop = g_main_loop_new (NULL, FALSE);
280 /* Add bus callback. */
281 bus = gst_pipeline_get_bus (GST_PIPELINE (p->pipeline));
283 gst_bus_add_watch (bus, rtp_bus_callback, (gpointer) mainloop);
284 gst_object_unref (bus);
286 /* Set pipeline to PLAYING. */
287 gst_element_set_state (p->pipeline, GST_STATE_PLAYING);
289 /* TODO: Writing may need some changes... */
291 for (i = 0; i < LOOP_COUNT; i++) {
292 const char *frame_data_pointer = p->frame_data;
294 int frame_count = p->frame_count;
296 /* Write in to the pipe. */
297 while (frame_count > 0) {
298 res = write (p->fd[1], frame_data_pointer, p->frame_data_size);
299 fail_unless_equals_int (res, p->frame_data_size);
300 frame_data_pointer += p->frame_data_size;
306 g_main_loop_run (mainloop);
308 /* Set pipeline to NULL. */
309 gst_element_set_state (p->pipeline, GST_STATE_NULL);
311 /* Release mainloop. */
312 g_main_loop_unref (mainloop);
316 * Enables buffer lists. Sets the buffer-list property of the payloader
317 * and adds a chain_list_function to the depayloader.
318 * @param p Pointer to the RTP pipeline.
321 rtp_pipeline_enable_lists (rtp_pipeline * p, guint mtu_size)
325 /* use buffer lists */
326 g_object_set (p->rtppay, "buffer-list", TRUE, NULL);
328 /* set mtu size if needed */
330 g_object_set (p->rtppay, "mtu", mtu_size, NULL);
333 /* Add chain list function for the buffer list tests */
334 pad = gst_element_get_static_pad (p->rtpdepay, "sink");
335 gst_pad_set_chain_list_function (pad,
336 GST_DEBUG_FUNCPTR (rtp_pipeline_chain_list));
337 gst_object_unref (pad);
341 * Creates the RTP pipeline and runs the test using the pipeline.
342 * @param frame_data Pointer to the frame data which is used to pass thru pay/depayloaders.
343 * @param frame_data_size Frame data size in bytes.
344 * @param frame_count Frame count.
345 * @param filtercaps Caps filters.
346 * @param pay Payloader name.
347 * @param depay Depayloader name.
348 * @bytes_sent bytes that will be sent, used when testing buffer lists
349 * @mtu_size set mtu size when testing lists
350 * @use_lists enable buffer lists
353 rtp_pipeline_test (const char *frame_data, int frame_data_size, int frame_count,
354 const char *filtercaps, const char *pay, const char *depay,
355 guint bytes_sent, guint mtu_size, gboolean use_lists)
357 /* Create RTP pipeline. */
359 rtp_pipeline_create (frame_data, frame_data_size, frame_count, filtercaps,
367 rtp_pipeline_enable_lists (p, mtu_size);
368 chain_list_bytes_received = 0;
371 /* Run RTP pipeline. */
372 rtp_pipeline_run (p);
374 /* Destroy RTP pipeline. */
375 rtp_pipeline_destroy (p);
378 /* 'next NAL' indicator is 4 bytes */
379 fail_if (chain_list_bytes_received != bytes_sent * LOOP_COUNT);
383 static char rtp_ilbc_frame_data[] =
384 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
385 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
388 static int rtp_ilbc_frame_data_size = 20;
390 static int rtp_ilbc_frame_count = 1;
392 GST_START_TEST (rtp_ilbc)
394 rtp_pipeline_test (rtp_ilbc_frame_data, rtp_ilbc_frame_data_size,
395 rtp_ilbc_frame_count, "audio/x-iLBC,mode=20", "rtpilbcpay",
396 "rtpilbcdepay", 0, 0, FALSE);
400 static char rtp_gsm_frame_data[] =
401 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
402 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
405 static int rtp_gsm_frame_data_size = 20;
407 static int rtp_gsm_frame_count = 1;
409 GST_START_TEST (rtp_gsm)
411 rtp_pipeline_test (rtp_gsm_frame_data, rtp_gsm_frame_data_size,
412 rtp_gsm_frame_count, "audio/x-gsm,rate=8000,channels=1", "rtpgsmpay",
413 "rtpgsmdepay", 0, 0, FALSE);
417 static char rtp_amr_frame_data[] =
418 { 0x3c, 0x24, 0x03, 0xb3, 0x48, 0x10, 0x68, 0x46, 0x6c, 0xec, 0x03,
419 0x7a, 0x37, 0x16, 0x41, 0x41, 0xc0, 0x00, 0x0d, 0xcd, 0x12, 0xed,
420 0xad, 0x80, 0x00, 0x00, 0x11, 0x31, 0x00, 0x00, 0x0d, 0xa0
423 static int rtp_amr_frame_data_size = 32;
425 static int rtp_amr_frame_count = 1;
427 GST_START_TEST (rtp_amr)
429 rtp_pipeline_test (rtp_amr_frame_data, rtp_amr_frame_data_size,
430 rtp_amr_frame_count, "audio/AMR,channels=1,rate=8000", "rtpamrpay",
431 "rtpamrdepay", 0, 0, FALSE);
435 static char rtp_pcma_frame_data[] =
436 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
437 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
440 static int rtp_pcma_frame_data_size = 20;
442 static int rtp_pcma_frame_count = 1;
444 GST_START_TEST (rtp_pcma)
446 rtp_pipeline_test (rtp_pcma_frame_data, rtp_pcma_frame_data_size,
447 rtp_pcma_frame_count, "audio/x-alaw,channels=1,rate=8000", "rtppcmapay",
448 "rtppcmadepay", 0, 0, FALSE);
452 static char rtp_pcmu_frame_data[] =
453 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
454 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
457 static int rtp_pcmu_frame_data_size = 20;
459 static int rtp_pcmu_frame_count = 1;
461 GST_START_TEST (rtp_pcmu)
463 rtp_pipeline_test (rtp_pcmu_frame_data, rtp_pcmu_frame_data_size,
464 rtp_pcmu_frame_count, "audio/x-mulaw,channels=1,rate=8000", "rtppcmupay",
465 "rtppcmudepay", 0, 0, FALSE);
469 static char rtp_mpa_frame_data[] =
470 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
471 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
474 static int rtp_mpa_frame_data_size = 20;
476 static int rtp_mpa_frame_count = 1;
478 GST_START_TEST (rtp_mpa)
480 rtp_pipeline_test (rtp_mpa_frame_data, rtp_mpa_frame_data_size,
481 rtp_mpa_frame_count, "audio/mpeg", "rtpmpapay", "rtpmpadepay", 0, 0,
486 static char rtp_h263_frame_data[] =
487 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
488 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
491 static int rtp_h263_frame_data_size = 20;
493 static int rtp_h263_frame_count = 1;
495 GST_START_TEST (rtp_h263)
497 rtp_pipeline_test (rtp_h263_frame_data, rtp_h263_frame_data_size,
498 rtp_h263_frame_count, "video/x-h263,variant=itu,h263version=h263",
499 "rtph263pay", "rtph263depay", 0, 0, FALSE);
503 static char rtp_h263p_frame_data[] =
504 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
505 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
508 static int rtp_h263p_frame_data_size = 20;
510 static int rtp_h263p_frame_count = 1;
512 GST_START_TEST (rtp_h263p)
514 rtp_pipeline_test (rtp_h263p_frame_data, rtp_h263p_frame_data_size,
515 rtp_h263p_frame_count, "video/x-h263,variant=itu", "rtph263ppay",
516 "rtph263pdepay", 0, 0, FALSE);
520 static char rtp_h264_frame_data[] =
521 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
522 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
525 static int rtp_h264_frame_data_size = 20;
527 static int rtp_h264_frame_count = 1;
529 GST_START_TEST (rtp_h264)
531 rtp_pipeline_test (rtp_h264_frame_data, rtp_h264_frame_data_size,
532 rtp_h264_frame_count, "video/x-h264", "rtph264pay", "rtph264depay",
537 static char rtp_h264_list_lt_mtu_frame_data[] =
538 /* not packetized, next NAL starts with 0001 */
539 { 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
540 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
541 0xad, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00
544 static int rtp_h264_list_lt_mtu_frame_data_size = 16;
546 static int rtp_h264_list_lt_mtu_frame_count = 2;
549 static int rtp_h264_list_lt_mtu_bytes_sent = 2 * (16 - 4);
551 static int rtp_h264_list_lt_mtu_mtu_size = 1024;
553 GST_START_TEST (rtp_h264_list_lt_mtu)
555 rtp_pipeline_test (rtp_h264_list_lt_mtu_frame_data,
556 rtp_h264_list_lt_mtu_frame_data_size, rtp_h264_list_lt_mtu_frame_count,
557 "video/x-h264", "rtph264pay", "rtph264depay",
558 rtp_h264_list_lt_mtu_bytes_sent, rtp_h264_list_lt_mtu_mtu_size, TRUE);
562 static char rtp_h264_list_gt_mtu_frame_data[] =
563 /* not packetized, next NAL starts with 0001 */
564 { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
565 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
566 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
567 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
568 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
569 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
572 static int rtp_h264_list_gt_mtu_frame_data_size = 64;
574 static int rtp_h264_list_gt_mtu_frame_count = 1;
576 /* NAL = 4 bytes. When data does not fit into 1 mtu, 1 byte will be skipped */
577 static int rtp_h264_list_gt_mtu_bytes_sent = 1 * (64 - 4) - 1;
579 static int rtp_h264_list_gt_mtu_mty_size = 28;
581 GST_START_TEST (rtp_h264_list_gt_mtu)
583 rtp_pipeline_test (rtp_h264_list_gt_mtu_frame_data,
584 rtp_h264_list_gt_mtu_frame_data_size, rtp_h264_list_gt_mtu_frame_count,
585 "video/x-h264", "rtph264pay", "rtph264depay",
586 rtp_h264_list_gt_mtu_bytes_sent, rtp_h264_list_gt_mtu_mty_size, TRUE);
590 static char rtp_L16_frame_data[] =
591 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
592 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
595 static int rtp_L16_frame_data_size = 20;
597 static int rtp_L16_frame_count = 1;
599 GST_START_TEST (rtp_L16)
601 rtp_pipeline_test (rtp_L16_frame_data, rtp_L16_frame_data_size,
603 "audio/x-raw-int,endianess=4321,signed=true,width=16,depth=16,rate=1,channels=1",
604 "rtpL16pay", "rtpL16depay", 0, 0, FALSE);
608 static char rtp_mp2t_frame_data[] =
609 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
610 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
613 static int rtp_mp2t_frame_data_size = 20;
615 static int rtp_mp2t_frame_count = 1;
617 GST_START_TEST (rtp_mp2t)
619 rtp_pipeline_test (rtp_mp2t_frame_data, rtp_mp2t_frame_data_size,
620 rtp_mp2t_frame_count, "video/mpegts,packetsize=188,systemstream=true",
621 "rtpmp2tpay", "rtpmp2tdepay", 0, 0, FALSE);
625 static char rtp_mp4v_frame_data[] =
626 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
627 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
630 static int rtp_mp4v_frame_data_size = 20;
632 static int rtp_mp4v_frame_count = 1;
634 GST_START_TEST (rtp_mp4v)
636 rtp_pipeline_test (rtp_mp4v_frame_data, rtp_mp4v_frame_data_size,
637 rtp_mp4v_frame_count, "video/mpeg,mpegversion=4,systemstream=false",
638 "rtpmp4vpay", "rtpmp4vdepay", 0, 0, FALSE);
642 static char rtp_mp4v_list_frame_data[] =
643 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
644 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
647 static int rtp_mp4v_list_frame_data_size = 20;
649 static int rtp_mp4v_list_frame_count = 1;
651 static int rtp_mp4v_list_bytes_sent = 1 * 20;
653 GST_START_TEST (rtp_mp4v_list)
655 rtp_pipeline_test (rtp_mp4v_list_frame_data, rtp_mp4v_list_frame_data_size,
656 rtp_mp4v_list_frame_count,
657 "video/mpeg,mpegversion=4,codec_data=(buffer)000001b001",
658 "rtpmp4vpay", "rtpmp4vdepay", rtp_mp4v_list_bytes_sent, 0, TRUE);
662 static char rtp_mp4g_frame_data[] =
663 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
664 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
667 static int rtp_mp4g_frame_data_size = 20;
669 static int rtp_mp4g_frame_count = 1;
671 GST_START_TEST (rtp_mp4g)
673 rtp_pipeline_test (rtp_mp4g_frame_data, rtp_mp4g_frame_data_size,
674 rtp_mp4g_frame_count,
675 "video/mpeg,mpegversion=4,codec_data=(buffer)000001b001", "rtpmp4gpay",
676 "rtpmp4gdepay", 0, 0, FALSE);
680 static char rtp_theora_frame_data[] =
681 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
682 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
685 static int rtp_theora_frame_data_size = 20;
687 static int rtp_theora_frame_count = 1;
689 GST_START_TEST (rtp_theora)
691 rtp_pipeline_test (rtp_theora_frame_data, rtp_theora_frame_data_size,
692 rtp_theora_frame_count, "video/x-theora", "rtptheorapay",
693 "rtptheoradepay", 0, 0, FALSE);
697 static char rtp_vorbis_frame_data[] =
698 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
699 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
702 static int rtp_vorbis_frame_data_size = 20;
704 static int rtp_vorbis_frame_count = 1;
706 GST_START_TEST (rtp_vorbis)
708 rtp_pipeline_test (rtp_vorbis_frame_data, rtp_vorbis_frame_data_size,
709 rtp_vorbis_frame_count, "audio/x-vorbis", "rtpvorbispay",
710 "rtpvorbisdepay", 0, 0, FALSE);
714 static char rtp_jpeg_frame_data[] =
715 { /* SOF */ 0xFF, 0xC0, 0x00, 0x11, 0x08, 0x00, 0x08, 0x00, 0x08,
716 0x03, 0x00, 0x21, 0x08, 0x01, 0x11, 0x08, 0x02, 0x11, 0x08,
717 /* DQT */ 0xFF, 0xDB, 0x00, 0x43, 0x08,
718 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
719 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
720 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
721 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
722 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
723 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
724 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
725 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
726 /* DATA */ 0x00, 0x00, 0x00, 0x00, 0x00
729 static int rtp_jpeg_frame_data_size = sizeof (rtp_jpeg_frame_data);
731 static int rtp_jpeg_frame_count = 1;
733 GST_START_TEST (rtp_jpeg)
735 rtp_pipeline_test (rtp_jpeg_frame_data, rtp_jpeg_frame_data_size,
736 rtp_jpeg_frame_count, "video/x-jpeg,height=640,width=480", "rtpjpegpay",
737 "rtpjpegdepay", 0, 0, FALSE);
741 static char rtp_jpeg_list_frame_data[] =
742 { /* SOF */ 0xFF, 0xC0, 0x00, 0x11, 0x08, 0x00, 0x08, 0x00, 0x08,
743 0x03, 0x00, 0x21, 0x08, 0x01, 0x11, 0x08, 0x02, 0x11, 0x08,
744 /* DQT */ 0xFF, 0xDB, 0x00, 0x43, 0x08,
745 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
746 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
747 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
748 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
749 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
750 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
751 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
752 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
753 /* DATA */ 0x00, 0x00, 0x00, 0x00, 0x00
756 static int rtp_jpeg_list_frame_data_size = sizeof (rtp_jpeg_list_frame_data);
758 static int rtp_jpeg_list_frame_count = 1;
760 static int rtp_jpeg_list_bytes_sent = 1 * sizeof (rtp_jpeg_list_frame_data);
762 GST_START_TEST (rtp_jpeg_list)
764 rtp_pipeline_test (rtp_jpeg_list_frame_data, rtp_jpeg_list_frame_data_size,
765 rtp_jpeg_list_frame_count, "video/x-jpeg,height=640,width=480",
766 "rtpjpegpay", "rtpjpegdepay", rtp_jpeg_list_bytes_sent, 0, TRUE);
770 static char rtp_g729_frame_data[] =
771 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
772 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
775 static int rtp_g729_frame_data_size = 22;
777 static int rtp_g729_frame_count = 1;
779 GST_START_TEST (rtp_g729)
781 rtp_pipeline_test (rtp_g729_frame_data, rtp_g729_frame_data_size,
782 rtp_g729_frame_count, "audio/G729", "rtpg729pay",
783 "rtpg729depay", 0, 0, FALSE);
789 * Creates the test suite.
791 * Returns: pointer to the test suite.
794 rtp_payloading_suite (void)
796 Suite *s = suite_create ("rtp_data_test");
798 TCase *tc_chain = tcase_create ("linear");
800 /* Set timeout to 60 seconds. */
801 tcase_set_timeout (tc_chain, 60);
803 suite_add_tcase (s, tc_chain);
804 tcase_add_test (tc_chain, rtp_ilbc);
805 tcase_add_test (tc_chain, rtp_gsm);
806 tcase_add_test (tc_chain, rtp_amr);
807 tcase_add_test (tc_chain, rtp_pcma);
808 tcase_add_test (tc_chain, rtp_pcmu);
809 tcase_add_test (tc_chain, rtp_mpa);
810 tcase_add_test (tc_chain, rtp_h263);
811 tcase_add_test (tc_chain, rtp_h263p);
812 tcase_add_test (tc_chain, rtp_h264);
813 tcase_add_test (tc_chain, rtp_h264_list_lt_mtu);
814 tcase_add_test (tc_chain, rtp_h264_list_gt_mtu);
815 tcase_add_test (tc_chain, rtp_L16);
816 tcase_add_test (tc_chain, rtp_mp2t);
817 tcase_add_test (tc_chain, rtp_mp4v);
818 tcase_add_test (tc_chain, rtp_mp4v_list);
819 tcase_add_test (tc_chain, rtp_mp4g);
820 tcase_add_test (tc_chain, rtp_theora);
821 tcase_add_test (tc_chain, rtp_vorbis);
822 tcase_add_test (tc_chain, rtp_jpeg);
823 tcase_add_test (tc_chain, rtp_jpeg_list);
824 tcase_add_test (tc_chain, rtp_g729);
828 GST_CHECK_MAIN (rtp_payloading)