summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <jsteffens@make.tv>2018-01-18 15:09:04 +0100
committerTim-Philipp Müller <tim@centricular.com>2018-01-18 19:09:25 +0000
commit54f312644e5240d10e089cbd65c5e8633c9d1b05 (patch)
tree0325e120217f9c11e8aa66cf60816653d720c9e9 /tests
parente273e5f7a6295425fe9749724ff5b95c751842ed (diff)
tests: aacparser: Test that short raw frames don't get concatenated
https://bugzilla.gnome.org/show_bug.cgi?id=792644
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/aacparse.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/check/elements/aacparse.c b/tests/check/elements/aacparse.c
index 9022886e2..ea9fd7e2b 100644
--- a/tests/check/elements/aacparse.c
+++ b/tests/check/elements/aacparse.c
@@ -24,10 +24,12 @@
*/
#include <gst/check/gstcheck.h>
+#include <gst/check/check.h>
#include "parser.h"
#define SRC_CAPS_CDATA "audio/mpeg, mpegversion=(int)4, framed=(boolean)false, codec_data=(buffer)1190"
#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"
#define SINK_CAPS \
"audio/mpeg, framed=(boolean)true"
@@ -68,6 +70,10 @@ static guint8 garbage_frame[] = {
0xff, 0xff, 0xff, 0xff, 0xff
};
+static guint8 raw_frame_short[] = {
+ 0x27, 0x00, 0x03, 0x20, 0x64, 0x1c
+};
+
/*
* Test if the parser pushes data with ADIF header properly and detects the
* stream to MPEG4 properly.
@@ -151,6 +157,36 @@ GST_START_TEST (test_parse_adts_detect_mpeg_version)
GST_END_TEST;
+/*
+ * Test if the parser correctly handles short raw frames and doesn't
+ * concatenate them.
+ */
+GST_START_TEST (test_parse_raw_short)
+{
+ GstHarness *h = gst_harness_new ("aacparse");
+ GstBuffer *in_buf;
+
+ g_object_set (h->element, "disable-passthrough", TRUE, NULL);
+ gst_harness_set_src_caps_str (h, SRC_CAPS_RAW);
+
+ in_buf = gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY,
+ raw_frame_short, sizeof raw_frame_short, 0, sizeof raw_frame_short,
+ NULL, NULL);
+
+ gst_harness_push (h, gst_buffer_ref (in_buf));
+ fail_unless_equals_int (gst_harness_buffers_received (h), 1);
+
+ gst_harness_push (h, in_buf);
+ fail_unless_equals_int (gst_harness_buffers_received (h), 2);
+
+ gst_harness_push_event (h, gst_event_new_eos ());
+ fail_unless_equals_int (gst_harness_buffers_received (h), 2);
+
+ gst_harness_teardown (h);
+}
+
+GST_END_TEST;
+
#define structure_get_int(s,f) \
(g_value_get_int(gst_structure_get_value(s,f)))
#define fail_unless_structure_field_int_equals(s,field,num) \
@@ -261,6 +297,9 @@ aacparse_suite (void)
tcase_add_test (tc_chain, test_parse_adts_skip_garbage);
tcase_add_test (tc_chain, test_parse_adts_detect_mpeg_version);
+ /* Raw tests */
+ tcase_add_test (tc_chain, test_parse_raw_short);
+
/* Other tests */
tcase_add_test (tc_chain, test_parse_handle_codec_data);