Send Text frame when unable to connect to the monitor.

This commit is contained in:
Isaac Connor 2020-09-02 16:35:27 -04:00
parent f60d6ff1a3
commit 43e1ac2ad4
1 changed files with 9 additions and 5 deletions

View File

@ -388,7 +388,6 @@ bool MonitorStream::sendFrame(Image *image, struct timeval *timestamp) {
struct timeval frameStartTime; struct timeval frameStartTime;
gettimeofday(&frameStartTime, nullptr); gettimeofday(&frameStartTime, nullptr);
fputs("--ZoneMinderFrame\r\n", stdout);
switch ( type ) { switch ( type ) {
case STREAM_JPEG : case STREAM_JPEG :
send_image->EncodeJpeg(img_buffer, &img_buffer_size); send_image->EncodeJpeg(img_buffer, &img_buffer_size);
@ -452,16 +451,21 @@ void MonitorStream::runStream() {
openComms(); openComms();
if ( type == STREAM_JPEG )
fputs("Content-Type: multipart/x-mixed-replace; boundary=" BOUNDARY "\r\n\r\n", stdout);
if ( !checkInitialised() ) { if ( !checkInitialised() ) {
Error("Not initialized"); Error("Not initialized");
return; while ( !(loadMonitor(monitor_id) || zm_terminate) ) {
sendTextFrame("Not connected");
if ( connkey )
checkCommandQueue();
sleep(1);
}
} }
updateFrameRate(monitor->GetFPS()); updateFrameRate(monitor->GetFPS());
if ( type == STREAM_JPEG )
fputs("Content-Type: multipart/x-mixed-replace; boundary=" BOUNDARY "\r\n\r\n", stdout);
// point to end which is theoretically not a valid value because all indexes are % image_buffer_count // point to end which is theoretically not a valid value because all indexes are % image_buffer_count
unsigned int last_read_index = monitor->image_buffer_count; unsigned int last_read_index = monitor->image_buffer_count;