Commit cd9c687b authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Fixing recording from Lepton

parent 36b9f027
Loading
Loading
Loading
Loading
+93 −89
Original line number Diff line number Diff line
@@ -1630,15 +1630,19 @@ int listener_loop(camogm_state *state)
		ret = poll(&pfd,1,DEFAULT_POLL_TIMEOUT);

		if (ret==0){
			D6(fprintf(debug_file, "Waiting for commands...\n"));
			D6(fprintf(debug_file, "Waiting for commands..., state->prog_state = %d, pfd.revents=%d\n",state->prog_state, (int) pfd.revents));
		}

		if (pfd.revents & POLLIN){
			cmd = parse_cmd(state, cmd_file);
			if (cmd) {
				if (cmd < 0) D0(fprintf(debug_file, "Unrecognized command\n"));
			}
		} else if (state->prog_state == STATE_RUNNING) { // no commands in queue, started

			D6(fprintf(debug_file, "state->prog_state == STATE_RUNNING "));
			switch ((rslt = -sendImageFrame(state))) {
			D6(fprintf(debug_file, " ==> %d",rslt));
			case 0:
				break;                      // frame sent OK, nothing to do (TODO: check file length/duration)
			case CAMOGM_FRAME_NOT_READY:    // just wait for the frame to appear at the current pointer
@@ -1727,7 +1731,7 @@ int listener_loop(camogm_state *state)
			state->rawdev.thread_state = STATE_RUNNING;
			usleep(COMMAND_LOOP_DELAY);     // make it longer but interruptible by signals?
		}
		} // if pfd.revents & POLLIN
//		} // if pfd.revents & POLLIN
	} // while (process)

	// normally, we should not be here