tests: opus: Update channel support and add to meson

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8982>
This commit is contained in:
Doug Nazar 2025-05-14 13:54:55 -04:00 committed by GStreamer Marge Bot
parent 6ecf12f019
commit 46e13bca06
2 changed files with 9 additions and 13 deletions

View File

@ -26,15 +26,10 @@
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/check/gstharness.h> #include <gst/check/gstharness.h>
#include <gst/audio/audio.h>
#if G_BYTE_ORDER == G_BIG_ENDIAN
#define AFORMAT "S16BE"
#else
#define AFORMAT "S16LE"
#endif
#define AUDIO_CAPS_STRING "audio/x-raw, " \ #define AUDIO_CAPS_STRING "audio/x-raw, " \
"format = (string) " AFORMAT ", "\ "format = (string) " GST_AUDIO_NE (S16) ", "\
"layout = (string) interleaved, " \ "layout = (string) interleaved, " \
"rate = (int) 48000, " \ "rate = (int) 48000, " \
"channels = (int) 1 " "channels = (int) 1 "
@ -385,19 +380,19 @@ GST_START_TEST (test_opusdec_getcaps)
{ {
/* default result */ /* default result */
run_getcaps_check_from_strings (NULL, NULL, run_getcaps_check_from_strings (NULL, NULL,
"audio/x-opus, rate=(int){48000, 24000, 16000, 12000, 8000}, channels=(int)[1,8]"); "audio/x-opus, rate=(int){48000, 24000, 16000, 12000, 8000}, channels=(int)[1,255]");
/* A single supported rate downstream - should accept any upstream anyway */ /* A single supported rate downstream - should accept any upstream anyway */
run_getcaps_check_from_strings (NULL, "audio/x-raw, rate=(int)8000", run_getcaps_check_from_strings (NULL, "audio/x-raw, rate=(int)8000",
"audio/x-opus, rate=(int){48000, 24000, 16000, 12000, 8000}, channels=(int)[1,8]"); "audio/x-opus, rate=(int){48000, 24000, 16000, 12000, 8000}, channels=(int)[1,255]");
/* Two supported rates (fields as a array, not as a single int) */ /* Two supported rates (fields as a array, not as a single int) */
run_getcaps_check_from_strings (NULL, "audio/x-raw, rate=(int){24000, 8000}", run_getcaps_check_from_strings (NULL, "audio/x-raw, rate=(int){24000, 8000}",
"audio/x-opus, rate=(int){48000, 24000, 16000, 12000, 8000}, channels=(int)[1,8]"); "audio/x-opus, rate=(int){48000, 24000, 16000, 12000, 8000}, channels=(int)[1,255]");
/* One supported and one unsupported rate */ /* One supported and one unsupported rate */
run_getcaps_check_from_strings (NULL, "audio/x-raw, rate=(int){24000, 1000}", run_getcaps_check_from_strings (NULL, "audio/x-raw, rate=(int){24000, 1000}",
"audio/x-opus, rate=(int){48000, 24000, 16000, 12000, 8000}, channels=(int)[1,8]"); "audio/x-opus, rate=(int){48000, 24000, 16000, 12000, 8000}, channels=(int)[1,255]");
/* Unsupported rate */ /* Unsupported rate */
run_getcaps_check_from_strings (NULL, "audio/x-raw, rate=(int)1000", "EMPTY"); run_getcaps_check_from_strings (NULL, "audio/x-raw, rate=(int)1000", "EMPTY");
@ -415,12 +410,12 @@ GST_START_TEST (test_opusdec_getcaps)
/* Formats not acceptable */ /* Formats not acceptable */
run_getcaps_check_from_strings ("audio/x-opus, rate=(int)1000", NULL, run_getcaps_check_from_strings ("audio/x-opus, rate=(int)1000", NULL,
"EMPTY"); "EMPTY");
run_getcaps_check_from_strings ("audio/x-opus, channels=(int)200", NULL, run_getcaps_check_from_strings ("audio/x-opus, channels=(int)300", NULL,
"EMPTY"); "EMPTY");
/* Should restrict the result of the caps query to the selected rate/channels */ /* Should restrict the result of the caps query to the selected rate/channels */
run_getcaps_check_from_strings ("audio/x-opus, rate=(int)8000", NULL, run_getcaps_check_from_strings ("audio/x-opus, rate=(int)8000", NULL,
"audio/x-opus, rate=(int)8000, channels=(int)[1,8]"); "audio/x-opus, rate=(int)8000, channels=(int)[1,255]");
run_getcaps_check_from_strings ("audio/x-opus, channels=(int)2", NULL, run_getcaps_check_from_strings ("audio/x-opus, channels=(int)2", NULL,
"audio/x-opus, rate=(int){48000, 24000, 16000, 12000, 8000}, channels=(int)2"); "audio/x-opus, rate=(int){48000, 24000, 16000, 12000, 8000}, channels=(int)2");
} }

View File

@ -42,6 +42,7 @@ base_tests = [
[ 'elements/audioresample.c', get_option('audioresample').disabled()], [ 'elements/audioresample.c', get_option('audioresample').disabled()],
[ 'elements/compositor.c', get_option('compositor').disabled()], [ 'elements/compositor.c', get_option('compositor').disabled()],
[ 'elements/decodebin.c', get_option('playback').disabled()], [ 'elements/decodebin.c', get_option('playback').disabled()],
[ 'elements/opus.c', not opus_dep.found() ],
[ 'elements/overlaycomposition.c', get_option('overlaycomposition').disabled()], [ 'elements/overlaycomposition.c', get_option('overlaycomposition').disabled()],
[ 'elements/playbin.c', get_option('playback').disabled()], [ 'elements/playbin.c', get_option('playback').disabled()],
[ 'elements/playsink.c', get_option('playback').disabled()], [ 'elements/playsink.c', get_option('playback').disabled()],