aacparse: Add test for correctly parsing the number of channels from codec_data
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9074>
This commit is contained in:
parent
163e9e8df4
commit
48cfd3a6e4
@ -28,6 +28,7 @@
|
||||
#include "parser.h"
|
||||
|
||||
#define SRC_CAPS_CDATA "audio/mpeg, mpegversion=(int)4, framed=(boolean)false, codec_data=(buffer)1190"
|
||||
#define SRC_CAPS_CDATA_6CH "audio/mpeg, mpegversion=(int)4, framed=(boolean)false, codec_data=(buffer)118004c841000108800d4c61766336312e31392e31303156e500,"
|
||||
#define SRC_CAPS_TMPL "audio/mpeg, framed=(boolean)false, mpegversion=(int){2,4}"
|
||||
#define SRC_CAPS_RAW "audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, rate=(int)48000, channels=(int)2, codec_data=(buffer)1190"
|
||||
|
||||
@ -289,6 +290,35 @@ GST_START_TEST (test_parse_handle_codec_data)
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_parse_handle_codec_data_6ch)
|
||||
{
|
||||
GstCaps *caps;
|
||||
GstStructure *s;
|
||||
const gchar *stream_format;
|
||||
|
||||
/* Push random data. It should get through since the parser should be
|
||||
* initialized because it got codec_data in the caps */
|
||||
caps = gst_parser_test_get_output_caps (NULL, 100, SRC_CAPS_CDATA_6CH);
|
||||
fail_unless (caps != NULL);
|
||||
|
||||
/* Check that the negotiated caps are as expected */
|
||||
/* When codec_data is present, parser assumes that data is version 4 */
|
||||
GST_LOG ("aac output caps: %" GST_PTR_FORMAT, caps);
|
||||
s = gst_caps_get_structure (caps, 0);
|
||||
fail_unless (gst_structure_has_name (s, "audio/mpeg"));
|
||||
fail_unless_structure_field_int_equals (s, "mpegversion", 4);
|
||||
fail_unless_structure_field_int_equals (s, "channels", 6);
|
||||
fail_unless_structure_field_int_equals (s, "rate", 48000);
|
||||
fail_unless (gst_structure_has_field (s, "codec_data"));
|
||||
fail_unless (gst_structure_has_field (s, "stream-format"));
|
||||
stream_format = gst_structure_get_string (s, "stream-format");
|
||||
fail_unless (strcmp (stream_format, "raw") == 0);
|
||||
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_parse_proxy_constraints)
|
||||
{
|
||||
GstCaps *caps, *resultcaps;
|
||||
@ -369,6 +399,7 @@ aacparse_suite (void)
|
||||
|
||||
/* Other tests */
|
||||
tcase_add_test (tc_chain, test_parse_handle_codec_data);
|
||||
tcase_add_test (tc_chain, test_parse_handle_codec_data_6ch);
|
||||
|
||||
/* caps tests */
|
||||
tcase_add_test (tc_chain, test_parse_proxy_constraints);
|
||||
|
Loading…
x
Reference in New Issue
Block a user