aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorDeborah Brouwer <deborahbrouwer3563@gmail.com>2021-04-26 20:29:47 -0700
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-04-27 08:03:14 +0200
commit44c27e506c1eec1a011f47cd9f146f4ac7caf14b (patch)
tree7bafe9e90ffaa6ce7c3237d7da2b8ee4b599be20 /utils
parentb36d9f24c14eb7b761d9bdbd636ac65ed5c00232 (diff)
cec-follower: increase precision of Audio Rate Control active sensing
Measure the interval since the last audio rate control message in nanoseconds instead of seconds. Increasing the precision catches audio rate messages that are late by less than a second. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'utils')
-rw-r--r--utils/cec-follower/cec-processing.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp
index 93db4059..fcb55df2 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -29,8 +29,8 @@
/* Time between each polling message sent to a device */
#define POLL_PERIOD 15000
-/* The maximum interval in seconds between audio rate messages as defined in the spec */
-#define MAX_AUD_RATE_MSG_INTERVAL 2
+/* The maximum interval in nanoseconds between audio rate messages as defined in the spec */
+#define MAX_AUD_RATE_MSG_INTERVAL_NS (2 * 1000000000ULL)
struct cec_enum_values {
const char *type_name;
@@ -241,8 +241,8 @@ static void aud_rate_msg_interval_check(__u64 ts_new, __u64 ts_old)
* turned off the audio rate control.
*/
if (ts_old) {
- unsigned interval = (ts_new - ts_old) / 1000000000;
- if (interval > MAX_AUD_RATE_MSG_INTERVAL) {
+ __u64 interval = ts_new - ts_old;
+ if (interval > MAX_AUD_RATE_MSG_INTERVAL_NS) {
warn("The interval between Audio Rate Control messages was greater\n");
warn("than the Maxiumum Audio Rate Message Interval (2s).\n");
}

Privacy Policy