Fix frame_count fps when paused
This commit is contained in:
parent
381fa0d08d
commit
328bd15360
|
@ -89,7 +89,7 @@ void MonitorStream::processCommand(const CmdMsg *msg) {
|
||||||
break;
|
break;
|
||||||
case CMD_PLAY :
|
case CMD_PLAY :
|
||||||
Debug(1, "Got PLAY command");
|
Debug(1, "Got PLAY command");
|
||||||
if ( paused ) {
|
if (paused) {
|
||||||
paused = false;
|
paused = false;
|
||||||
delayed = true;
|
delayed = true;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ void MonitorStream::processCommand(const CmdMsg *msg) {
|
||||||
break;
|
break;
|
||||||
case CMD_VARPLAY :
|
case CMD_VARPLAY :
|
||||||
Debug(1, "Got VARPLAY command");
|
Debug(1, "Got VARPLAY command");
|
||||||
if ( paused ) {
|
if (paused) {
|
||||||
paused = false;
|
paused = false;
|
||||||
delayed = true;
|
delayed = true;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ void MonitorStream::processCommand(const CmdMsg *msg) {
|
||||||
break;
|
break;
|
||||||
case CMD_FASTFWD :
|
case CMD_FASTFWD :
|
||||||
Debug(1, "Got FAST FWD command");
|
Debug(1, "Got FAST FWD command");
|
||||||
if ( paused ) {
|
if (paused) {
|
||||||
paused = false;
|
paused = false;
|
||||||
delayed = true;
|
delayed = true;
|
||||||
}
|
}
|
||||||
|
@ -135,27 +135,27 @@ void MonitorStream::processCommand(const CmdMsg *msg) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CMD_SLOWFWD :
|
case CMD_SLOWFWD :
|
||||||
Debug( 1, "Got SLOW FWD command" );
|
Debug(1, "Got SLOW FWD command");
|
||||||
paused = true;
|
paused = true;
|
||||||
delayed = true;
|
delayed = true;
|
||||||
replay_rate = ZM_RATE_BASE;
|
replay_rate = ZM_RATE_BASE;
|
||||||
step = 1;
|
step = 1;
|
||||||
break;
|
break;
|
||||||
case CMD_SLOWREV :
|
case CMD_SLOWREV :
|
||||||
Debug( 1, "Got SLOW REV command" );
|
Debug(1, "Got SLOW REV command");
|
||||||
paused = true;
|
paused = true;
|
||||||
delayed = true;
|
delayed = true;
|
||||||
replay_rate = ZM_RATE_BASE;
|
replay_rate = ZM_RATE_BASE;
|
||||||
step = -1;
|
step = -1;
|
||||||
break;
|
break;
|
||||||
case CMD_FASTREV :
|
case CMD_FASTREV :
|
||||||
Debug( 1, "Got FAST REV command" );
|
Debug(1, "Got FAST REV command");
|
||||||
if ( paused ) {
|
if (paused) {
|
||||||
paused = false;
|
paused = false;
|
||||||
delayed = true;
|
delayed = true;
|
||||||
}
|
}
|
||||||
// Set play rate
|
// Set play rate
|
||||||
switch ( replay_rate ) {
|
switch (replay_rate) {
|
||||||
case -2 * ZM_RATE_BASE :
|
case -2 * ZM_RATE_BASE :
|
||||||
replay_rate = -5 * ZM_RATE_BASE;
|
replay_rate = -5 * ZM_RATE_BASE;
|
||||||
break;
|
break;
|
||||||
|
@ -637,6 +637,7 @@ void MonitorStream::runStream() {
|
||||||
if (!sendFrame(temp_image_buffer[temp_index].file_name, temp_image_buffer[temp_index].timestamp)) {
|
if (!sendFrame(temp_image_buffer[temp_index].file_name, temp_image_buffer[temp_index].timestamp)) {
|
||||||
zm_terminate = true;
|
zm_terminate = true;
|
||||||
}
|
}
|
||||||
|
frame_count++;
|
||||||
last_frame_timestamp = swap_image->timestamp;
|
last_frame_timestamp = swap_image->timestamp;
|
||||||
// frame_sent = true;
|
// frame_sent = true;
|
||||||
}
|
}
|
||||||
|
@ -655,6 +656,7 @@ void MonitorStream::runStream() {
|
||||||
) {
|
) {
|
||||||
zm_terminate = true;
|
zm_terminate = true;
|
||||||
}
|
}
|
||||||
|
frame_count++;
|
||||||
|
|
||||||
last_frame_timestamp = swap_image->timestamp;
|
last_frame_timestamp = swap_image->timestamp;
|
||||||
// frame_sent = true;
|
// frame_sent = true;
|
||||||
|
@ -670,6 +672,7 @@ void MonitorStream::runStream() {
|
||||||
if (!sendFrame(temp_image_buffer[temp_index].file_name, temp_image_buffer[temp_index].timestamp)) {
|
if (!sendFrame(temp_image_buffer[temp_index].file_name, temp_image_buffer[temp_index].timestamp)) {
|
||||||
zm_terminate = true;
|
zm_terminate = true;
|
||||||
}
|
}
|
||||||
|
frame_count++;
|
||||||
// frame_sent = true;
|
// frame_sent = true;
|
||||||
}
|
}
|
||||||
} // end if (!paused) or step or paused
|
} // end if (!paused) or step or paused
|
||||||
|
@ -684,7 +687,7 @@ void MonitorStream::runStream() {
|
||||||
delayed = false;
|
delayed = false;
|
||||||
replay_rate = ZM_RATE_BASE;
|
replay_rate = ZM_RATE_BASE;
|
||||||
}
|
}
|
||||||
} // end if ( buffered_playback && delayed )
|
} // end if (buffered_playback && delayed)
|
||||||
|
|
||||||
if (last_read_index != monitor->shared_data->last_write_index) {
|
if (last_read_index != monitor->shared_data->last_write_index) {
|
||||||
// have a new image to send
|
// have a new image to send
|
||||||
|
@ -706,6 +709,7 @@ void MonitorStream::runStream() {
|
||||||
zm_terminate = true;
|
zm_terminate = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
frame_count++;
|
||||||
if (frame_count == 0) {
|
if (frame_count == 0) {
|
||||||
// Chrome will not display the first frame until it receives another.
|
// Chrome will not display the first frame until it receives another.
|
||||||
// Firefox is fine. So just send the first frame twice.
|
// Firefox is fine. So just send the first frame twice.
|
||||||
|
@ -728,6 +732,8 @@ void MonitorStream::runStream() {
|
||||||
zm_terminate = true;
|
zm_terminate = true;
|
||||||
if (!sendFrame(paused_image, paused_timestamp))
|
if (!sendFrame(paused_image, paused_timestamp))
|
||||||
zm_terminate = true;
|
zm_terminate = true;
|
||||||
|
frame_count++;
|
||||||
|
frame_count++;
|
||||||
} else {
|
} else {
|
||||||
SystemTimePoint::duration actual_delta_time = now - last_frame_sent;
|
SystemTimePoint::duration actual_delta_time = now - last_frame_sent;
|
||||||
if (actual_delta_time > Seconds(5)) {
|
if (actual_delta_time > Seconds(5)) {
|
||||||
|
@ -738,6 +744,7 @@ void MonitorStream::runStream() {
|
||||||
// Send the next frame
|
// Send the next frame
|
||||||
if (!sendFrame(paused_image, paused_timestamp))
|
if (!sendFrame(paused_image, paused_timestamp))
|
||||||
zm_terminate = true;
|
zm_terminate = true;
|
||||||
|
frame_count++;
|
||||||
} else {
|
} else {
|
||||||
Debug(2, "Would have sent keepalive frame, but had no paused_image");
|
Debug(2, "Would have sent keepalive frame, but had no paused_image");
|
||||||
}
|
}
|
||||||
|
@ -774,7 +781,6 @@ void MonitorStream::runStream() {
|
||||||
Warning("Unable to store frame as shared memory invalid");
|
Warning("Unable to store frame as shared memory invalid");
|
||||||
}
|
}
|
||||||
} // end if buffered playback
|
} // end if buffered playback
|
||||||
frame_count++;
|
|
||||||
} else {
|
} else {
|
||||||
Debug(3, "Waiting for capture last_write_index=%u", monitor->shared_data->last_write_index);
|
Debug(3, "Waiting for capture last_write_index=%u", monitor->shared_data->last_write_index);
|
||||||
} // end if ( (unsigned int)last_read_index != monitor->shared_data->last_write_index )
|
} // end if ( (unsigned int)last_read_index != monitor->shared_data->last_write_index )
|
||||||
|
|
Loading…
Reference in New Issue