tests: audioconvert: test caps fixate with layout conversion

https://bugzilla.gnome.org/show_bug.cgi?id=797225
This commit is contained in:
George Kiagiadakis 2018-10-05 15:37:45 +03:00
parent 18f082a0d8
commit a85a59e4a8

View file

@ -1775,6 +1775,55 @@ GST_START_TEST (test_layout_conversion)
GST_END_TEST;
GST_START_TEST (test_layout_conv_fixate_caps)
{
GstCaps *incaps, *outcaps;
GstElement *audioconvert;
GstCaps *caps;
GstStructure *s;
incaps = gst_caps_from_string ("audio/x-raw, "
"format = (string) F32LE, "
"layout = (string) interleaved, "
"rate = (int) 44100, "
"channels = (int) 1");
outcaps = gst_caps_from_string ("audio/x-raw, "
"format = (string) S16LE, "
"layout = (string) interleaved, "
"rate = (int) [ 1, MAX ], "
"channels = (int) 2;"
"audio/x-raw, "
"format = (string) { F32LE, F32BE, F64LE, F64BE }, "
"layout = (string) non-interleaved, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [1, 8]");
audioconvert = setup_audioconvert (outcaps);
fail_unless (gst_element_set_state (audioconvert,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
gst_check_setup_events (mysrcpad, audioconvert, incaps, GST_FORMAT_TIME);
caps = gst_pad_get_current_caps (mysinkpad);
s = gst_caps_get_structure (caps, 0);
assert_equals_string (gst_structure_get_string (s, "format"), "F32LE");
assert_equals_string (gst_structure_get_string (s, "layout"),
"non-interleaved");
fail_unless (gst_element_set_state (audioconvert,
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
/* cleanup */
GST_DEBUG ("cleanup audioconvert");
cleanup_audioconvert (audioconvert);
GST_DEBUG ("cleanup, unref incaps");
gst_caps_unref (incaps);
gst_caps_unref (outcaps);
}
GST_END_TEST;
static Suite *
audioconvert_suite (void)
{
@ -1794,6 +1843,7 @@ audioconvert_suite (void)
tcase_add_test (tc_chain, test_preserve_width);
tcase_add_test (tc_chain, test_gap_buffers);
tcase_add_test (tc_chain, test_layout_conversion);
tcase_add_test (tc_chain, test_layout_conv_fixate_caps);
return s;
}