test: qtmux: Tests qtmux reuse
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>
Thu, 13 Jan 2011 14:28:32 +0000 (11:28 -0300)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Tue, 12 Apr 2011 19:32:21 +0000 (20:32 +0100)
Forces the use of qtmux after it has been put to PLAYING and back
to NULL once

https://bugzilla.gnome.org/show_bug.cgi?id=639338

tests/check/elements/qtmux.c

index 69816f7..1db618c 100644 (file)
@@ -355,6 +355,36 @@ GST_START_TEST (test_audio_pad_frag_streamable)
 GST_END_TEST;
 
 
+GST_START_TEST (test_reuse)
+{
+  GstElement *qtmux = setup_qtmux (&srcvideotemplate, "video_%d");
+  GstBuffer *inbuffer;
+  GstCaps *caps;
+
+  gst_element_set_state (qtmux, GST_STATE_PLAYING);
+  gst_element_set_state (qtmux, GST_STATE_NULL);
+  gst_element_set_state (qtmux, GST_STATE_PLAYING);
+  gst_pad_set_active (mysrcpad, TRUE);
+  gst_pad_set_active (mysinkpad, TRUE);
+
+  inbuffer = gst_buffer_new_and_alloc (1);
+  fail_unless (inbuffer != NULL);
+  caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
+  gst_buffer_set_caps (inbuffer, caps);
+  gst_caps_unref (caps);
+  GST_BUFFER_TIMESTAMP (inbuffer) = 0;
+  GST_BUFFER_DURATION (inbuffer) = 40 * GST_MSECOND;
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+  fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+
+  /* send eos to have all written */
+  fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE);
+
+  cleanup_qtmux (qtmux, "video_%d");
+}
+
+GST_END_TEST;
+
 static Suite *
 qtmux_suite (void)
 {
@@ -369,6 +399,8 @@ qtmux_suite (void)
   tcase_add_test (tc_chain, test_video_pad_frag_streamable);
   tcase_add_test (tc_chain, test_audio_pad_frag_streamable);
 
+  tcase_add_test (tc_chain, test_reuse);
+
   return s;
 }