lc3: remove bitstream comparison in the tests

since the encoded output is changing based on version
it does not make sense to check the output bitstream with a fixed
bytearray since the version in the target might vary. So sticking
to checking the number of output buffers and encoded frame size
similar to the other tests

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7141>
This commit is contained in:
Taruntej Kanakamalla 2024-07-05 18:17:38 +05:30
parent 3b47b87038
commit f54320b161

View file

@ -100,71 +100,6 @@ static GstStaticPadTemplate dec_sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_ALWAYS,
GST_STATIC_CAPS (RAW_AUDIO_CAPS_STRING));
/* a fixed array of the size `frame-bytes` (i.e. 200)
* contains the first few bytes of the encoded output
* for an input buffer containing all 1's e.g. {'1','1','1','1' ....}
*/
static guint8 lc3_encoded_buff_48K[200] = {
0x16, 0x34, 0x7b, 0x8f, 0x5f, 0xd4, 0xf0, 0xa8, 0x34, 0x7f, 0xd1, 0xc7,
0x55, 0xdc, 0x1a, 0x85, 0x77, 0x8d, 0xb1, 0xb7, 0x78, 0x2c, 0x20, 0x88,
0x87, 0xd3, 0x4d, 0xb7, 0xf5, 0x1a, 0x15, 0x7d, 0xc1, 0xde, 0x25, 0xca,
0x94, 0x80, 0x1d, 0x95, 0xbd, 0xf3, 0x50, 0x01, 0x64, 0xe2, 0x60, 0x28,
0xec, 0xd3, 0xf6, 0x72, 0x2b, 0xf2, 0x6d, 0xf0, 0x83, 0xb4, 0x68, 0x97,
0x7e, 0x6f, 0x49, 0xc6, 0x38, 0x79, 0x9e, 0xa8, 0x49, 0xab, 0xfc, 0xca,
0xb8, 0x5c, 0xc6, 0xa5, 0xd9, 0x6e, 0xb4, 0xd2, 0x6a, 0x79, 0x17, 0x29,
0xac, 0x70, 0x32, 0x6b, 0x13, 0x1b, 0x65, 0xdf, 0xc8, 0x6e, 0x81, 0xa4,
0xe2, 0x8e, 0xd6, 0x4d, 0xe7, 0x30, 0xdc, 0x02, 0x12, 0xbb, 0x8c, 0x4d,
0x11, 0x82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0x6f, 0xf2, 0x1c, 0xc1, 0x10, 0xad, 0xd2, 0x41,
0x55, 0x2a, 0xad, 0x2a, 0x96, 0xab, 0x4a, 0xa5, 0x55, 0xaa, 0xa5, 0x55,
0xaa, 0xaa, 0xaa, 0xad, 0x56, 0x95, 0x56, 0xab, 0x4a, 0xd5, 0xab, 0x4a,
0xd5, 0x68, 0x8b, 0x99, 0x5e, 0xaa, 0x5c, 0x60, 0x83, 0xcd, 0x99, 0x1b,
0x69, 0xf7, 0xd0, 0xfa, 0x04, 0xeb, 0xb8, 0x24, 0xf1, 0x59, 0x00, 0xca,
0x20, 0xe8, 0x38, 0x3c, 0x54, 0xac, 0x08, 0x90, 0x6b, 0x8b, 0x5d, 0x8e,
0x39, 0x55, 0x6c, 0x78, 0xb9, 0xed, 0x00, 0x10, 0xeb, 0x7a, 0x67, 0x97,
0x4c, 0x59, 0xf4, 0xde, 0x4e, 0xc6, 0x21, 0x9f, 0xf0, 0x83, 0x63, 0xd1,
0xa3, 0xe2, 0x28, 0x11, 0x30, 0xa0, 0xf9, 0xa7, 0x6c, 0x38, 0x4c, 0xfb,
0xf0, 0xc3, 0x68, 0x70, 0xa3, 0x6e, 0x3c, 0x4f
};
static guint8 lc3_encoded_buff_24K[200] = {
0x08, 0xb8, 0xd1, 0xf2, 0xa8, 0x25, 0x52, 0x16, 0x75, 0x74, 0xab, 0x3d,
0xae, 0x0f, 0xed, 0x0a, 0xfe, 0x7a, 0xf4, 0x16, 0x85, 0x14, 0x6f, 0x12,
0x42, 0x6f, 0xdc, 0xea, 0x7e, 0x55, 0x01, 0x0c, 0x7d, 0x70, 0x91, 0x9d,
0x42, 0xd9, 0xc2, 0x1e, 0x37, 0xdd, 0x27, 0xb6, 0x6e, 0x21, 0x48, 0xc0,
0x6d, 0xe8, 0x56, 0xe2, 0x62, 0x56, 0x5b, 0x89, 0x0b, 0x5d, 0x4c, 0xc9,
0x1e, 0x37, 0xe8, 0x7f, 0xb3, 0xa4, 0x32, 0xee, 0xce, 0x41, 0x26, 0x46,
0x75, 0x49, 0xec, 0xdd, 0x7e, 0xed, 0x10, 0x84, 0xc8, 0x74, 0xac, 0xbc,
0xff, 0x7b, 0x3b, 0x9e, 0xf8, 0xb7, 0xee, 0x26, 0xe6, 0xa5, 0xc0, 0xfb,
0x4b, 0x2f, 0x90, 0x4c, 0x68, 0x7d, 0x57, 0x2e, 0x5a, 0xba, 0xaa, 0x45,
0xf3, 0xba, 0xae, 0x5c, 0x91, 0xa8, 0xa2, 0x13, 0x74, 0x6c, 0xa2, 0x15,
0x25, 0x6e, 0xb8, 0x26, 0x79, 0x8c, 0x3a, 0xe5, 0x55, 0x55, 0xcd, 0xb4,
0xe5, 0x24, 0xd3, 0xfa, 0x89, 0xb0, 0x33, 0x59, 0x55, 0x45, 0x19, 0x92,
0xad, 0xb2, 0xdb, 0x63, 0xc8, 0x19, 0xae, 0xb2, 0x0e, 0x23, 0xb9, 0x15,
0x37, 0x16, 0xa4, 0xbc, 0xcc, 0xf4, 0x48, 0x4a, 0x50, 0x8e, 0x20, 0xad,
0x8c, 0xb5, 0x9c, 0x45, 0xcd, 0xcc, 0xea, 0xd4, 0xc9, 0xa0, 0xc9, 0xac,
0x57, 0x18, 0x10, 0x9c, 0xc3, 0x1d, 0x2d, 0xb2, 0x87, 0x0c, 0x3b, 0xe9,
0xe3, 0xbf, 0x24, 0x08, 0x47, 0x07, 0x15, 0xde
};
static GstElement *
setup_lc3enc (GstStaticPadTemplate * srctmpl, GstStaticPadTemplate * sinktmpl)
{
@ -215,8 +150,7 @@ get_delay_samples (gint rate, gint frame_duration_us)
}
static void
enc_buffer_test (gint rate, gint channels, gint nbuffers, int frame_dur_us,
guint8 * expected_output)
enc_buffer_test (gint rate, gint channels, gint nbuffers, int frame_dur_us)
{
GstElement *lc3enc;
GstBuffer *inbuffer, *outbuffer;
@ -288,27 +222,17 @@ enc_buffer_test (gint rate, gint channels, gint nbuffers, int frame_dur_us,
for (i = 0; i < num_buffers; ++i) {
GstMapInfo map;
gsize size;
guint8 *data;
outbuffer = GST_BUFFER (buffers->data);
fail_if (outbuffer == NULL);
gst_buffer_map (outbuffer, &map, GST_MAP_READ);
data = map.data;
size = map.size;
/* check the size of each out buffer per channel
* is same as frame_bytes
*/
fail_unless_equals_int (size / channels, frame_bytes);
if (i == 0) {
/* verify the first channel data */
fail_unless (0 == memcmp (data, expected_output, frame_bytes));
/* verify the first channel data */
fail_unless (0 == memcmp (data + (frame_bytes * (channels - 1)),
expected_output, frame_bytes));
}
gst_buffer_unmap (outbuffer, &map);
@ -396,21 +320,21 @@ dec_plc_test (void)
GST_START_TEST (test_48k_8ch_10000us)
{
enc_buffer_test (48000, 8, 100, 10000, lc3_encoded_buff_48K);
enc_buffer_test (48000, 8, 100, 10000);
}
GST_END_TEST;
GST_START_TEST (test_48k_8ch_7500us)
{
enc_buffer_test (48000, 8, 100, 7500, lc3_encoded_buff_48K_7500us);
enc_buffer_test (48000, 8, 100, 7500);
}
GST_END_TEST;
GST_START_TEST (test_24k_4ch_10000us)
{
enc_buffer_test (24000, 4, 150, 10000, lc3_encoded_buff_24K);
enc_buffer_test (24000, 4, 150, 10000);
}
GST_END_TEST;