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, GstObject * parent, GstBufferList * list)
58 * Count the size of the payload in the buffer list.
60 len = gst_buffer_list_length (list);
62 /* Loop through all groups */
63 for (i = 0; i < len; i++) {
66 /* FIXME need to discard RTP header */
67 paybuf = gst_buffer_list_get (list, i);
68 /* Loop through all payload buffers in the current group */
69 chain_list_bytes_received += gst_buffer_get_size (paybuf);
71 gst_buffer_list_unref (list);
80 rtp_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
82 GMainLoop *mainloop = (GMainLoop *) data;
84 switch (GST_MESSAGE_TYPE (message)) {
85 case GST_MESSAGE_ERROR:
93 element_name = (message->src) ? gst_object_get_name (message->src) : NULL;
94 gst_message_parse_error (message, &err, &debug);
95 /* FIXME: should we fail the test here? */
96 g_print ("\nError from element %s: %s\n%s\n\n",
97 GST_STR_NULL (element_name), err->message, (debug) ? debug : "");
100 g_free (element_name);
102 g_main_loop_quit (mainloop);
106 case GST_MESSAGE_EOS:
108 g_main_loop_quit (mainloop);
123 * Creates a RTP pipeline for one test.
124 * @param frame_data Pointer to the frame data which is used to pass thru pay/depayloaders.
125 * @param frame_data_size Frame data size in bytes.
126 * @param frame_count Frame count.
127 * @param filtercaps Caps filters.
128 * @param pay Payloader name.
129 * @param depay Depayloader name.
131 * Returns pointer to the RTP pipeline.
132 * The user must free the RTP pipeline when it's not used anymore.
134 static rtp_pipeline *
135 rtp_pipeline_create (const guint8 * frame_data, int frame_data_size,
136 int frame_count, const char *filtercaps, const char *pay, const char *depay)
138 gchar *pipeline_name;
142 /* Check parameters. */
143 if (!frame_data || !pay || !depay) {
147 /* Allocate memory for the RTP pipeline. */
148 p = (rtp_pipeline *) malloc (sizeof (rtp_pipeline));
150 p->frame_data = frame_data;
151 p->frame_data_size = frame_data_size;
152 p->frame_count = frame_count;
154 /* Create elements. */
155 pipeline_name = g_strdup_printf ("%s-%s-pipeline", pay, depay);
156 p->pipeline = gst_pipeline_new (pipeline_name);
157 g_free (pipeline_name);
158 p->appsrc = gst_element_factory_make ("appsrc", NULL);
159 p->rtppay = gst_element_factory_make (pay, NULL);
160 p->rtpdepay = gst_element_factory_make (depay, NULL);
161 p->fakesink = gst_element_factory_make ("fakesink", NULL);
163 /* One or more elements are not created successfully or failed to create p? */
164 if (!p->pipeline || !p->appsrc || !p->rtppay || !p->rtpdepay || !p->fakesink) {
165 /* Release created elements. */
166 RELEASE_ELEMENT (p->pipeline);
167 RELEASE_ELEMENT (p->appsrc);
168 RELEASE_ELEMENT (p->rtppay);
169 RELEASE_ELEMENT (p->rtpdepay);
170 RELEASE_ELEMENT (p->fakesink);
172 /* Release allocated memory. */
178 /* Set src properties. */
179 caps = gst_caps_from_string (filtercaps);
180 g_object_set (p->appsrc, "do-timestamp", TRUE, "caps", caps,
181 "format", GST_FORMAT_TIME, NULL);
182 gst_caps_unref (caps);
184 /* Add elements to the pipeline. */
185 gst_bin_add (GST_BIN (p->pipeline), p->appsrc);
186 gst_bin_add (GST_BIN (p->pipeline), p->rtppay);
187 gst_bin_add (GST_BIN (p->pipeline), p->rtpdepay);
188 gst_bin_add (GST_BIN (p->pipeline), p->fakesink);
191 gst_element_link (p->appsrc, p->rtppay);
192 gst_element_link (p->rtppay, p->rtpdepay);
193 gst_element_link (p->rtpdepay, p->fakesink);
199 * Destroys the RTP pipeline.
200 * @param p Pointer to the RTP pipeline.
203 rtp_pipeline_destroy (rtp_pipeline * p)
205 /* Check parameters. */
210 /* Release pipeline. */
211 RELEASE_ELEMENT (p->pipeline);
213 /* Release allocated memory. */
218 * Runs the RTP pipeline.
219 * @param p Pointer to the RTP pipeline.
222 rtp_pipeline_run (rtp_pipeline * p)
224 GstFlowReturn flow_ret;
225 GMainLoop *mainloop = NULL;
229 /* Check parameters. */
234 /* Create mainloop. */
235 mainloop = g_main_loop_new (NULL, FALSE);
240 /* Add bus callback. */
241 bus = gst_pipeline_get_bus (GST_PIPELINE (p->pipeline));
243 gst_bus_add_watch (bus, rtp_bus_callback, (gpointer) mainloop);
244 gst_object_unref (bus);
246 /* Set pipeline to PLAYING. */
247 gst_element_set_state (p->pipeline, GST_STATE_PLAYING);
249 /* Push data into the pipeline */
250 for (i = 0; i < LOOP_COUNT; i++) {
251 const guint8 *data = p->frame_data;
253 for (j = 0; j < p->frame_count; j++) {
257 gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY,
258 (guint8 *) data, p->frame_data_size, 0, p->frame_data_size, NULL,
261 g_signal_emit_by_name (p->appsrc, "push-buffer", buf, &flow_ret);
262 fail_unless_equals_int (flow_ret, GST_FLOW_OK);
263 data += p->frame_data_size;
265 gst_buffer_unref (buf);
269 g_signal_emit_by_name (p->appsrc, "end-of-stream", &flow_ret);
272 g_main_loop_run (mainloop);
274 /* Set pipeline to NULL. */
275 gst_element_set_state (p->pipeline, GST_STATE_NULL);
277 /* Release mainloop. */
278 g_main_loop_unref (mainloop);
282 * Enables buffer lists. Sets the buffer-list property of the payloader
283 * and adds a chain_list_function to the depayloader.
284 * @param p Pointer to the RTP pipeline.
287 rtp_pipeline_enable_lists (rtp_pipeline * p, guint mtu_size)
291 /* use buffer lists */
292 g_object_set (p->rtppay, "buffer-list", TRUE, NULL);
294 /* set mtu size if needed */
296 g_object_set (p->rtppay, "mtu", mtu_size, NULL);
299 /* Add chain list function for the buffer list tests */
300 pad = gst_element_get_static_pad (p->rtpdepay, "sink");
301 gst_pad_set_chain_list_function (pad,
302 GST_DEBUG_FUNCPTR (rtp_pipeline_chain_list));
303 gst_object_unref (pad);
307 * Creates the RTP pipeline and runs the test using the pipeline.
308 * @param frame_data Pointer to the frame data which is used to pass thru pay/depayloaders.
309 * @param frame_data_size Frame data size in bytes.
310 * @param frame_count Frame count.
311 * @param filtercaps Caps filters.
312 * @param pay Payloader name.
313 * @param depay Depayloader name.
314 * @bytes_sent bytes that will be sent, used when testing buffer lists
315 * @mtu_size set mtu size when testing lists
316 * @use_lists enable buffer lists
319 rtp_pipeline_test (const guint8 * frame_data, int frame_data_size,
320 int frame_count, const char *filtercaps, const char *pay, const char *depay,
321 guint bytes_sent, guint mtu_size, gboolean use_lists)
323 /* Create RTP pipeline. */
325 rtp_pipeline_create (frame_data, frame_data_size, frame_count, filtercaps,
333 rtp_pipeline_enable_lists (p, mtu_size);
334 chain_list_bytes_received = 0;
337 /* Run RTP pipeline. */
338 rtp_pipeline_run (p);
340 /* Destroy RTP pipeline. */
341 rtp_pipeline_destroy (p);
344 /* 'next NAL' indicator is 4 bytes */
345 fail_if (chain_list_bytes_received != bytes_sent * LOOP_COUNT);
349 static const guint8 rtp_ilbc_frame_data[] =
350 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
351 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
354 static int rtp_ilbc_frame_data_size = 20;
356 static int rtp_ilbc_frame_count = 1;
358 GST_START_TEST (rtp_ilbc)
360 rtp_pipeline_test (rtp_ilbc_frame_data, rtp_ilbc_frame_data_size,
361 rtp_ilbc_frame_count, "audio/x-iLBC,mode=20", "rtpilbcpay",
362 "rtpilbcdepay", 0, 0, FALSE);
366 static const guint8 rtp_gsm_frame_data[] =
367 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
368 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
371 static int rtp_gsm_frame_data_size = 20;
373 static int rtp_gsm_frame_count = 1;
375 GST_START_TEST (rtp_gsm)
377 rtp_pipeline_test (rtp_gsm_frame_data, rtp_gsm_frame_data_size,
378 rtp_gsm_frame_count, "audio/x-gsm,rate=8000,channels=1", "rtpgsmpay",
379 "rtpgsmdepay", 0, 0, FALSE);
383 static const guint8 rtp_amr_frame_data[] =
384 { 0x3c, 0x24, 0x03, 0xb3, 0x48, 0x10, 0x68, 0x46, 0x6c, 0xec, 0x03,
385 0x7a, 0x37, 0x16, 0x41, 0x41, 0xc0, 0x00, 0x0d, 0xcd, 0x12, 0xed,
386 0xad, 0x80, 0x00, 0x00, 0x11, 0x31, 0x00, 0x00, 0x0d, 0xa0
389 static int rtp_amr_frame_data_size = 32;
391 static int rtp_amr_frame_count = 1;
393 GST_START_TEST (rtp_amr)
395 rtp_pipeline_test (rtp_amr_frame_data, rtp_amr_frame_data_size,
396 rtp_amr_frame_count, "audio/AMR,channels=1,rate=8000", "rtpamrpay",
397 "rtpamrdepay", 0, 0, FALSE);
401 static const guint8 rtp_pcma_frame_data[] =
402 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
403 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
406 static int rtp_pcma_frame_data_size = 20;
408 static int rtp_pcma_frame_count = 1;
410 GST_START_TEST (rtp_pcma)
412 rtp_pipeline_test (rtp_pcma_frame_data, rtp_pcma_frame_data_size,
413 rtp_pcma_frame_count, "audio/x-alaw,channels=1,rate=8000", "rtppcmapay",
414 "rtppcmadepay", 0, 0, FALSE);
418 static const guint8 rtp_pcmu_frame_data[] =
419 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
420 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
423 static int rtp_pcmu_frame_data_size = 20;
425 static int rtp_pcmu_frame_count = 1;
427 GST_START_TEST (rtp_pcmu)
429 rtp_pipeline_test (rtp_pcmu_frame_data, rtp_pcmu_frame_data_size,
430 rtp_pcmu_frame_count, "audio/x-mulaw,channels=1,rate=8000", "rtppcmupay",
431 "rtppcmudepay", 0, 0, FALSE);
435 static const guint8 rtp_mpa_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_mpa_frame_data_size = 20;
442 static int rtp_mpa_frame_count = 1;
444 GST_START_TEST (rtp_mpa)
446 rtp_pipeline_test (rtp_mpa_frame_data, rtp_mpa_frame_data_size,
447 rtp_mpa_frame_count, "audio/mpeg,mpegversion=1", "rtpmpapay",
448 "rtpmpadepay", 0, 0, FALSE);
452 static const guint8 rtp_h263_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_h263_frame_data_size = 20;
459 static int rtp_h263_frame_count = 1;
461 GST_START_TEST (rtp_h263)
463 rtp_pipeline_test (rtp_h263_frame_data, rtp_h263_frame_data_size,
464 rtp_h263_frame_count, "video/x-h263,variant=(string)itu,h263version=h263",
465 "rtph263pay", "rtph263depay", 0, 0, FALSE);
469 static const guint8 rtp_h263p_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_h263p_frame_data_size = 20;
476 static int rtp_h263p_frame_count = 1;
478 GST_START_TEST (rtp_h263p)
480 rtp_pipeline_test (rtp_h263p_frame_data, rtp_h263p_frame_data_size,
481 rtp_h263p_frame_count, "video/x-h263,variant=(string)itu", "rtph263ppay",
482 "rtph263pdepay", 0, 0, FALSE);
486 static const guint8 rtp_h264_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_h264_frame_data_size = 20;
493 static int rtp_h264_frame_count = 1;
495 GST_START_TEST (rtp_h264)
497 /* FIXME 0.11: fully specify h264 caps (and make payloader check) */
498 rtp_pipeline_test (rtp_h264_frame_data, rtp_h264_frame_data_size,
499 rtp_h264_frame_count,
500 "video/x-h264,stream-format=(string)byte-stream,alignment=(string)nal",
501 "rtph264pay", "rtph264depay", 0, 0, FALSE);
505 static const guint8 rtp_h264_list_lt_mtu_frame_data[] =
506 /* not packetized, next NAL starts with 0001 */
507 { 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
508 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
509 0xad, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00
512 static int rtp_h264_list_lt_mtu_frame_data_size = 16;
514 static int rtp_h264_list_lt_mtu_frame_count = 2;
517 static int rtp_h264_list_lt_mtu_bytes_sent = 2 * (16 - 4);
519 static int rtp_h264_list_lt_mtu_mtu_size = 1024;
521 GST_START_TEST (rtp_h264_list_lt_mtu)
523 /* FIXME 0.11: fully specify h264 caps (and make payloader check) */
524 rtp_pipeline_test (rtp_h264_list_lt_mtu_frame_data,
525 rtp_h264_list_lt_mtu_frame_data_size, rtp_h264_list_lt_mtu_frame_count,
526 "video/x-h264,stream-format=(string)byte-stream,alignment=(string)nal",
527 "rtph264pay", "rtph264depay",
528 rtp_h264_list_lt_mtu_bytes_sent, rtp_h264_list_lt_mtu_mtu_size, TRUE);
532 static const guint8 rtp_h264_list_gt_mtu_frame_data[] =
533 /* not packetized, next NAL starts with 0001 */
534 { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
535 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
536 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
537 0x00, 0x00, 0x00, 0x00, 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
542 static int rtp_h264_list_gt_mtu_frame_data_size = 64;
544 static int rtp_h264_list_gt_mtu_frame_count = 1;
546 /* NAL = 4 bytes. When data does not fit into 1 mtu, 1 byte will be skipped */
547 static int rtp_h264_list_gt_mtu_bytes_sent = 1 * (64 - 4) - 1;
549 static int rtp_h264_list_gt_mtu_mty_size = 28;
551 GST_START_TEST (rtp_h264_list_gt_mtu)
553 /* FIXME 0.11: fully specify h264 caps (and make payloader check) */
554 rtp_pipeline_test (rtp_h264_list_gt_mtu_frame_data,
555 rtp_h264_list_gt_mtu_frame_data_size, rtp_h264_list_gt_mtu_frame_count,
556 "video/x-h264,stream-format=(string)byte-stream,alignment=(string)nal",
557 "rtph264pay", "rtph264depay",
558 rtp_h264_list_gt_mtu_bytes_sent, rtp_h264_list_gt_mtu_mty_size, TRUE);
562 static const guint8 rtp_L16_frame_data[] =
563 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
564 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
567 static int rtp_L16_frame_data_size = 20;
569 static int rtp_L16_frame_count = 1;
571 GST_START_TEST (rtp_L16)
573 rtp_pipeline_test (rtp_L16_frame_data, rtp_L16_frame_data_size,
575 "audio/x-raw,format=S16BE,rate=1,channels=1,layout=(string)interleaved",
576 "rtpL16pay", "rtpL16depay", 0, 0, FALSE);
580 static const guint8 rtp_mp2t_frame_data[] =
581 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
582 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
585 static int rtp_mp2t_frame_data_size = 20;
587 static int rtp_mp2t_frame_count = 1;
589 GST_START_TEST (rtp_mp2t)
591 rtp_pipeline_test (rtp_mp2t_frame_data, rtp_mp2t_frame_data_size,
592 rtp_mp2t_frame_count, "video/mpegts,packetsize=188,systemstream=true",
593 "rtpmp2tpay", "rtpmp2tdepay", 0, 0, FALSE);
597 static const guint8 rtp_mp4v_frame_data[] =
598 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
599 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
602 static int rtp_mp4v_frame_data_size = 20;
604 static int rtp_mp4v_frame_count = 1;
606 GST_START_TEST (rtp_mp4v)
608 rtp_pipeline_test (rtp_mp4v_frame_data, rtp_mp4v_frame_data_size,
609 rtp_mp4v_frame_count, "video/mpeg,mpegversion=4,systemstream=false",
610 "rtpmp4vpay", "rtpmp4vdepay", 0, 0, FALSE);
614 static const guint8 rtp_mp4v_list_frame_data[] =
615 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
616 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
619 static int rtp_mp4v_list_frame_data_size = 20;
621 static int rtp_mp4v_list_frame_count = 1;
623 static int rtp_mp4v_list_bytes_sent = 1 * 20;
625 GST_START_TEST (rtp_mp4v_list)
627 rtp_pipeline_test (rtp_mp4v_list_frame_data, rtp_mp4v_list_frame_data_size,
628 rtp_mp4v_list_frame_count,
629 "video/mpeg,mpegversion=4,codec_data=(buffer)000001b001",
630 "rtpmp4vpay", "rtpmp4vdepay", rtp_mp4v_list_bytes_sent, 0, TRUE);
634 static const guint8 rtp_mp4g_frame_data[] =
635 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
636 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
639 static int rtp_mp4g_frame_data_size = 20;
641 static int rtp_mp4g_frame_count = 1;
643 GST_START_TEST (rtp_mp4g)
645 rtp_pipeline_test (rtp_mp4g_frame_data, rtp_mp4g_frame_data_size,
646 rtp_mp4g_frame_count,
647 "video/mpeg,mpegversion=4,codec_data=(buffer)000001b001", "rtpmp4gpay",
648 "rtpmp4gdepay", 0, 0, FALSE);
652 static const guint8 rtp_theora_frame_data[] =
653 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
654 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
657 static int rtp_theora_frame_data_size = 20;
659 static int rtp_theora_frame_count = 1;
661 GST_START_TEST (rtp_theora)
663 rtp_pipeline_test (rtp_theora_frame_data, rtp_theora_frame_data_size,
664 rtp_theora_frame_count, "video/x-theora", "rtptheorapay",
665 "rtptheoradepay", 0, 0, FALSE);
669 static const guint8 rtp_vorbis_frame_data[] =
670 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
671 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
674 static int rtp_vorbis_frame_data_size = 20;
676 static int rtp_vorbis_frame_count = 1;
678 GST_START_TEST (rtp_vorbis)
680 rtp_pipeline_test (rtp_vorbis_frame_data, rtp_vorbis_frame_data_size,
681 rtp_vorbis_frame_count, "audio/x-vorbis", "rtpvorbispay",
682 "rtpvorbisdepay", 0, 0, FALSE);
686 static const guint8 rtp_jpeg_frame_data[] =
687 { /* SOF */ 0xFF, 0xC0, 0x00, 0x11, 0x08, 0x00, 0x08, 0x00, 0x08,
688 0x03, 0x00, 0x21, 0x08, 0x01, 0x11, 0x08, 0x02, 0x11, 0x08,
689 /* DQT */ 0xFF, 0xDB, 0x00, 0x43, 0x08,
690 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
691 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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 /* DATA */ 0x00, 0x00, 0x00, 0x00, 0x00
701 static int rtp_jpeg_frame_data_size = sizeof (rtp_jpeg_frame_data);
703 static int rtp_jpeg_frame_count = 1;
705 GST_START_TEST (rtp_jpeg)
707 rtp_pipeline_test (rtp_jpeg_frame_data, rtp_jpeg_frame_data_size,
708 rtp_jpeg_frame_count, "video/x-jpeg,height=640,width=480", "rtpjpegpay",
709 "rtpjpegdepay", 0, 0, FALSE);
713 static const guint8 rtp_jpeg_list_frame_data[] =
714 { /* SOF */ 0xFF, 0xC0, 0x00, 0x11, 0x08, 0x00, 0x08, 0x00, 0x08,
715 0x03, 0x00, 0x21, 0x08, 0x01, 0x11, 0x08, 0x02, 0x11, 0x08,
716 /* DQT */ 0xFF, 0xDB, 0x00, 0x43, 0x08,
717 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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 /* DATA */ 0x00, 0x00, 0x00, 0x00, 0x00
728 static int rtp_jpeg_list_frame_data_size = sizeof (rtp_jpeg_list_frame_data);
730 static int rtp_jpeg_list_frame_count = 1;
732 static int rtp_jpeg_list_bytes_sent = 1 * sizeof (rtp_jpeg_list_frame_data);
734 GST_START_TEST (rtp_jpeg_list)
736 rtp_pipeline_test (rtp_jpeg_list_frame_data, rtp_jpeg_list_frame_data_size,
737 rtp_jpeg_list_frame_count, "video/x-jpeg,height=640,width=480",
738 "rtpjpegpay", "rtpjpegdepay", rtp_jpeg_list_bytes_sent, 0, TRUE);
742 static const guint8 rtp_g729_frame_data[] =
743 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
744 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
747 static int rtp_g729_frame_data_size = 22;
749 static int rtp_g729_frame_count = 1;
751 GST_START_TEST (rtp_g729)
753 rtp_pipeline_test (rtp_g729_frame_data, rtp_g729_frame_data_size,
754 rtp_g729_frame_count, "audio/G729,rate=8000,channels=1", "rtpg729pay",
755 "rtpg729depay", 0, 0, FALSE);
761 * Creates the test suite.
763 * Returns: pointer to the test suite.
766 rtp_payloading_suite (void)
768 Suite *s = suite_create ("rtp_data_test");
770 TCase *tc_chain = tcase_create ("linear");
772 /* Set timeout to 60 seconds. */
773 tcase_set_timeout (tc_chain, 60);
775 suite_add_tcase (s, tc_chain);
776 tcase_add_test (tc_chain, rtp_ilbc);
777 tcase_add_test (tc_chain, rtp_gsm);
778 tcase_add_test (tc_chain, rtp_amr);
779 tcase_add_test (tc_chain, rtp_pcma);
780 tcase_add_test (tc_chain, rtp_pcmu);
781 tcase_add_test (tc_chain, rtp_mpa);
782 tcase_add_test (tc_chain, rtp_h263);
783 tcase_add_test (tc_chain, rtp_h263p);
784 tcase_add_test (tc_chain, rtp_h264);
785 tcase_add_test (tc_chain, rtp_h264_list_lt_mtu);
786 tcase_add_test (tc_chain, rtp_h264_list_gt_mtu);
787 tcase_add_test (tc_chain, rtp_L16);
788 tcase_add_test (tc_chain, rtp_mp2t);
789 tcase_add_test (tc_chain, rtp_mp4v);
790 tcase_add_test (tc_chain, rtp_mp4v_list);
791 tcase_add_test (tc_chain, rtp_mp4g);
792 tcase_add_test (tc_chain, rtp_theora);
793 tcase_add_test (tc_chain, rtp_vorbis);
794 tcase_add_test (tc_chain, rtp_jpeg);
795 tcase_add_test (tc_chain, rtp_jpeg_list);
796 tcase_add_test (tc_chain, rtp_g729);
800 GST_CHECK_MAIN (rtp_payloading)