Don't crash when not able to connect to monitor

pull/3750/head
Isaac Connor 2023-08-02 15:11:13 -04:00
parent c510745317
commit a4c14eb890
1 changed files with 4 additions and 5 deletions

View File

@ -456,10 +456,6 @@ bool MonitorStream::sendFrame(Image *image, SystemTimePoint timestamp) {
} // end bool MonitorStream::sendFrame(Image *image, SystemTimePoint timestamp) } // end bool MonitorStream::sendFrame(Image *image, SystemTimePoint timestamp)
void MonitorStream::runStream() { void MonitorStream::runStream() {
// Notify capture that we might want to view
monitor->setLastViewed();
if (type == STREAM_SINGLE) { if (type == STREAM_SINGLE) {
Debug(1, "Single"); Debug(1, "Single");
if (!checkInitialised()) { if (!checkInitialised()) {
@ -468,6 +464,8 @@ void MonitorStream::runStream() {
} else if (monitor->Deleted()) { } else if (monitor->Deleted()) {
sendTextFrame("Monitor has been deleted"); sendTextFrame("Monitor has been deleted");
} else if (monitor->Capturing() == Monitor::CAPTURING_ONDEMAND) { } else if (monitor->Capturing() == Monitor::CAPTURING_ONDEMAND) {
// Notify capture that we might want to view
monitor->setLastViewed();
sendTextFrame("Waiting for capture"); sendTextFrame("Waiting for capture");
} else { } else {
sendTextFrame("Unable to stream"); sendTextFrame("Unable to stream");
@ -563,7 +561,6 @@ void MonitorStream::runStream() {
} }
now = std::chrono::steady_clock::now(); now = std::chrono::steady_clock::now();
monitor->setLastViewed();
bool was_paused = paused; bool was_paused = paused;
if (!checkInitialised()) { if (!checkInitialised()) {
@ -577,6 +574,7 @@ void MonitorStream::runStream() {
zm_terminate = true; zm_terminate = true;
continue; continue;
} else if (monitor->Capturing() == Monitor::CAPTURING_ONDEMAND) { } else if (monitor->Capturing() == Monitor::CAPTURING_ONDEMAND) {
monitor->setLastViewed();
if (!sendTextFrame("Waiting for capture")) return; if (!sendTextFrame("Waiting for capture")) return;
} else { } else {
if (!sendTextFrame("Unable to stream")) { if (!sendTextFrame("Unable to stream")) {
@ -588,6 +586,7 @@ void MonitorStream::runStream() {
std::this_thread::sleep_for(MAX_SLEEP); std::this_thread::sleep_for(MAX_SLEEP);
continue; continue;
} }
monitor->setLastViewed();
if (paused) { if (paused) {
if (!was_paused) { if (!was_paused) {