implement value check & correct on replay_rate for VARPLAY

This commit is contained in:
Isaac Connor 2020-10-05 12:11:11 -04:00
parent 2faedc6248
commit c5459020c9
1 changed files with 7 additions and 0 deletions

View File

@ -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");