@@ -940,12 +940,13 @@ void EventStream::runStream() {
940
940
Microseconds delta = Microseconds (0 );
941
941
942
942
while (!zm_terminate) {
943
- start = std::chrono::steady_clock::now ();
943
+ now = start = std::chrono::steady_clock::now ();
944
944
945
945
{
946
946
std::scoped_lock lck{mutex};
947
947
948
948
send_frame = false ;
949
+ TimePoint::duration time_since_last_send = now - last_frame_sent;
949
950
950
951
if (!paused) {
951
952
// Figure out if we should send this frame
@@ -964,16 +965,22 @@ void EventStream::runStream() {
964
965
send_frame = true ;
965
966
} else if (!send_frame) {
966
967
// We are paused, not stepping and doing nothing, meaning that comms didn't set send_frame to true
967
- if (now - last_frame_sent > MAX_STREAM_DELAY) {
968
+ if (time_since_last_send > MAX_STREAM_DELAY) {
968
969
// Send keepalive
969
970
Debug (2 , " Sending keepalive frame" );
970
971
send_frame = true ;
972
+ } else {
973
+ Debug (4 , " Not Sending keepalive frame now %.2f - %.2f last = %.2f > Max %.2f" ,
974
+ FPSeconds (now.time_since_epoch ()).count (),
975
+ FPSeconds (last_frame_sent.time_since_epoch ()).count (),
976
+ FPSeconds (time_since_last_send).count (),
977
+ FPSeconds (MAX_STREAM_DELAY).count ()
978
+ );
971
979
}
972
980
} // end if streaming stepping or doing nothing
973
981
974
982
// time_to_event > 0 means that we are not in the event
975
983
if (time_to_event > Seconds (0 ) and mode == MODE_ALL) {
976
- TimePoint::duration time_since_last_send = now - last_frame_sent;
977
984
Debug (1 , " Time since last send = %.2f s" , FPSeconds (time_since_last_send).count ());
978
985
if (time_since_last_send > Seconds (1 )) {
979
986
char frame_text[64 ];
@@ -1069,8 +1076,7 @@ void EventStream::runStream() {
1069
1076
base_fps,
1070
1077
effective_fps);
1071
1078
}
1072
- now = std::chrono::steady_clock::now ();
1073
- TimePoint::duration elapsed = now - start;
1079
+ TimePoint::duration elapsed = std::chrono::steady_clock::now () - start;
1074
1080
delta -= std::chrono::duration_cast<Microseconds>(elapsed); // sending frames takes time, so remove it from the sleep time
1075
1081
1076
1082
Debug (2 , " New delta: %fs from last frame offset %fs - next_frame_offset %fs - elapsed %fs" ,
0 commit comments