diff --git a/src/zm_monitorstream.cpp b/src/zm_monitorstream.cpp index 4ce0eebeb..d4d387219 100644 --- a/src/zm_monitorstream.cpp +++ b/src/zm_monitorstream.cpp @@ -460,18 +460,19 @@ bool MonitorStream::sendFrame(Image *image, SystemTimePoint timestamp) { } // Not mpeg - TimePoint send_end_time = std::chrono::steady_clock::now(); - TimePoint::duration frame_send_time = send_end_time - send_start_time; - TimePoint::duration maxfps_milliseconds = Milliseconds(lround(Milliseconds::period::den / maxfps)); + last_frame_sent = std::chrono::steady_clock::now(); + if (maxfps) { + TimePoint::duration frame_send_time = last_frame_sent - send_start_time; + TimePoint::duration maxfps_milliseconds = Milliseconds(lround(Milliseconds::period::den / maxfps)); - if (frame_send_time > maxfps_milliseconds) { - //maxfps /= 1.5; - Warning("Frame send time %" PRIi64 " msec too slow (> %" PRIi64 ", throttling maxfps to %.3f", - static_cast(std::chrono::duration_cast(frame_send_time).count()), - static_cast(std::chrono::duration_cast(maxfps_milliseconds).count()), - maxfps); + if (frame_send_time > maxfps_milliseconds) { + //maxfps /= 1.5; + Warning("Frame send time %" PRIi64 " msec too slow (> %" PRIi64 ", throttling maxfps to %.3f", + static_cast(std::chrono::duration_cast(frame_send_time).count()), + static_cast(std::chrono::duration_cast(maxfps_milliseconds).count()), + maxfps); + } } - last_frame_sent = send_end_time; return true; } // end bool MonitorStream::sendFrame(Image *image, SystemTimePoint timestamp) diff --git a/web/ajax/stream.php b/web/ajax/stream.php index 2557977ca..ade101845 100644 --- a/web/ajax/stream.php +++ b/web/ajax/stream.php @@ -1,5 +1,5 @@ $data)); break; default : - ajaxError("Unexpected received message type '$type'"); + ajaxError('Unexpected received message type '.$data['type']); } sem_release($semaphore); } else { - ZM\Debug('Couldn\'t get semaphore'); - ajaxResponse(array()); + ajaxError("Unable to get semaphore."); } ajaxError('Unrecognised action or insufficient permissions in ajax/stream'); diff --git a/web/skins/classic/views/js/watch.js.php b/web/skins/classic/views/js/watch.js.php index 04a6c0757..be8065d12 100644 --- a/web/skins/classic/views/js/watch.js.php +++ b/web/skins/classic/views/js/watch.js.php @@ -60,16 +60,16 @@ var mode = ""; var monitorData = new Array(); monitorData[monitorData.length] = { - 'id': Id() ?>, - 'width': ViewWidth() ?>, - 'height':ViewHeight() ?>, - 'url': 'UrlToIndex() ?>', - 'onclick': function(){window.location.assign( '?view=watch&mid=Id() ?>' );}, - 'type': 'Type() ?>', - 'refresh': 'Refresh() ?>' + 'id': Id() ?>, + 'width': ViewWidth() ?>, + 'height':ViewHeight() ?>, + 'url': 'UrlToIndex() ?>', + 'onclick': function(){window.location.assign( '?view=watch&mid=Id() ?>' );}, + 'type': 'Type() ?>', + 'refresh': 'Refresh() ?>' }; ; var labels = new Array(); Id())) as $row) { $label = $labels[$row['Preset']] = $row['Label']; - echo 'labels['. validInt($index) .'] = \''.validJsStr($label).'\''; + echo 'labels['. validInt($row['Preset']) .'] = \''.validJsStr($label).'\';'.PHP_EOL; } ?> var deleteString = "";