From c5459020c9b7f5551ef9787fa4589b18cfd3159f Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 5 Oct 2020 12:11:11 -0400 Subject: [PATCH] implement value check & correct on replay_rate for VARPLAY --- src/zm_eventstream.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/zm_eventstream.cpp b/src/zm_eventstream.cpp index a57cebf44..0e28cf0c6 100644 --- a/src/zm_eventstream.cpp +++ b/src/zm_eventstream.cpp @@ -359,6 +359,13 @@ void EventStream::processCommand(const CmdMsg *msg) { paused = false; } replay_rate = ntohs(((unsigned char)msg->msg_data[2]<<8)|(unsigned char)msg->msg_data[1])-32768; + if ( replay_rate > 50 * ZM_RATE_BASE ) { + Warning("requested replay rate (%d) is too high. We only support up to 50x", replay_rate); + replay_rate = 50 * ZM_RATE_BASE; + } else if ( replay_rate < -50*ZM_RATE_BASE ) { + Warning("requested replay rate (%d) is too low. We only support up to -50x", replay_rate); + replay_rate = -50 * ZM_RATE_BASE; + } break; case CMD_STOP : Debug(1, "Got STOP command");