diff --git a/.github/workflows/create-packages.yml b/.github/workflows/create-packages.yml index 93279cc57..e62c5aec1 100644 --- a/.github/workflows/create-packages.yml +++ b/.github/workflows/create-packages.yml @@ -2,8 +2,7 @@ name: Create packages on: push: - branches: - - '*' + branches: [ master ] pull_request: branches: [ master ] diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 23efda05a..750f09570 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -2013,14 +2013,14 @@ bool Monitor::Analyse() { } else { event->addNote(SIGNAL_CAUSE, "Reacquired"); } - if (snap->in_frame && ( + if (0 and snap->in_frame && ( ((AVPixelFormat)snap->in_frame->format == AV_PIX_FMT_YUV420P) || ((AVPixelFormat)snap->in_frame->format == AV_PIX_FMT_YUVJ420P) ) ) { Debug(1, "assigning refimage from v-channel"); Image v_image(snap->in_frame->width, - snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[2], 0); + snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[0], 0); ref_image.Assign(v_image); } else if (snap->image) { Debug(1, "assigning refimage from snap->image"); @@ -2104,13 +2104,13 @@ bool Monitor::Analyse() { // decoder may not have been able to provide an image if (!ref_image.Buffer()) { Debug(1, "Assigning instead of Detecting"); - if (snap->in_frame && ( + if (0 and snap->in_frame && ( ((AVPixelFormat)snap->in_frame->format == AV_PIX_FMT_YUV420P) || ((AVPixelFormat)snap->in_frame->format == AV_PIX_FMT_YUVJ420P) ) ) { Debug(1, "assigning refimage from v-channel"); - Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[2], 0); + Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[0], 0); ref_image.Assign(v_image); } else { Debug(1, "assigning refimage from snap->image"); @@ -2120,12 +2120,12 @@ bool Monitor::Analyse() { } else if (!(analysis_image_count % (motion_frame_skip+1))) { Debug(1, "Detecting motion on image %d, image %p", snap->image_index, snap->image); // Get new score. - if (snap->in_frame && ( + if (0 and snap->in_frame && ( ((AVPixelFormat)snap->in_frame->format == AV_PIX_FMT_YUV420P) || ((AVPixelFormat)snap->in_frame->format == AV_PIX_FMT_YUVJ420P) ) ) { - Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[2], 0); + Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[0], 0); snap->score = DetectMotion(v_image, zoneSet); } else { snap->score = DetectMotion(*(snap->image), zoneSet); @@ -2344,20 +2344,20 @@ bool Monitor::Analyse() { if ((analysing == ANALYSING_ALWAYS) and snap->image) { if (!ref_image.Buffer()) { - if (snap->in_frame && ( + if (0 and snap->in_frame && ( ((AVPixelFormat)snap->in_frame->format == AV_PIX_FMT_YUV420P) || ((AVPixelFormat)snap->in_frame->format == AV_PIX_FMT_YUVJ420P) ) ) { Debug(1, "Assigning from vchannel"); - Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[2], 0); + Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[0], 0); ref_image.Assign(v_image); } else if (snap->image) { Debug(1, "Assigning"); ref_image.Assign(*(snap->image)); } } else { - if (snap->in_frame && + if (0 and snap->in_frame && ( ((AVPixelFormat)snap->in_frame->format == AV_PIX_FMT_YUV420P) || @@ -2365,7 +2365,7 @@ bool Monitor::Analyse() { ) ) { Debug(1, "Blending from vchannel"); - Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[2], 0); + Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[0], 0); ref_image.Blend(v_image, ( state==ALARM ? alarm_ref_blend_perc : ref_blend_perc )); } else if (snap->image) { Debug(1, "Blending because %p and format %d != %d, %d", snap->in_frame, diff --git a/src/zm_rtsp_server_fifo_source.cpp b/src/zm_rtsp_server_fifo_source.cpp index 40dbc14fc..1845c96ef 100644 --- a/src/zm_rtsp_server_fifo_source.cpp +++ b/src/zm_rtsp_server_fifo_source.cpp @@ -109,7 +109,7 @@ void ZoneMinderFifoSource::WriteRun() { fuNal.buffer()[2] = fuNal.buffer()[2]&~0x80; // FU header (no S bit) headerSize = 3; } - while (nalRemaining) { + while (nalRemaining && !stop_) { if ( nalRemaining < maxNalSize ) { // This is the last fragment: fuNal.buffer()[headerSize-1] |= 0x40; // set the E bit in the FU header @@ -166,7 +166,7 @@ int ZoneMinderFifoSource::getNextFrame() { } Debug(3, "%s bytes read %d bytes, buffer size %u", m_fifo.c_str(), bytes_read, m_buffer.size()); - while (m_buffer.size()) { + while (m_buffer.size() and !stop_) { unsigned int data_size = 0; int64_t pts; unsigned char *header_end = nullptr; @@ -224,7 +224,7 @@ int ZoneMinderFifoSource::getNextFrame() { int bytes_needed = data_size - (m_buffer.size() - header_size); if (bytes_needed > 0) { Debug(4, "Need another %d bytes. Trying to read them", bytes_needed); - while (bytes_needed) { + while (bytes_needed and !stop_) { bytes_read = m_buffer.read_into(m_fd, bytes_needed); if (bytes_read <= 0) { Debug(1, "Failed to read another %d bytes, got %d.", bytes_needed, bytes_read); @@ -252,13 +252,14 @@ int ZoneMinderFifoSource::getNextFrame() { { std::unique_lock lck(mutex_); Debug(3, "have lock"); - while (framesList.size()) { + while (!stop_ && framesList.size()) { std::pair nal = framesList.front(); framesList.pop_front(); NAL_Frame *Nal = new NAL_Frame(nal.first, nal.second, pts); m_nalQueue.push(Nal); } } + Debug(3, "notifying"); condition_.notify_all(); } // end while m_buffer.size() return 1;