Don't both updating analysis fps unless we are doing motion detection

This commit is contained in:
Isaac Connor 2021-03-02 09:59:32 -05:00
parent 9beaf613bf
commit 832eabbd79
1 changed files with 20 additions and 17 deletions

View File

@ -2267,6 +2267,7 @@ bool Monitor::Analyse() {
// Only do these if it's a video packet. // Only do these if it's a video packet.
shared_data->last_read_index = snap->image_index; shared_data->last_read_index = snap->image_index;
analysis_image_count++; analysis_image_count++;
if ( function == MODECT or function == MOCORD )
UpdateAnalysisFPS(); UpdateAnalysisFPS();
} }
shared_data->last_read_time = time(nullptr); shared_data->last_read_time = time(nullptr);
@ -2549,10 +2550,12 @@ int Monitor::Capture() {
// avcodec strips out important nals that describe the stream and // avcodec strips out important nals that describe the stream and
// stick them in extradata. Need to send them along with keyframes // stick them in extradata. Need to send them along with keyframes
AVStream *stream = camera->get_VideoStream(); AVStream *stream = camera->get_VideoStream();
#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
video_fifo->write( video_fifo->write(
static_cast<unsigned char *>(stream->codecpar->extradata), static_cast<unsigned char *>(stream->codecpar->extradata),
stream->codecpar->extradata_size, stream->codecpar->extradata_size,
packet->pts); packet->pts);
#endif
} }
video_fifo->writePacket(*packet); video_fifo->writePacket(*packet);
} }