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.
38 const guint8 *frame_data;
44 * Number of bytes received in the chain list function when using buffer lists
46 static guint chain_list_bytes_received;
49 * Chain list function for testing buffer lists
52 rtp_pipeline_chain_list (GstPad * pad, GstBufferList * list)
54 GstBufferListIterator *it;
57 it = gst_buffer_list_iterate (list);
60 * Count the size of the payload in the buffer list.
63 /* Loop through all groups */
64 while (gst_buffer_list_iterator_next_group (it)) {
67 /* Skip the first buffer in the group, its the RTP header */
68 fail_if (!gst_buffer_list_iterator_next (it));
70 /* Loop through all payload buffers in the current group */
71 while ((paybuf = gst_buffer_list_iterator_next (it))) {
72 chain_list_bytes_received += GST_BUFFER_SIZE (paybuf);
76 gst_buffer_list_iterator_free (it);
77 gst_buffer_list_unref (list);
86 rtp_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
88 GMainLoop *mainloop = (GMainLoop *) data;
90 switch (GST_MESSAGE_TYPE (message)) {
91 case GST_MESSAGE_ERROR:
99 element_name = (message->src) ? gst_object_get_name (message->src) : NULL;
100 gst_message_parse_error (message, &err, &debug);
101 /* FIXME: should we fail the test here? */
102 g_print ("\nError from element %s: %s\n%s\n\n",
103 GST_STR_NULL (element_name), err->message, (debug) ? debug : "");
106 g_free (element_name);
108 g_main_loop_quit (mainloop);
112 case GST_MESSAGE_EOS:
114 g_main_loop_quit (mainloop);
129 * Creates a RTP pipeline for one test.
130 * @param frame_data Pointer to the frame data which is used to pass thru pay/depayloaders.
131 * @param frame_data_size Frame data size in bytes.
132 * @param frame_count Frame count.
133 * @param filtercaps Caps filters.
134 * @param pay Payloader name.
135 * @param depay Depayloader name.
137 * Returns pointer to the RTP pipeline.
138 * The user must free the RTP pipeline when it's not used anymore.
140 static rtp_pipeline *
141 rtp_pipeline_create (const guint8 * frame_data, int frame_data_size,
142 int frame_count, const char *filtercaps, const char *pay, const char *depay)
144 gchar *pipeline_name;
148 /* Check parameters. */
149 if (!frame_data || !pay || !depay) {
153 /* Allocate memory for the RTP pipeline. */
154 p = (rtp_pipeline *) malloc (sizeof (rtp_pipeline));
156 p->frame_data = frame_data;
157 p->frame_data_size = frame_data_size;
158 p->frame_count = frame_count;
160 /* Create elements. */
161 pipeline_name = g_strdup_printf ("%s-%s-pipeline", pay, depay);
162 p->pipeline = gst_pipeline_new (pipeline_name);
163 g_free (pipeline_name);
164 p->appsrc = gst_element_factory_make ("appsrc", NULL);
165 p->rtppay = gst_element_factory_make (pay, NULL);
166 p->rtpdepay = gst_element_factory_make (depay, NULL);
167 p->fakesink = gst_element_factory_make ("fakesink", NULL);
169 /* One or more elements are not created successfully or failed to create p? */
170 if (!p->pipeline || !p->appsrc || !p->rtppay || !p->rtpdepay || !p->fakesink) {
171 /* Release created elements. */
172 RELEASE_ELEMENT (p->pipeline);
173 RELEASE_ELEMENT (p->appsrc);
174 RELEASE_ELEMENT (p->rtppay);
175 RELEASE_ELEMENT (p->rtpdepay);
176 RELEASE_ELEMENT (p->fakesink);
178 /* Release allocated memory. */
184 /* Set src properties. */
185 caps = gst_caps_from_string (filtercaps);
186 g_object_set (p->appsrc, "do-timestamp", TRUE, "caps", caps, NULL);
187 gst_caps_unref (caps);
189 /* Add elements to the pipeline. */
190 gst_bin_add (GST_BIN (p->pipeline), p->appsrc);
191 gst_bin_add (GST_BIN (p->pipeline), p->rtppay);
192 gst_bin_add (GST_BIN (p->pipeline), p->rtpdepay);
193 gst_bin_add (GST_BIN (p->pipeline), p->fakesink);
196 gst_element_link (p->appsrc, p->rtppay);
197 gst_element_link (p->rtppay, p->rtpdepay);
198 gst_element_link (p->rtpdepay, p->fakesink);
204 * Destroys the RTP pipeline.
205 * @param p Pointer to the RTP pipeline.
208 rtp_pipeline_destroy (rtp_pipeline * p)
210 /* Check parameters. */
215 /* Release pipeline. */
216 RELEASE_ELEMENT (p->pipeline);
218 /* Release allocated memory. */
223 * Runs the RTP pipeline.
224 * @param p Pointer to the RTP pipeline.
227 rtp_pipeline_run (rtp_pipeline * p)
229 GstFlowReturn flow_ret;
230 GMainLoop *mainloop = NULL;
234 /* Check parameters. */
239 /* Create mainloop. */
240 mainloop = g_main_loop_new (NULL, FALSE);
245 /* Add bus callback. */
246 bus = gst_pipeline_get_bus (GST_PIPELINE (p->pipeline));
248 gst_bus_add_watch (bus, rtp_bus_callback, (gpointer) mainloop);
249 gst_object_unref (bus);
251 /* Set pipeline to PLAYING. */
252 gst_element_set_state (p->pipeline, GST_STATE_PLAYING);
254 /* Push data into the pipeline */
255 for (i = 0; i < LOOP_COUNT; i++) {
256 const guint8 *data = p->frame_data;
258 for (j = 0; j < p->frame_count; j++) {
261 buf = gst_buffer_new ();
262 GST_BUFFER_DATA (buf) = (guint8 *) data;
263 GST_BUFFER_SIZE (buf) = p->frame_data_size;
264 GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY);
266 g_signal_emit_by_name (p->appsrc, "push-buffer", buf, &flow_ret);
267 fail_unless_equals_int (flow_ret, GST_FLOW_OK);
268 data += p->frame_data_size;
270 gst_buffer_unref (buf);
274 g_signal_emit_by_name (p->appsrc, "end-of-stream", &flow_ret);
277 g_main_loop_run (mainloop);
279 /* Set pipeline to NULL. */
280 gst_element_set_state (p->pipeline, GST_STATE_NULL);
282 /* Release mainloop. */
283 g_main_loop_unref (mainloop);
287 * Enables buffer lists. Sets the buffer-list property of the payloader
288 * and adds a chain_list_function to the depayloader.
289 * @param p Pointer to the RTP pipeline.
292 rtp_pipeline_enable_lists (rtp_pipeline * p, guint mtu_size)
296 /* use buffer lists */
297 g_object_set (p->rtppay, "buffer-list", TRUE, NULL);
299 /* set mtu size if needed */
301 g_object_set (p->rtppay, "mtu", mtu_size, NULL);
304 /* Add chain list function for the buffer list tests */
305 pad = gst_element_get_static_pad (p->rtpdepay, "sink");
306 gst_pad_set_chain_list_function (pad,
307 GST_DEBUG_FUNCPTR (rtp_pipeline_chain_list));
308 gst_object_unref (pad);
312 * Creates the RTP pipeline and runs the test using the pipeline.
313 * @param frame_data Pointer to the frame data which is used to pass thru pay/depayloaders.
314 * @param frame_data_size Frame data size in bytes.
315 * @param frame_count Frame count.
316 * @param filtercaps Caps filters.
317 * @param pay Payloader name.
318 * @param depay Depayloader name.
319 * @bytes_sent bytes that will be sent, used when testing buffer lists
320 * @mtu_size set mtu size when testing lists
321 * @use_lists enable buffer lists
324 rtp_pipeline_test (const guint8 * frame_data, int frame_data_size,
325 int frame_count, const char *filtercaps, const char *pay, const char *depay,
326 guint bytes_sent, guint mtu_size, gboolean use_lists)
328 /* Create RTP pipeline. */
330 rtp_pipeline_create (frame_data, frame_data_size, frame_count, filtercaps,
338 rtp_pipeline_enable_lists (p, mtu_size);
339 chain_list_bytes_received = 0;
342 /* Run RTP pipeline. */
343 rtp_pipeline_run (p);
345 /* Destroy RTP pipeline. */
346 rtp_pipeline_destroy (p);
349 /* 'next NAL' indicator is 4 bytes */
350 fail_if (chain_list_bytes_received != bytes_sent * LOOP_COUNT);
354 static const guint8 rtp_ilbc_frame_data[] =
355 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
356 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
359 static int rtp_ilbc_frame_data_size = 20;
361 static int rtp_ilbc_frame_count = 1;
363 GST_START_TEST (rtp_ilbc)
365 rtp_pipeline_test (rtp_ilbc_frame_data, rtp_ilbc_frame_data_size,
366 rtp_ilbc_frame_count, "audio/x-iLBC,mode=20", "rtpilbcpay",
367 "rtpilbcdepay", 0, 0, FALSE);
371 static const guint8 rtp_gsm_frame_data[] =
372 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
376 static int rtp_gsm_frame_data_size = 20;
378 static int rtp_gsm_frame_count = 1;
380 GST_START_TEST (rtp_gsm)
382 rtp_pipeline_test (rtp_gsm_frame_data, rtp_gsm_frame_data_size,
383 rtp_gsm_frame_count, "audio/x-gsm,rate=8000,channels=1", "rtpgsmpay",
384 "rtpgsmdepay", 0, 0, FALSE);
388 static const guint8 rtp_amr_frame_data[] =
389 { 0x3c, 0x24, 0x03, 0xb3, 0x48, 0x10, 0x68, 0x46, 0x6c, 0xec, 0x03,
390 0x7a, 0x37, 0x16, 0x41, 0x41, 0xc0, 0x00, 0x0d, 0xcd, 0x12, 0xed,
391 0xad, 0x80, 0x00, 0x00, 0x11, 0x31, 0x00, 0x00, 0x0d, 0xa0
394 static int rtp_amr_frame_data_size = 32;
396 static int rtp_amr_frame_count = 1;
398 GST_START_TEST (rtp_amr)
400 rtp_pipeline_test (rtp_amr_frame_data, rtp_amr_frame_data_size,
401 rtp_amr_frame_count, "audio/AMR,channels=1,rate=8000", "rtpamrpay",
402 "rtpamrdepay", 0, 0, FALSE);
406 static const guint8 rtp_pcma_frame_data[] =
407 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
408 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
411 static int rtp_pcma_frame_data_size = 20;
413 static int rtp_pcma_frame_count = 1;
415 GST_START_TEST (rtp_pcma)
417 rtp_pipeline_test (rtp_pcma_frame_data, rtp_pcma_frame_data_size,
418 rtp_pcma_frame_count, "audio/x-alaw,channels=1,rate=8000", "rtppcmapay",
419 "rtppcmadepay", 0, 0, FALSE);
423 static const guint8 rtp_pcmu_frame_data[] =
424 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
425 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
428 static int rtp_pcmu_frame_data_size = 20;
430 static int rtp_pcmu_frame_count = 1;
432 GST_START_TEST (rtp_pcmu)
434 rtp_pipeline_test (rtp_pcmu_frame_data, rtp_pcmu_frame_data_size,
435 rtp_pcmu_frame_count, "audio/x-mulaw,channels=1,rate=8000", "rtppcmupay",
436 "rtppcmudepay", 0, 0, FALSE);
440 static const guint8 rtp_mpa_frame_data[] =
441 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
442 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
445 static int rtp_mpa_frame_data_size = 20;
447 static int rtp_mpa_frame_count = 1;
449 GST_START_TEST (rtp_mpa)
451 rtp_pipeline_test (rtp_mpa_frame_data, rtp_mpa_frame_data_size,
452 rtp_mpa_frame_count, "audio/mpeg", "rtpmpapay", "rtpmpadepay", 0, 0,
457 static const guint8 rtp_h263_frame_data[] =
458 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
459 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
462 static int rtp_h263_frame_data_size = 20;
464 static int rtp_h263_frame_count = 1;
466 GST_START_TEST (rtp_h263)
468 rtp_pipeline_test (rtp_h263_frame_data, rtp_h263_frame_data_size,
469 rtp_h263_frame_count, "video/x-h263,variant=(string)itu,h263version=h263",
470 "rtph263pay", "rtph263depay", 0, 0, FALSE);
474 static const guint8 rtp_h263p_frame_data[] =
475 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
476 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
479 static int rtp_h263p_frame_data_size = 20;
481 static int rtp_h263p_frame_count = 1;
483 GST_START_TEST (rtp_h263p)
485 rtp_pipeline_test (rtp_h263p_frame_data, rtp_h263p_frame_data_size,
486 rtp_h263p_frame_count, "video/x-h263,variant=(string)itu", "rtph263ppay",
487 "rtph263pdepay", 0, 0, FALSE);
491 static const guint8 rtp_h264_frame_data[] =
492 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
493 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
496 static int rtp_h264_frame_data_size = 20;
498 static int rtp_h264_frame_count = 1;
500 GST_START_TEST (rtp_h264)
502 /* FIXME 0.11: fully specify h264 caps (and make payloader check) */
503 rtp_pipeline_test (rtp_h264_frame_data, rtp_h264_frame_data_size,
504 rtp_h264_frame_count, "video/x-h264", "rtph264pay", "rtph264depay",
509 static const guint8 rtp_h264_list_lt_mtu_frame_data[] =
510 /* not packetized, next NAL starts with 0001 */
511 { 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
512 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
513 0xad, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00
516 static int rtp_h264_list_lt_mtu_frame_data_size = 16;
518 static int rtp_h264_list_lt_mtu_frame_count = 2;
521 static int rtp_h264_list_lt_mtu_bytes_sent = 2 * (16 - 4);
523 static int rtp_h264_list_lt_mtu_mtu_size = 1024;
525 GST_START_TEST (rtp_h264_list_lt_mtu)
527 /* FIXME 0.11: fully specify h264 caps (and make payloader check) */
528 rtp_pipeline_test (rtp_h264_list_lt_mtu_frame_data,
529 rtp_h264_list_lt_mtu_frame_data_size, rtp_h264_list_lt_mtu_frame_count,
530 "video/x-h264", "rtph264pay", "rtph264depay",
531 rtp_h264_list_lt_mtu_bytes_sent, rtp_h264_list_lt_mtu_mtu_size, TRUE);
535 static const guint8 rtp_h264_list_gt_mtu_frame_data[] =
536 /* not packetized, next NAL starts with 0001 */
537 { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
538 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
539 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
540 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
541 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
542 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
545 static int rtp_h264_list_gt_mtu_frame_data_size = 64;
547 static int rtp_h264_list_gt_mtu_frame_count = 1;
549 /* NAL = 4 bytes. When data does not fit into 1 mtu, 1 byte will be skipped */
550 static int rtp_h264_list_gt_mtu_bytes_sent = 1 * (64 - 4) - 1;
552 static int rtp_h264_list_gt_mtu_mty_size = 28;
554 GST_START_TEST (rtp_h264_list_gt_mtu)
556 /* FIXME 0.11: fully specify h264 caps (and make payloader check) */
557 rtp_pipeline_test (rtp_h264_list_gt_mtu_frame_data,
558 rtp_h264_list_gt_mtu_frame_data_size, rtp_h264_list_gt_mtu_frame_count,
559 "video/x-h264", "rtph264pay", "rtph264depay",
560 rtp_h264_list_gt_mtu_bytes_sent, rtp_h264_list_gt_mtu_mty_size, TRUE);
564 static const guint8 rtp_L16_frame_data[] =
565 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
566 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
569 static int rtp_L16_frame_data_size = 20;
571 static int rtp_L16_frame_count = 1;
573 GST_START_TEST (rtp_L16)
575 rtp_pipeline_test (rtp_L16_frame_data, rtp_L16_frame_data_size,
577 "audio/x-raw-int,endianess=4321,signed=true,width=16,depth=16,rate=1,channels=1",
578 "rtpL16pay", "rtpL16depay", 0, 0, FALSE);
582 static const guint8 rtp_mp2t_frame_data[] =
583 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
584 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
587 static int rtp_mp2t_frame_data_size = 20;
589 static int rtp_mp2t_frame_count = 1;
591 GST_START_TEST (rtp_mp2t)
593 rtp_pipeline_test (rtp_mp2t_frame_data, rtp_mp2t_frame_data_size,
594 rtp_mp2t_frame_count, "video/mpegts,packetsize=188,systemstream=true",
595 "rtpmp2tpay", "rtpmp2tdepay", 0, 0, FALSE);
599 static const guint8 rtp_mp4v_frame_data[] =
600 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
601 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
604 static int rtp_mp4v_frame_data_size = 20;
606 static int rtp_mp4v_frame_count = 1;
608 GST_START_TEST (rtp_mp4v)
610 rtp_pipeline_test (rtp_mp4v_frame_data, rtp_mp4v_frame_data_size,
611 rtp_mp4v_frame_count, "video/mpeg,mpegversion=4,systemstream=false",
612 "rtpmp4vpay", "rtpmp4vdepay", 0, 0, FALSE);
616 static const guint8 rtp_mp4v_list_frame_data[] =
617 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
618 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
621 static int rtp_mp4v_list_frame_data_size = 20;
623 static int rtp_mp4v_list_frame_count = 1;
625 static int rtp_mp4v_list_bytes_sent = 1 * 20;
627 GST_START_TEST (rtp_mp4v_list)
629 rtp_pipeline_test (rtp_mp4v_list_frame_data, rtp_mp4v_list_frame_data_size,
630 rtp_mp4v_list_frame_count,
631 "video/mpeg,mpegversion=4,codec_data=(buffer)000001b001",
632 "rtpmp4vpay", "rtpmp4vdepay", rtp_mp4v_list_bytes_sent, 0, TRUE);
636 static const guint8 rtp_mp4g_frame_data[] =
637 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
638 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
641 static int rtp_mp4g_frame_data_size = 20;
643 static int rtp_mp4g_frame_count = 1;
645 GST_START_TEST (rtp_mp4g)
647 rtp_pipeline_test (rtp_mp4g_frame_data, rtp_mp4g_frame_data_size,
648 rtp_mp4g_frame_count,
649 "video/mpeg,mpegversion=4,codec_data=(buffer)000001b001", "rtpmp4gpay",
650 "rtpmp4gdepay", 0, 0, FALSE);
654 static const guint8 rtp_theora_frame_data[] =
655 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
656 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
659 static int rtp_theora_frame_data_size = 20;
661 static int rtp_theora_frame_count = 1;
663 GST_START_TEST (rtp_theora)
665 rtp_pipeline_test (rtp_theora_frame_data, rtp_theora_frame_data_size,
666 rtp_theora_frame_count, "video/x-theora", "rtptheorapay",
667 "rtptheoradepay", 0, 0, FALSE);
671 static const guint8 rtp_vorbis_frame_data[] =
672 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
673 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
676 static int rtp_vorbis_frame_data_size = 20;
678 static int rtp_vorbis_frame_count = 1;
680 GST_START_TEST (rtp_vorbis)
682 rtp_pipeline_test (rtp_vorbis_frame_data, rtp_vorbis_frame_data_size,
683 rtp_vorbis_frame_count, "audio/x-vorbis", "rtpvorbispay",
684 "rtpvorbisdepay", 0, 0, FALSE);
688 static const guint8 rtp_jpeg_frame_data[] =
689 { /* SOF */ 0xFF, 0xC0, 0x00, 0x11, 0x08, 0x00, 0x08, 0x00, 0x08,
690 0x03, 0x00, 0x21, 0x08, 0x01, 0x11, 0x08, 0x02, 0x11, 0x08,
691 /* DQT */ 0xFF, 0xDB, 0x00, 0x43, 0x08,
692 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
693 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
694 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
695 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
696 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
697 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
698 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
699 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
700 /* DATA */ 0x00, 0x00, 0x00, 0x00, 0x00
703 static int rtp_jpeg_frame_data_size = sizeof (rtp_jpeg_frame_data);
705 static int rtp_jpeg_frame_count = 1;
707 GST_START_TEST (rtp_jpeg)
709 rtp_pipeline_test (rtp_jpeg_frame_data, rtp_jpeg_frame_data_size,
710 rtp_jpeg_frame_count, "video/x-jpeg,height=640,width=480", "rtpjpegpay",
711 "rtpjpegdepay", 0, 0, FALSE);
715 static const guint8 rtp_jpeg_list_frame_data[] =
716 { /* SOF */ 0xFF, 0xC0, 0x00, 0x11, 0x08, 0x00, 0x08, 0x00, 0x08,
717 0x03, 0x00, 0x21, 0x08, 0x01, 0x11, 0x08, 0x02, 0x11, 0x08,
718 /* DQT */ 0xFF, 0xDB, 0x00, 0x43, 0x08,
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 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
727 /* DATA */ 0x00, 0x00, 0x00, 0x00, 0x00
730 static int rtp_jpeg_list_frame_data_size = sizeof (rtp_jpeg_list_frame_data);
732 static int rtp_jpeg_list_frame_count = 1;
734 static int rtp_jpeg_list_bytes_sent = 1 * sizeof (rtp_jpeg_list_frame_data);
736 GST_START_TEST (rtp_jpeg_list)
738 rtp_pipeline_test (rtp_jpeg_list_frame_data, rtp_jpeg_list_frame_data_size,
739 rtp_jpeg_list_frame_count, "video/x-jpeg,height=640,width=480",
740 "rtpjpegpay", "rtpjpegdepay", rtp_jpeg_list_bytes_sent, 0, TRUE);
744 static const guint8 rtp_g729_frame_data[] =
745 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
746 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
749 static int rtp_g729_frame_data_size = 22;
751 static int rtp_g729_frame_count = 1;
753 GST_START_TEST (rtp_g729)
755 rtp_pipeline_test (rtp_g729_frame_data, rtp_g729_frame_data_size,
756 rtp_g729_frame_count, "audio/G729", "rtpg729pay",
757 "rtpg729depay", 0, 0, FALSE);
763 * Creates the test suite.
765 * Returns: pointer to the test suite.
768 rtp_payloading_suite (void)
770 Suite *s = suite_create ("rtp_data_test");
772 TCase *tc_chain = tcase_create ("linear");
774 /* Set timeout to 60 seconds. */
775 tcase_set_timeout (tc_chain, 60);
777 suite_add_tcase (s, tc_chain);
778 tcase_add_test (tc_chain, rtp_ilbc);
779 tcase_add_test (tc_chain, rtp_gsm);
780 tcase_add_test (tc_chain, rtp_amr);
781 tcase_add_test (tc_chain, rtp_pcma);
782 tcase_add_test (tc_chain, rtp_pcmu);
783 tcase_add_test (tc_chain, rtp_mpa);
784 tcase_add_test (tc_chain, rtp_h263);
785 tcase_add_test (tc_chain, rtp_h263p);
786 tcase_add_test (tc_chain, rtp_h264);
787 tcase_add_test (tc_chain, rtp_h264_list_lt_mtu);
788 tcase_add_test (tc_chain, rtp_h264_list_gt_mtu);
789 tcase_add_test (tc_chain, rtp_L16);
790 tcase_add_test (tc_chain, rtp_mp2t);
791 tcase_add_test (tc_chain, rtp_mp4v);
792 tcase_add_test (tc_chain, rtp_mp4v_list);
793 tcase_add_test (tc_chain, rtp_mp4g);
794 tcase_add_test (tc_chain, rtp_theora);
795 tcase_add_test (tc_chain, rtp_vorbis);
796 tcase_add_test (tc_chain, rtp_jpeg);
797 tcase_add_test (tc_chain, rtp_jpeg_list);
798 tcase_add_test (tc_chain, rtp_g729);
802 GST_CHECK_MAIN (rtp_payloading)