Move diag_fifo pipes in SOCKS_DIR instead of assigned Storage area. Storage areas could be a fs that cannot handle sockets or fifos like NFS.
This commit is contained in:
parent
645dca6bc9
commit
de74a15ab1
|
@ -221,7 +221,7 @@ void FifoStream::setStreamStart(int monitor_id, const char * format) {
|
|||
}
|
||||
|
||||
snprintf(diag_path, sizeof(diag_path), "%s/%d/%s",
|
||||
monitor->getStorage()->Path(), monitor->Id(), filename);
|
||||
staticConfig.PATH_SOCKS.c_str(), monitor->Id(), filename);
|
||||
setStreamStart(diag_path);
|
||||
}
|
||||
|
||||
|
|
|
@ -540,11 +540,14 @@ Monitor::Monitor(
|
|||
ReloadLinkedMonitors(p_linked_monitors);
|
||||
|
||||
if ( config.record_diag_images ) {
|
||||
diag_path_r = stringtf(config.record_diag_images_fifo ? "%s/%d/diagpipe-r.jpg" : "%s/%d/diag-r.jpg", storage->Path(), id);
|
||||
diag_path_d = stringtf(config.record_diag_images_fifo ? "%s/%d/diagpipe-d.jpg" : "%s/%d/diag-d.jpg", storage->Path(), id);
|
||||
if ( config.record_diag_images_fifo ) {
|
||||
FifoStream::fifo_create_if_missing(diag_path_r.c_str());
|
||||
FifoStream::fifo_create_if_missing(diag_path_d.c_str());
|
||||
diag_path_ref = stringtf("%s/%d/diagpipe-r.jpg", staticConfig.PATH_SOCKS.c_str(), id);
|
||||
diag_path_delta = stringtf("%s/%d/diagpipe-d.jpg", staticConfig.PATH_SOCKS.c_str(), id);
|
||||
FifoStream::fifo_create_if_missing(diag_path_ref.c_str());
|
||||
FifoStream::fifo_create_if_missing(diag_path_delta.c_str());
|
||||
} else {
|
||||
diag_path_ref = stringtf("%s/%d/diag-r.jpg", storage->Path(), id);
|
||||
diag_path_delta = stringtf("%s/%d/diag-d.jpg", storage->Path(), id);
|
||||
}
|
||||
}
|
||||
} // end if purpose == ANALYSIS
|
||||
|
@ -2683,8 +2686,8 @@ unsigned int Monitor::DetectMotion(const Image &comp_image, Event::StringSet &zo
|
|||
ref_image.Delta(comp_image, &delta_image);
|
||||
|
||||
if ( config.record_diag_images ) {
|
||||
ref_image.WriteJpeg(diag_path_r.c_str(), config.record_diag_images_fifo);
|
||||
delta_image.WriteJpeg(diag_path_d.c_str(), config.record_diag_images_fifo);
|
||||
ref_image.WriteJpeg(diag_path_ref.c_str(), config.record_diag_images_fifo);
|
||||
delta_image.WriteJpeg(diag_path_delta.c_str(), config.record_diag_images_fifo);
|
||||
}
|
||||
|
||||
// Blank out all exclusion zones
|
||||
|
|
|
@ -313,8 +313,8 @@ protected:
|
|||
Image ref_image;
|
||||
Image alarm_image; // Used in creating analysis images, will be initialized in Analysis
|
||||
Image write_image; // Used when creating snapshot images
|
||||
std::string diag_path_r;
|
||||
std::string diag_path_d;
|
||||
std::string diag_path_ref;
|
||||
std::string diag_path_delta;
|
||||
|
||||
Purpose purpose; // What this monitor has been created to do
|
||||
int event_count;
|
||||
|
|
|
@ -113,11 +113,16 @@ void Zone::Setup(
|
|||
}
|
||||
|
||||
if ( config.record_diag_images ) {
|
||||
snprintf(diag_path, sizeof(diag_path),
|
||||
config.record_diag_images_fifo ? "%s/diagpipe-%d-poly.jpg" : "%s/diag-%d-poly.jpg",
|
||||
monitor->getStorage()->Path(), id);
|
||||
if ( config.record_diag_images_fifo )
|
||||
if ( config.record_diag_images_fifo ) {
|
||||
snprintf(diag_path, sizeof(diag_path),
|
||||
"%s/diagpipe-%d-poly.jpg",
|
||||
staticConfig.PATH_SOCKS.c_str(), id);
|
||||
|
||||
FifoStream::fifo_create_if_missing(diag_path);
|
||||
} else {
|
||||
snprintf(diag_path, sizeof(diag_path), "%s/diag-%d-poly.jpg",
|
||||
monitor->getStorage()->Path(), id);
|
||||
}
|
||||
pg_image->WriteJpeg(diag_path, config.record_diag_images_fifo);
|
||||
} else {
|
||||
diag_path[0] = 0;
|
||||
|
@ -139,10 +144,11 @@ void Zone::RecordStats(const Event *event) {
|
|||
"INSERT INTO Stats SET MonitorId=%d, ZoneId=%d, EventId=%" PRIu64 ", FrameId=%d, PixelDiff=%d, AlarmPixels=%d, FilterPixels=%d, BlobPixels=%d, Blobs=%d, MinBlobSize=%d, MaxBlobSize=%d, MinX=%d, MinY=%d, MaxX=%d, MaxY=%d, Score=%d",
|
||||
monitor->Id(), id, event->Id(), event->Frames(), pixel_diff, alarm_pixels, alarm_filter_pixels, alarm_blob_pixels, alarm_blobs, min_blob_size, max_blob_size, alarm_box.LoX(), alarm_box.LoY(), alarm_box.HiX(), alarm_box.HiY(), score
|
||||
);
|
||||
if ( mysql_query(&dbconn, sql) ) {
|
||||
int rc = mysql_query(&dbconn, sql);
|
||||
db_mutex.unlock();
|
||||
if ( rc ) {
|
||||
Error("Can't insert event stats: %s", mysql_error(&dbconn));
|
||||
}
|
||||
db_mutex.unlock();
|
||||
} // end void Zone::RecordStats( const Event *event )
|
||||
|
||||
bool Zone::CheckOverloadCount() {
|
||||
|
|
Loading…
Reference in New Issue