Commit 1b69d744 authored by Stefan Westerfeld's avatar Stefan Westerfeld

TESTS: add test for wav-pipe format

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent a7fac00b
CHECKS = detect-speed-test block-decoder-test clip-decoder-test \
pipe-test short-payload-test sync-test sample-rate-test \
key-test
key-test wav-pipe-test
if COND_WITH_FFMPEG
CHECKS += hls-test
......@@ -8,7 +8,7 @@ endif
EXTRA_DIST = detect-speed-test.sh block-decoder-test.sh clip-decoder-test.sh \
pipe-test.sh short-payload-test.sh sync-test.sh sample-rate-test.sh \
key-test.sh hls-test.sh
key-test.sh hls-test.sh wav-pipe-test.sh
check: $(CHECKS)
......@@ -24,6 +24,9 @@ clip-decoder-test:
pipe-test:
Q=1 $(top_srcdir)/tests/pipe-test.sh
wav-pipe-test:
Q=1 $(top_srcdir)/tests/wav-pipe-test.sh
short-payload-test:
Q=1 $(top_srcdir)/tests/short-payload-test.sh
......
......@@ -41,3 +41,12 @@ audiowmark_cmp()
fi
$AUDIOWMARK --strict cmp "$@" > $AUDIOWMARK_OUT || die "failed to detect watermark $@"
}
check_length()
{
local in1=$(audiowmark test-info $1 frames) || die "error detecting length of $1"
local in2=$(audiowmark test-info $2 frames) || die "error detecting length of $2"
[ "x$in1" != "x" ] || die "length of '$1' could not be detected"
[ "x$in1" == "x$in2" ] || die "length of '$1' ($in1) and '$2' ($in2) differs"
}
#!/bin/bash
source test-common.sh
IN_WAV=wav-pipe-test.wav
OUT1_WAV=wav-pipe-test-out1.wav
OUT2_WAV=wav-pipe-test-out2.wav
OUT3_WAV=wav-pipe-test-out3.wav
for BITS in 16 24
do
audiowmark test-gen-noise --bits $BITS $IN_WAV 200 44100
[ "x$BITS" == "x$(audiowmark test-info $IN_WAV bit_depth)" ] || die "generated input bit depth is not correct"
cat $IN_WAV | audiowmark_add --test-key 1 --format wav-pipe - - $TEST_MSG > $OUT1_WAV || die "watermark from pipe failed"
cat $OUT1_WAV | audiowmark_add --test-key 2 --format wav-pipe - - $TEST_MSG > $OUT2_WAV || die "watermark from pipe failed"
cat $OUT2_WAV | audiowmark_add --test-key 3 --format wav-pipe - - $TEST_MSG > $OUT3_WAV || die "watermark from pipe failed"
check_length $IN_WAV $OUT1_WAV
check_length $IN_WAV $OUT2_WAV
check_length $IN_WAV $OUT3_WAV
audiowmark_cmp --expect-matches 0 $OUT3_WAV $TEST_MSG
audiowmark_cmp --expect-matches 5 --test-key 1 $OUT3_WAV $TEST_MSG
audiowmark_cmp --expect-matches 5 --test-key 2 $OUT3_WAV $TEST_MSG
audiowmark_cmp --expect-matches 5 --test-key 3 $OUT3_WAV $TEST_MSG
# for wav-pipe format: 16 bit input should produce 16 bit output; 24 bit input should produce 32 bit output
BTEST=$BITS:$(audiowmark test-info $OUT3_WAV bit_depth)
[[ "$BTEST" =~ ^(16:16|24:32)$ ]] || die "unexpected input/output bit depth $BTEST"
rm $IN_WAV $OUT1_WAV $OUT2_WAV $OUT3_WAV
done
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment