Commit 6bb7fdf4 authored by Mark Nauwelaerts's avatar Mark Nauwelaerts
Browse files

tests: arrange for sending an initial segment event

... which is needed nowadays since various gst_segment_to_...
no longer automatically set the format to the specified one
(from _UNDEFINED).
parent d7caf1db
......@@ -108,6 +108,7 @@ GST_START_TEST (test_32_bp_0hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandpass */
......@@ -131,6 +132,10 @@ GST_START_TEST (test_32_bp_0hz)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -178,6 +183,7 @@ GST_START_TEST (test_32_bp_11025hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandpass */
......@@ -209,6 +215,10 @@ GST_START_TEST (test_32_bp_11025hz)
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
......@@ -249,6 +259,7 @@ GST_START_TEST (test_32_bp_22050hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandpass */
......@@ -273,6 +284,10 @@ GST_START_TEST (test_32_bp_22050hz)
}
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -317,6 +332,7 @@ GST_START_TEST (test_32_br_0hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandreject */
......@@ -339,6 +355,10 @@ GST_START_TEST (test_32_br_0hz)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -383,6 +403,7 @@ GST_START_TEST (test_32_br_11025hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandreject */
......@@ -410,6 +431,10 @@ GST_START_TEST (test_32_br_11025hz)
}
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -455,6 +480,7 @@ GST_START_TEST (test_32_br_22050hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandreject */
......@@ -479,6 +505,10 @@ GST_START_TEST (test_32_br_22050hz)
}
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -521,6 +551,7 @@ GST_START_TEST (test_32_small_buffer)
gfloat *in;
gint i;
GstMapInfo map;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandpass */
......@@ -543,6 +574,10 @@ GST_START_TEST (test_32_small_buffer)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -580,6 +615,7 @@ GST_START_TEST (test_64_bp_0hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandpass */
......@@ -602,6 +638,10 @@ GST_START_TEST (test_64_bp_0hz)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -646,6 +686,7 @@ GST_START_TEST (test_64_bp_11025hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandpass */
......@@ -672,6 +713,10 @@ GST_START_TEST (test_64_bp_11025hz)
}
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -717,6 +762,7 @@ GST_START_TEST (test_64_bp_22050hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandpass */
......@@ -741,6 +787,10 @@ GST_START_TEST (test_64_bp_22050hz)
}
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -785,6 +835,7 @@ GST_START_TEST (test_64_br_0hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandreject */
......@@ -807,6 +858,10 @@ GST_START_TEST (test_64_br_0hz)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -851,6 +906,7 @@ GST_START_TEST (test_64_br_11025hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandreject */
......@@ -878,6 +934,10 @@ GST_START_TEST (test_64_br_11025hz)
}
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -923,6 +983,7 @@ GST_START_TEST (test_64_br_22050hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandreject */
......@@ -947,6 +1008,10 @@ GST_START_TEST (test_64_br_22050hz)
}
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -989,6 +1054,7 @@ GST_START_TEST (test_64_small_buffer)
gdouble *in;
gint i;
GstMapInfo map;
GstSegment segment;
audiowsincband = setup_audiowsincband ();
/* Set to bandpass */
......@@ -1011,6 +1077,10 @@ GST_START_TEST (test_64_small_buffer)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......
......@@ -108,6 +108,7 @@ GST_START_TEST (test_32_lp_0hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsinclimit = setup_audiowsinclimit ();
/* Set to lowpass */
......@@ -128,6 +129,10 @@ GST_START_TEST (test_32_lp_0hz)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -173,6 +178,7 @@ GST_START_TEST (test_32_lp_22050hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsinclimit = setup_audiowsinclimit ();
/* Set to lowpass */
......@@ -194,6 +200,10 @@ GST_START_TEST (test_32_lp_22050hz)
}
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -239,6 +249,7 @@ GST_START_TEST (test_32_hp_0hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsinclimit = setup_audiowsinclimit ();
/* Set to highpass */
......@@ -258,6 +269,10 @@ GST_START_TEST (test_32_hp_0hz)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -303,6 +318,7 @@ GST_START_TEST (test_32_hp_22050hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsinclimit = setup_audiowsinclimit ();
/* Set to highpass */
......@@ -324,6 +340,10 @@ GST_START_TEST (test_32_hp_22050hz)
}
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -368,6 +388,7 @@ GST_START_TEST (test_32_small_buffer)
gfloat *in;
gint i;
GstMapInfo map;
GstSegment segment;
audiowsinclimit = setup_audiowsinclimit ();
/* Set to lowpass */
......@@ -387,6 +408,10 @@ GST_START_TEST (test_32_small_buffer)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -417,6 +442,7 @@ GST_START_TEST (test_64_lp_0hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsinclimit = setup_audiowsinclimit ();
/* Set to lowpass */
......@@ -437,6 +463,10 @@ GST_START_TEST (test_64_lp_0hz)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -482,6 +512,7 @@ GST_START_TEST (test_64_lp_22050hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsinclimit = setup_audiowsinclimit ();
/* Set to lowpass */
......@@ -503,6 +534,10 @@ GST_START_TEST (test_64_lp_22050hz)
}
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -548,6 +583,7 @@ GST_START_TEST (test_64_hp_0hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsinclimit = setup_audiowsinclimit ();
/* Set to highpass */
......@@ -567,6 +603,10 @@ GST_START_TEST (test_64_hp_0hz)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -612,6 +652,7 @@ GST_START_TEST (test_64_hp_22050hz)
gint i;
GstMapInfo map;
GList *node;
GstSegment segment;
audiowsinclimit = setup_audiowsinclimit ();
/* Set to highpass */
......@@ -633,6 +674,10 @@ GST_START_TEST (test_64_hp_22050hz)
}
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......@@ -677,6 +722,7 @@ GST_START_TEST (test_64_small_buffer)
gdouble *in;
gint i;
GstMapInfo map;
GstSegment segment;
audiowsinclimit = setup_audiowsinclimit ();
/* Set to lowpass */
......@@ -696,6 +742,10 @@ GST_START_TEST (test_64_small_buffer)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, &map);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
......
......@@ -161,12 +161,17 @@ check_avimux_pad (GstStaticPadTemplate * srctemplate,
guint8 data5[4] = "strf";
guint8 data6[4] = "LIST";
guint8 data7[4] = "movi";
GstSegment segment;
avimux = setup_avimux (srctemplate, sinkname);
fail_unless (gst_element_set_state (avimux,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
inbuffer = gst_buffer_new_and_alloc (1);
caps = gst_caps_from_string (src_caps_string);
gst_pad_set_caps (mysrcpad, caps);
......
......@@ -195,6 +195,7 @@ check_qtmux_pad (GstStaticPadTemplate * srctemplate, const gchar * sinkname,
guint8 data0[12] = "\000\000\000\024ftypqt ";
guint8 data1[8] = "\000\000\000\001mdat";
guint8 data2[4] = "moov";
GstSegment segment;
qtmux = setup_qtmux (srctemplate, sinkname);
g_object_set (qtmux, "dts-method", dts_method, NULL);
......@@ -202,6 +203,10 @@ check_qtmux_pad (GstStaticPadTemplate * srctemplate, const gchar * sinkname,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
inbuffer = gst_buffer_new_and_alloc (1);
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
gst_pad_set_caps (mysrcpad, caps);
......@@ -275,6 +280,7 @@ check_qtmux_pad_fragmented (GstStaticPadTemplate * srctemplate,
guint8 data2[4] = "moov";
guint8 data3[4] = "moof";
guint8 data4[4] = "mfra";
GstSegment segment;
qtmux = setup_qtmux (srctemplate, sinkname);
g_object_set (qtmux, "dts-method", dts_method, NULL);
......@@ -284,6 +290,10 @@ check_qtmux_pad_fragmented (GstStaticPadTemplate * srctemplate,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
inbuffer = gst_buffer_new_and_alloc (1);
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
gst_pad_set_caps (mysrcpad, caps);
......@@ -500,6 +510,7 @@ GST_START_TEST (test_reuse)
GstElement *qtmux = setup_qtmux (&srcvideotemplate, "video_%u");
GstBuffer *inbuffer;
GstCaps *caps;
GstSegment segment;
gst_element_set_state (qtmux, GST_STATE_PLAYING);
gst_element_set_state (qtmux, GST_STATE_NULL);
......@@ -507,6 +518,10 @@ GST_START_TEST (test_reuse)
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
inbuffer = gst_buffer_new_and_alloc (1);
fail_unless (inbuffer != NULL);
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
......@@ -774,6 +789,7 @@ test_average_bitrate_custom (const gchar * elementname,
gint64 durations[] = { GST_SECOND * 3, GST_SECOND * 5, GST_SECOND * 2 };
gint64 total_bytes = 0;
GstClockTime total_duration = 0;
GstSegment segment;
location = g_strdup_printf ("%s/%s-%d", g_get_tmp_dir (), "qtmuxtest",
g_random_int ());
......@@ -793,6 +809,10 @@ test_average_bitrate_custom (const gchar * elementname,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
/* ensure segment (format) properly setup */
gst_segment_init (&segment, GST_FORMAT_TIME);
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
for (i = 0; i < 3; i++) {
inbuffer = gst_buffer_new_and_alloc (bytes[i]);
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment