Rework the logic around waiting for capture to be in both single jpeg mode and streaming.

This commit is contained in:
Isaac Connor 2022-01-01 17:54:20 -05:00
parent fd489c2c8d
commit 8c8a9ca32a
1 changed files with 17 additions and 5 deletions

View File

@ -472,14 +472,26 @@ 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() {
if (type == STREAM_SINGLE) {
// Not yet migrated over to stream class // Notify capture that we might want to view
if (checkInitialised()) { monitor->setLastViewed();
SingleImage(scale);
} else { if (!checkInitialised()) {
if (monitor->Capturing() != Monitor::CAPTURING_ONDEMAND) {
fputs("Content-Type: multipart/x-mixed-replace; boundary=" BOUNDARY "\r\n\r\n", stdout); fputs("Content-Type: multipart/x-mixed-replace; boundary=" BOUNDARY "\r\n\r\n", stdout);
sendTextFrame("Unable to send image"); sendTextFrame("Unable to send image");
return;
} }
while (!zm_terminate && !checkInitialised()) {
Debug(1, "Waiting for capture");
usleep(100000);
monitor->setLastViewed();
}
}
if (type == STREAM_SINGLE) {
// Not yet migrated over to stream class
SingleImage(scale);
return; return;
} }