@@ -363,8 +363,13 @@ int camogm_start(camogm_state *state, bool restart)
...
@@ -363,8 +363,13 @@ int camogm_start(camogm_state *state, bool restart)
D1(syslog(LOG_INFO,"Starting raw data recording, marked %s",get_state_path(state)));
D1(syslog(LOG_INFO,"Starting raw data recording, marked %s",get_state_path(state)));
next_state_path(state);// increment path so next time will use different one.
next_state_path(state);// increment path so next time will use different one.
}else{
}else{
D1(fprintf(debug_file,"Re-starting raw data recording, using the same state file, text will be %s, state->path='%s'\n",get_state_path(state),state->path));
if(state->prog_state==STATE_STARTING){
D1(syslog(LOG_INFO,"Re-starting raw data recording, next will be %s",get_state_path(state)));
D1(fprintf(debug_file,"Re-starting raw data recording, using the same state file, next will be %s, state->path='%s'\n",get_state_path(state),state->path));
D1(syslog(LOG_INFO,"Re-starting raw data recording, next will be %s",get_state_path(state)));
}
}
}
}else{
}else{
D1(fprintf(debug_file,"Starting file system recording to %s\n",state->path));
D1(fprintf(debug_file,"Starting file system recording to %s\n",state->path));
...
@@ -375,10 +380,11 @@ int camogm_start(camogm_state *state, bool restart)
...
@@ -375,10 +380,11 @@ int camogm_start(camogm_state *state, bool restart)
state->frameno=0;
state->frameno=0;
// do not trigger overrun alert on successfull (from GUI) restarts
// do not trigger overrun alert on successfull (from GUI) restarts
#if ERRORS_FROM_START == 0
if(state->prog_state!=STATE_RESTARTING)
if(state->prog_state!=STATE_RESTARTING)
for(intp=0;p<SENSOR_PORTS;p++)
for(intp=0;p<SENSOR_PORTS;p++)
state->buf_overruns[p]=-1;
state->buf_overruns[p]=-1;
#endif
state->timescale=state->set_timescale;// current timescale, default 1
state->timescale=state->set_timescale;// current timescale, default 1
// debug
// debug
int*ifp=(int*)&(state->frame_params[port]);
int*ifp=(int*)&(state->frame_params[port]);
...
@@ -431,12 +437,36 @@ int camogm_start(camogm_state *state, bool restart)
...
@@ -431,12 +437,36 @@ int camogm_start(camogm_state *state, bool restart)
if(!state->ignore_fps){// don't even try in ignore mode
if(!state->ignore_fps){// don't even try in ignore mode
if(((fp=lseek(state->fd_circ[chn],LSEEK_CIRC_PREV,SEEK_END)))>=0)state->cirbuf_rp[chn]=fp;//try to have 2 frames available for fps
if(((fp=lseek(state->fd_circ[chn],LSEEK_CIRC_PREV,SEEK_END)))>=0)state->cirbuf_rp[chn]=fp;//try to have 2 frames available for fps
}
}
#if ERRORS_FROM_START == 0
state->buf_overruns[chn]++;
state->buf_overruns[chn]++;
// file pointer here should match state->rp; so no need to do lseek(state->fd_circ,state->cirbuf_rp,SEEK_SET);
// file pointer here should match state->rp; so no need to do lseek(state->fd_circ,state->cirbuf_rp,SEEK_SET);
FOR_EACH_PORT(int,chn){if(state->buf_overruns[chn]>=0)state->buf_overruns[chn]=0;}// resets overruns after reading status , so "overruns" means since last reading status
FOR_EACH_PORT(int,chn){if(state->buf_overruns[chn]>=0)state->buf_overruns[chn]=0;}// resets overruns after reading status , so "overruns" means since last reading status