diff --git a/src/zm_monitorstream.cpp b/src/zm_monitorstream.cpp index a4ce41a47..1509c73ed 100644 --- a/src/zm_monitorstream.cpp +++ b/src/zm_monitorstream.cpp @@ -465,10 +465,12 @@ bool MonitorStream::sendFrame(Image *image, SystemTimePoint timestamp) { void MonitorStream::runStream() { if (type == STREAM_SINGLE) { // Not yet migrated over to stream class - if (checkInitialised()) + if (checkInitialised()) { SingleImage(scale); - else + } else { + fputs("Content-Type: multipart/x-mixed-replace; boundary=" BOUNDARY "\r\n\r\n", stdout); sendTextFrame("Unable to send image"); + } return; } diff --git a/src/zm_stream.cpp b/src/zm_stream.cpp index 38c009b37..5255d3ab2 100644 --- a/src/zm_stream.cpp +++ b/src/zm_stream.cpp @@ -267,8 +267,8 @@ bool StreamBase::sendTextFrame(const char *frame_text) { subpixelorder = monitor->SubpixelOrder(); labelsize = monitor->LabelSize(); } - Debug(2, "Sending %dx%d * %d text frame '%s'", - width, height, scale, frame_text); + Debug(2, "Sending %dx%dx%dx%d * %d scale text frame '%s'", + width, height, colours, subpixelorder, scale, frame_text); Image image(width, height, colours, subpixelorder); image.Clear(); @@ -276,9 +276,10 @@ bool StreamBase::sendTextFrame(const char *frame_text) { if (scale != 100) { image.Scale(scale); + Debug(2, "Scaled to %dx%d", image.Width(), image.Height()); } - if ( type == STREAM_MPEG ) { - if ( !vid_stream ) { + if (type == STREAM_MPEG) { + if (!vid_stream) { vid_stream = new VideoStream("pipe:", format, bitrate, effective_fps, image.Colours(), image.SubpixelOrder(), image.Width(), image.Height()); fprintf(stdout, "Content-type: %s\r\n\r\n", vid_stream->MimeType()); vid_stream->OpenStream(); @@ -289,6 +290,7 @@ bool StreamBase::sendTextFrame(const char *frame_text) { int n_bytes = 0; image.EncodeJpeg(buffer, &n_bytes); + Debug(4, "Encoded to %d bytes", n_bytes); fputs("--" BOUNDARY "\r\nContent-Type: image/jpeg\r\n", stdout); fprintf(stdout, "Content-Length: %d\r\n\r\n", n_bytes); diff --git a/src/zms.cpp b/src/zms.cpp index a5621e02e..dda3791ac 100644 --- a/src/zms.cpp +++ b/src/zms.cpp @@ -265,7 +265,7 @@ int main(int argc, const char *argv[], char **envp) { stream.setStreamQueue(connkey); stream.setStreamBuffer(playback_buffer); if ( !stream.setStreamStart(monitor_id) ) { - Error("Unable set start stream for monitor %d", monitor_id); + fputs("Content-Type: multipart/x-mixed-replace; boundary=" BOUNDARY "\r\n\r\n", stdout); stream.sendTextFrame("Unable to connect to monitor"); logTerm(); zmDbClose();