3 * unit test for qtdemux
5 * Copyright (C) <2016> Edward Hervey <edward@centricular.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
24 #include <glib/gprintf.h>
30 GstClockTime expected_time;
33 static GstPadProbeReturn
34 qtdemux_probe (GstPad * pad, GstPadProbeInfo * info, CommonTestData * data)
36 if (GST_IS_EVENT (GST_PAD_PROBE_INFO_DATA (info))) {
37 GstEvent *ev = GST_PAD_PROBE_INFO_EVENT (info);
39 switch (GST_EVENT_TYPE (ev)) {
40 case GST_EVENT_SEGMENT:
42 const GstSegment *segment;
43 gst_event_parse_segment (ev, &segment);
44 fail_unless (GST_CLOCK_TIME_IS_VALID (segment->format));
45 fail_unless (GST_CLOCK_TIME_IS_VALID (segment->start));
46 fail_unless (GST_CLOCK_TIME_IS_VALID (segment->base));
47 fail_unless (GST_CLOCK_TIME_IS_VALID (segment->time));
48 fail_unless (GST_CLOCK_TIME_IS_VALID (segment->position));
56 return GST_PAD_PROBE_OK;
57 } else if (GST_IS_BUFFER (GST_PAD_PROBE_INFO_DATA (info))) {
58 GstBuffer *buf = GST_PAD_PROBE_INFO_BUFFER (info);
60 fail_unless_equals_int (gst_buffer_get_size (buf), data->expected_size);
61 fail_unless_equals_uint64 (GST_BUFFER_PTS (buf), data->expected_time);
64 return GST_PAD_PROBE_DROP;
68 qtdemux_pad_added_cb (GstElement * element, GstPad * pad, CommonTestData * data)
71 gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM,
72 (GstPadProbeCallback) qtdemux_probe, data, NULL);
75 GST_START_TEST (test_qtdemux_input_gap)
79 CommonTestData data = { 0, };
86 /* The goal of this test is to check that qtdemux can properly handle
87 * fragmented input from dashdemux, with gaps in it.
92 * - The offset is set on buffers, it corresponds to the offset
93 * within the current fragment.
94 * - Buffer of the beginning of a fragment has the PTS set, others
96 * - By extension, the beginning of a fragment also has an offset
100 qtdemux = gst_element_factory_make ("qtdemux", NULL);
101 gst_element_set_state (qtdemux, GST_STATE_PLAYING);
102 sinkpad = gst_element_get_static_pad (qtdemux, "sink");
104 /* We'll want to know when the source pad is added */
105 g_signal_connect (qtdemux, "pad-added", (GCallback) qtdemux_pad_added_cb,
108 /* Send the initial STREAM_START and segment (TIME) event */
109 event = gst_event_new_stream_start ("TEST");
110 GST_DEBUG ("Pushing stream-start event");
111 fail_unless (gst_pad_send_event (sinkpad, event) == TRUE);
112 gst_segment_init (&segment, GST_FORMAT_TIME);
113 event = gst_event_new_segment (&segment);
114 GST_DEBUG ("Pushing segment event");
115 fail_unless (gst_pad_send_event (sinkpad, event) == TRUE);
117 /* Feed the init buffer, should create the source pad */
118 inbuf = gst_buffer_new_and_alloc (init_mp4_len);
119 gst_buffer_fill (inbuf, 0, init_mp4, init_mp4_len);
120 GST_BUFFER_PTS (inbuf) = 0;
121 GST_BUFFER_OFFSET (inbuf) = 0;
122 GST_DEBUG ("Pushing header buffer");
123 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
125 /* Now send the trun of the first fragment */
126 inbuf = gst_buffer_new_and_alloc (seg_1_moof_size);
127 gst_buffer_fill (inbuf, 0, seg_1_m4f, seg_1_moof_size);
128 GST_BUFFER_PTS (inbuf) = 0;
129 GST_BUFFER_OFFSET (inbuf) = 0;
130 /* We are simulating that this fragment can happen at any point */
131 GST_BUFFER_FLAG_SET (inbuf, GST_BUFFER_FLAG_DISCONT);
132 GST_DEBUG ("Pushing trun buffer");
133 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
134 fail_if (data.srcpad == NULL);
136 /* We are now ready to send some buffers with gaps */
137 offset = seg_1_sample_0_offset;
140 GST_DEBUG ("Pushing gap'ed buffers");
141 for (i = 0; i < 129; i++) {
142 /* Let's send one every 3 */
144 GST_DEBUG ("Pushing buffer #%d offset:%" G_GUINT32_FORMAT, i, offset);
145 inbuf = gst_buffer_new_and_alloc (seg_1_sample_sizes[i]);
146 gst_buffer_fill (inbuf, 0, seg_1_m4f + offset, seg_1_sample_sizes[i]);
147 GST_BUFFER_OFFSET (inbuf) = offset;
148 GST_BUFFER_FLAG_SET (inbuf, GST_BUFFER_FLAG_DISCONT);
150 gst_util_uint64_scale (pts, GST_SECOND, seg_1_timescale);
151 data.expected_size = seg_1_sample_sizes[i];
152 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
154 /* Finally move offset forward */
155 offset += seg_1_sample_sizes[i];
156 pts += seg_1_sample_duration;
159 gst_object_unref (sinkpad);
160 gst_element_set_state (qtdemux, GST_STATE_NULL);
161 gst_object_unref (qtdemux);
170 GstEventType *expected_events;
173 guint expected_num_srcpad;
177 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
180 GST_STATIC_CAPS_ANY);
183 _sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
185 gst_event_unref (event);
190 _sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
192 gst_buffer_unref (buffer);
196 static GstPadProbeReturn
197 qtdemux_block_for_reconfig (GstPad * pad, GstPadProbeInfo * info,
198 ReconfigTestData * data)
200 fail_unless (data->pending_pad);
201 fail_unless (data->pending_pad == pad);
203 GST_DEBUG_OBJECT (pad, "Unblock pad");
205 if (gst_pad_is_linked (data->sinkpad)) {
206 GstPad *peer = gst_pad_get_peer (data->sinkpad);
208 gst_pad_unlink (peer, data->sinkpad);
211 fail_unless (gst_pad_link (data->pending_pad, data->sinkpad) ==
213 data->pending_pad = NULL;
215 return GST_PAD_PROBE_REMOVE;
218 static GstPadProbeReturn
219 qtdemux_probe_for_reconfig (GstPad * pad, GstPadProbeInfo * info,
220 ReconfigTestData * data)
222 GstEvent *event = GST_PAD_PROBE_INFO_EVENT (info);
223 GstEventType expected;
225 if (data->step < data->total_step) {
226 expected = data->expected_events[data->step];
228 expected = GST_EVENT_UNKNOWN;
231 GST_DEBUG ("Got event %p %s", event, GST_EVENT_TYPE_NAME (event));
233 fail_unless (GST_EVENT_TYPE (event) == expected,
234 "Received unexpected event: %s (expected: %s)",
235 GST_EVENT_TYPE_NAME (event), gst_event_type_get_name (expected));
238 if (GST_EVENT_TYPE (event) == GST_EVENT_EOS && data->step < data->total_step) {
239 /* If current EOS is for draining, there should be pending srcpad */
240 fail_unless (data->pending_pad != NULL);
243 return GST_PAD_PROBE_OK;
247 qtdemux_pad_added_cb_for_reconfig (GstElement * element, GstPad * pad,
248 ReconfigTestData * data)
252 fail_unless (data->num_srcpad <= data->expected_num_srcpad);
253 fail_unless (data->pending_pad == NULL);
255 GST_DEBUG_OBJECT (pad, "New pad added");
257 data->pending_pad = pad;
258 gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
259 (GstPadProbeCallback) qtdemux_block_for_reconfig, data, NULL);
261 if (!data->sinkpad) {
262 GstPad *sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
264 gst_pad_set_event_function (sinkpad, _sink_event);
265 gst_pad_set_chain_function (sinkpad, _sink_chain);
267 gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
268 (GstPadProbeCallback) qtdemux_probe_for_reconfig, data, NULL);
269 gst_pad_set_active (sinkpad, TRUE);
270 data->sinkpad = sinkpad;
274 GST_START_TEST (test_qtdemux_duplicated_moov)
278 ReconfigTestData data = { 0, };
282 GstEventType expected[] = {
283 GST_EVENT_STREAM_START,
291 data.expected_events = expected;
292 data.expected_num_srcpad = 1;
293 data.total_step = G_N_ELEMENTS (expected);
295 /* The goal of this test is to check that qtdemux can properly handle
296 * duplicated moov without redundant events and pad exposing
299 * - Push events stream-start and segment to qtdemux
300 * - Push init and media data
301 * - Push the same init and media data again
304 * - Expose srcpad only once
305 * - No additional downstream events when the second init and media data is
309 qtdemux = gst_element_factory_make ("qtdemux", NULL);
310 gst_element_set_state (qtdemux, GST_STATE_PLAYING);
311 sinkpad = gst_element_get_static_pad (qtdemux, "sink");
313 /* We'll want to know when the source pad is added */
314 g_signal_connect (qtdemux, "pad-added", (GCallback)
315 qtdemux_pad_added_cb_for_reconfig, &data);
317 /* Send the initial STREAM_START and segment (TIME) event */
318 event = gst_event_new_stream_start ("TEST");
319 GST_DEBUG ("Pushing stream-start event");
320 fail_unless (gst_pad_send_event (sinkpad, event) == TRUE);
321 gst_segment_init (&segment, GST_FORMAT_TIME);
322 event = gst_event_new_segment (&segment);
323 GST_DEBUG ("Pushing segment event");
324 fail_unless (gst_pad_send_event (sinkpad, event) == TRUE);
326 /* Feed the init buffer, should create the source pad */
327 inbuf = gst_buffer_new_and_alloc (init_mp4_len);
328 gst_buffer_fill (inbuf, 0, init_mp4, init_mp4_len);
329 GST_BUFFER_PTS (inbuf) = 0;
330 GST_BUFFER_OFFSET (inbuf) = 0;
331 GST_DEBUG ("Pushing moov buffer");
332 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
333 fail_if (data.sinkpad == NULL);
334 fail_unless_equals_int (data.num_srcpad, 1);
336 /* Now send the moof and mdat of the first fragment */
337 inbuf = gst_buffer_new_and_alloc (seg_1_m4f_len);
338 gst_buffer_fill (inbuf, 0, seg_1_m4f, seg_1_m4f_len);
339 GST_BUFFER_PTS (inbuf) = 0;
340 GST_BUFFER_OFFSET (inbuf) = 0;
341 GST_DEBUG ("Pushing moof and mdat buffer");
342 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
344 /* Resend the init, moof and mdat, no additional event and pad are expected */
345 inbuf = gst_buffer_new_and_alloc (init_mp4_len);
346 gst_buffer_fill (inbuf, 0, init_mp4, init_mp4_len);
347 GST_BUFFER_PTS (inbuf) = 0;
348 GST_BUFFER_OFFSET (inbuf) = 0;
349 GST_BUFFER_FLAG_SET (inbuf, GST_BUFFER_FLAG_DISCONT);
350 GST_DEBUG ("Pushing moov buffer again");
351 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
352 fail_if (data.sinkpad == NULL);
353 fail_unless_equals_int (data.num_srcpad, 1);
355 inbuf = gst_buffer_new_and_alloc (seg_1_m4f_len);
356 gst_buffer_fill (inbuf, 0, seg_1_m4f, seg_1_m4f_len);
357 GST_BUFFER_PTS (inbuf) = 0;
358 GST_BUFFER_OFFSET (inbuf) = init_mp4_len;
359 GST_DEBUG ("Pushing moof and mdat buffer again");
360 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
361 fail_unless (gst_pad_send_event (sinkpad, gst_event_new_eos ()) == TRUE);
362 fail_unless_equals_int (data.step, data.total_step);
363 fail_unless (data.pending_pad == NULL);
365 gst_object_unref (sinkpad);
366 gst_pad_set_active (data.sinkpad, FALSE);
367 gst_object_unref (data.sinkpad);
368 gst_element_set_state (qtdemux, GST_STATE_NULL);
369 gst_object_unref (qtdemux);
374 GST_START_TEST (test_qtdemux_stream_change)
378 ReconfigTestData data = { 0, };
382 const gchar *upstream_id;
383 const gchar *stream_id = NULL;
384 gchar *expected_stream_id = NULL;
386 GstEventType expected[] = {
388 GST_EVENT_STREAM_START,
393 /* 2nd group (track-id change without upstream stream-start) */
395 GST_EVENT_STREAM_START,
400 /* 3rd group (no track-id change with upstream stream-start) */
402 GST_EVENT_STREAM_START,
407 /* last group (track-id change with upstream stream-start) */
409 GST_EVENT_STREAM_START,
417 data.expected_events = expected;
418 data.expected_num_srcpad = 4;
419 data.total_step = G_N_ELEMENTS (expected);
421 /* The goal of this test is to check that qtdemux can properly handle
422 * stream change regardless of track-id change.
423 * This test is simulating DASH bitrate switching (for both playbin and plabyin3)
424 * and period-change for playbin3
426 * NOTE: During bitrate switching in DASH, track-id might be changed
427 * NOTE: stream change with new stream-start to qtdemux is playbin3 specific behaviour,
428 * because playbin configures new demux per period and existing demux never ever get
429 * new stream-start again.
433 * - Push events stream-start and segment to qtdemux
434 * - Push init and media data to qtdemux
436 * - Push different (track-id change) init and media data to qtdemux
437 * without new downstream sticky events to qtdemux
439 * - Push events stream-start and segment to qtdemux again
440 * - Push the init and media data which are the same as GROUP 2
442 * - Push events stream-start and segment to qtdemux again
443 * - Push different (track-id change) init and media data to qtdemux
446 * - Demux exposes srcpad four times, per test GROUP, regardless of track-id change
447 * - Whenever exposing new pads, downstream sticky events should be detected
451 qtdemux = gst_element_factory_make ("qtdemux", NULL);
452 gst_element_set_state (qtdemux, GST_STATE_PLAYING);
453 sinkpad = gst_element_get_static_pad (qtdemux, "sink");
455 /* We'll want to know when the source pad is added */
456 g_signal_connect (qtdemux, "pad-added", (GCallback)
457 qtdemux_pad_added_cb_for_reconfig, &data);
463 /* Send the initial STREAM_START and segment (TIME) event */
464 upstream_id = "TEST-GROUP-1";
466 expected_stream_id = g_strdup_printf ("%s/%03u", upstream_id, track_id);
467 event = gst_event_new_stream_start (upstream_id);
468 GST_DEBUG ("Pushing stream-start event");
469 fail_unless (gst_pad_send_event (sinkpad, event) == TRUE);
470 gst_segment_init (&segment, GST_FORMAT_TIME);
471 event = gst_event_new_segment (&segment);
472 GST_DEBUG ("Pushing segment event");
473 fail_unless (gst_pad_send_event (sinkpad, event) == TRUE);
475 /* Feed the init buffer, should create the source pad */
476 inbuf = gst_buffer_new_and_alloc (init_mp4_len);
477 gst_buffer_fill (inbuf, 0, init_mp4, init_mp4_len);
478 GST_BUFFER_PTS (inbuf) = 0;
479 GST_BUFFER_OFFSET (inbuf) = 0;
480 GST_DEBUG ("Pushing moov buffer");
481 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
482 fail_if (data.sinkpad == NULL);
483 fail_unless_equals_int (data.num_srcpad, 1);
485 /* Check stream-id */
486 event = gst_pad_get_sticky_event (data.sinkpad, GST_EVENT_STREAM_START, 0);
487 fail_unless (event != NULL);
488 gst_event_parse_stream_start (event, &stream_id);
489 fail_unless_equals_string (stream_id, expected_stream_id);
490 g_free (expected_stream_id);
491 gst_event_unref (event);
493 /* Now send the moof and mdat of the first fragment */
494 inbuf = gst_buffer_new_and_alloc (seg_1_m4f_len);
495 gst_buffer_fill (inbuf, 0, seg_1_m4f, seg_1_m4f_len);
496 GST_BUFFER_PTS (inbuf) = 0;
497 GST_BUFFER_OFFSET (inbuf) = init_mp4_len;
498 GST_DEBUG ("Pushing moof and mdat buffer");
499 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
505 * - track-id change without new upstream stream-start event
507 /* Resend the init */
508 inbuf = gst_buffer_new_and_alloc (BBB_32k_init_mp4_len);
509 gst_buffer_fill (inbuf, 0, BBB_32k_init_mp4, BBB_32k_init_mp4_len);
510 GST_BUFFER_PTS (inbuf) = 0;
511 GST_BUFFER_OFFSET (inbuf) = 0;
512 GST_BUFFER_FLAG_SET (inbuf, GST_BUFFER_FLAG_DISCONT);
513 GST_DEBUG ("Pushing moov buffer again");
514 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
515 fail_if (data.sinkpad == NULL);
516 /* new srcpad should be exposed */
517 fail_unless_equals_int (data.num_srcpad, 2);
519 /* Check stream-id */
520 upstream_id = "TEST-GROUP-1"; /* upstream-id does not changed from GROUP 1 */
521 track_id = 1; /* track-id is changed from 2 to 1 */
522 expected_stream_id = g_strdup_printf ("%s/%03u", upstream_id, track_id);
523 event = gst_pad_get_sticky_event (data.sinkpad, GST_EVENT_STREAM_START, 0);
524 fail_unless (event != NULL);
525 gst_event_parse_stream_start (event, &stream_id);
526 fail_unless_equals_string (stream_id, expected_stream_id);
527 g_free (expected_stream_id);
528 gst_event_unref (event);
530 /* push the moof and mdat again */
531 inbuf = gst_buffer_new_and_alloc (BBB_32k_1_mp4_len);
532 gst_buffer_fill (inbuf, 0, BBB_32k_1_mp4, BBB_32k_1_mp4_len);
533 GST_BUFFER_PTS (inbuf) = 0;
534 GST_BUFFER_OFFSET (inbuf) = BBB_32k_init_mp4_len;
535 GST_DEBUG ("Pushing moof and mdat buffer");
536 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
541 * - Push new stream-start and segment to qtdemux
542 * - Reuse init and media data of GROUP 2 (no track-id change)
544 /* Send STREAM_START and segment (TIME) event */
545 upstream_id = "TEST-GROUP-3";
547 expected_stream_id = g_strdup_printf ("%s/%03u", upstream_id, track_id);
548 event = gst_event_new_stream_start (upstream_id);
549 GST_DEBUG ("Pushing stream-start event");
550 fail_unless (gst_pad_send_event (sinkpad, event) == TRUE);
551 gst_segment_init (&segment, GST_FORMAT_TIME);
552 event = gst_event_new_segment (&segment);
553 GST_DEBUG ("Pushing segment event");
554 fail_unless (gst_pad_send_event (sinkpad, event) == TRUE);
556 /* Resend the init */
557 inbuf = gst_buffer_new_and_alloc (BBB_32k_init_mp4_len);
558 gst_buffer_fill (inbuf, 0, BBB_32k_init_mp4, BBB_32k_init_mp4_len);
559 GST_BUFFER_PTS (inbuf) = 0;
560 GST_BUFFER_OFFSET (inbuf) = 0;
561 GST_BUFFER_FLAG_SET (inbuf, GST_BUFFER_FLAG_DISCONT);
562 GST_DEBUG ("Pushing moov buffer again");
563 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
564 fail_if (data.sinkpad == NULL);
565 /* new srcpad should be exposed */
566 fail_unless_equals_int (data.num_srcpad, 3);
568 /* Check stream-id */
569 event = gst_pad_get_sticky_event (data.sinkpad, GST_EVENT_STREAM_START, 0);
570 fail_unless (event != NULL);
571 gst_event_parse_stream_start (event, &stream_id);
572 fail_unless_equals_string (stream_id, expected_stream_id);
573 g_free (expected_stream_id);
574 gst_event_unref (event);
576 /* push the moof and mdat again */
577 inbuf = gst_buffer_new_and_alloc (BBB_32k_1_mp4_len);
578 gst_buffer_fill (inbuf, 0, BBB_32k_1_mp4, BBB_32k_1_mp4_len);
579 GST_BUFFER_PTS (inbuf) = 0;
580 GST_BUFFER_OFFSET (inbuf) = BBB_32k_init_mp4_len;
581 GST_DEBUG ("Pushing moof and mdat buffer");
582 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
587 * - Push new stream-start and segment to qtdemux
588 * - track-id change from 1 to 2
590 /* Send STREAM_START and segment (TIME) event */
591 upstream_id = "TEST-GROUP-4";
593 expected_stream_id = g_strdup_printf ("%s/%03u", upstream_id, track_id);
594 event = gst_event_new_stream_start (upstream_id);
595 GST_DEBUG ("Pushing stream-start event");
596 fail_unless (gst_pad_send_event (sinkpad, event) == TRUE);
597 gst_segment_init (&segment, GST_FORMAT_TIME);
598 event = gst_event_new_segment (&segment);
599 GST_DEBUG ("Pushing segment event");
600 fail_unless (gst_pad_send_event (sinkpad, event) == TRUE);
602 /* Resend the init */
603 inbuf = gst_buffer_new_and_alloc (init_mp4_len);
604 gst_buffer_fill (inbuf, 0, init_mp4, init_mp4_len);
605 GST_BUFFER_PTS (inbuf) = 0;
606 GST_BUFFER_OFFSET (inbuf) = 0;
607 GST_BUFFER_FLAG_SET (inbuf, GST_BUFFER_FLAG_DISCONT);
608 GST_DEBUG ("Pushing moov buffer again");
609 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
610 fail_if (data.sinkpad == NULL);
611 /* new srcpad should be exposed */
612 fail_unless_equals_int (data.num_srcpad, 4);
614 /* Check stream-id */
615 event = gst_pad_get_sticky_event (data.sinkpad, GST_EVENT_STREAM_START, 0);
616 fail_unless (event != NULL);
617 gst_event_parse_stream_start (event, &stream_id);
618 fail_unless_equals_string (stream_id, expected_stream_id);
619 g_free (expected_stream_id);
620 gst_event_unref (event);
622 /* push the moof and mdat again */
623 inbuf = gst_buffer_new_and_alloc (seg_1_m4f_len);
624 gst_buffer_fill (inbuf, 0, seg_1_m4f, seg_1_m4f_len);
625 GST_BUFFER_PTS (inbuf) = 0;
626 GST_BUFFER_OFFSET (inbuf) = init_mp4_len;
627 GST_DEBUG ("Pushing moof and mdat buffer again");
628 fail_unless (gst_pad_chain (sinkpad, inbuf) == GST_FLOW_OK);
629 fail_unless (gst_pad_send_event (sinkpad, gst_event_new_eos ()) == TRUE);
630 fail_unless_equals_int (data.step, data.total_step);
631 fail_unless (data.pending_pad == NULL);
633 gst_object_unref (sinkpad);
634 gst_pad_set_active (data.sinkpad, FALSE);
635 gst_object_unref (data.sinkpad);
636 gst_element_set_state (qtdemux, GST_STATE_NULL);
637 gst_object_unref (qtdemux);
645 Suite *s = suite_create ("qtdemux");
646 TCase *tc_chain = tcase_create ("general");
648 suite_add_tcase (s, tc_chain);
649 tcase_add_test (tc_chain, test_qtdemux_input_gap);
650 tcase_add_test (tc_chain, test_qtdemux_duplicated_moov);
651 tcase_add_test (tc_chain, test_qtdemux_stream_change);
656 GST_CHECK_MAIN (qtdemux)