mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-03 13:02:29 +00:00
tests: aacparser: Test that short raw frames don't get concatenated
https://bugzilla.gnome.org/show_bug.cgi?id=792644
This commit is contained in:
parent
e273e5f7a6
commit
54f312644e
1 changed files with 39 additions and 0 deletions
|
@ -24,10 +24,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
#include <gst/check/check.h>
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
|
||||||
#define SRC_CAPS_CDATA "audio/mpeg, mpegversion=(int)4, framed=(boolean)false, codec_data=(buffer)1190"
|
#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_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 \
|
#define SINK_CAPS \
|
||||||
"audio/mpeg, framed=(boolean)true"
|
"audio/mpeg, framed=(boolean)true"
|
||||||
|
@ -68,6 +70,10 @@ static guint8 garbage_frame[] = {
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff
|
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
|
* Test if the parser pushes data with ADIF header properly and detects the
|
||||||
* stream to MPEG4 properly.
|
* stream to MPEG4 properly.
|
||||||
|
@ -151,6 +157,36 @@ GST_START_TEST (test_parse_adts_detect_mpeg_version)
|
||||||
|
|
||||||
GST_END_TEST;
|
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) \
|
#define structure_get_int(s,f) \
|
||||||
(g_value_get_int(gst_structure_get_value(s,f)))
|
(g_value_get_int(gst_structure_get_value(s,f)))
|
||||||
#define fail_unless_structure_field_int_equals(s,field,num) \
|
#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_skip_garbage);
|
||||||
tcase_add_test (tc_chain, test_parse_adts_detect_mpeg_version);
|
tcase_add_test (tc_chain, test_parse_adts_detect_mpeg_version);
|
||||||
|
|
||||||
|
/* Raw tests */
|
||||||
|
tcase_add_test (tc_chain, test_parse_raw_short);
|
||||||
|
|
||||||
/* Other tests */
|
/* Other tests */
|
||||||
tcase_add_test (tc_chain, test_parse_handle_codec_data);
|
tcase_add_test (tc_chain, test_parse_handle_codec_data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue