aboutsummaryrefslogtreecommitdiffstats
path: root/utils/cec-compliance/cec-test-audio.cpp
diff options
context:
space:
mode:
authorDeborah Brouwer <deborahbrouwer3563@gmail.com>2021-04-21 20:27:53 -0700
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-04-22 08:54:13 +0200
commit82a21f594712395d46145fb3ccc397047f74c99e (patch)
treee948e1056a707038e224f583657a0c071c2a7b05 /utils/cec-compliance/cec-test-audio.cpp
parent9156821ccac477fc6d8ceb2b88b4818ca4741c4f (diff)
cec: add active sensing test for Audio Rate Control messages
The controlling device should send an Audio Rate Control message at least once every 2 seconds for active sensing. Add a test in cec-compliance to delay the message by more than 2 seconds. Check the interval between messages in cec-follower and warn if the delay is greater than 2 seconds. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'utils/cec-compliance/cec-test-audio.cpp')
-rw-r--r--utils/cec-compliance/cec-test-audio.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/utils/cec-compliance/cec-test-audio.cpp b/utils/cec-compliance/cec-test-audio.cpp
index 4674295b..e1386dbb 100644
--- a/utils/cec-compliance/cec-test-audio.cpp
+++ b/utils/cec-compliance/cec-test-audio.cpp
@@ -851,10 +851,6 @@ const vec_remote_subtests sac_subtests{
/* Audio Rate Control */
-/*
- TODO: These are very rudimentary tests which should be expanded.
- */
-
static int audio_rate_ctl_set_audio_rate(struct node *node, unsigned me, unsigned la, bool interactive)
{
struct cec_msg msg = {};
@@ -875,6 +871,30 @@ static int audio_rate_ctl_set_audio_rate(struct node *node, unsigned me, unsigne
return OK_PRESUMED;
}
+static int audio_rate_ctl_active_sensing(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+ /*
+ * The source shall go back to Rate Control Off if no Set Audio Rate message is
+ * received for more than 2 seconds.
+ */
+ if (!node->remote[la].has_aud_rate)
+ return NOTAPPLICABLE;
+
+ struct cec_msg msg = {};
+
+ cec_msg_init(&msg, me, la);
+
+ /*
+ * Since this subtest runs immediately after Set Audio Rate, delaying the interval
+ * between the two tests is sufficient to test that the Source turns off rate control.
+ */
+ sleep(3);
+ cec_msg_set_audio_rate(&msg, CEC_OP_AUD_RATE_OFF);
+ fail_on_test(!transmit_timeout(node, &msg));
+ fail_on_test_v2(node->remote[la].cec_version, unrecognized_op(&msg));
+ return OK_PRESUMED;
+}
+
const vec_remote_subtests audio_rate_ctl_subtests{
{
"Set Audio Rate",
@@ -882,4 +902,10 @@ const vec_remote_subtests audio_rate_ctl_subtests{
CEC_LOG_ADDR_MASK_TUNER | CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
audio_rate_ctl_set_audio_rate,
},
+ {
+ "Audio Rate Active Sensing",
+ CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD |
+ CEC_LOG_ADDR_MASK_TUNER | CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
+ audio_rate_ctl_active_sensing,
+ },
};

Privacy Policy