Fix a few bugs

This commit is contained in:
Kamil Trzcinski
2022-04-06 13:19:52 +02:00
parent b6b82db8e4
commit 8eb514c6b0
3 changed files with 31 additions and 9 deletions

View File

@ -40,9 +40,14 @@ void http_video(http_worker_t *worker, FILE *stream)
goto error;
}
unsigned char *data = buf->start;
if (buf->v4l2_buffer.flags & V4L2_BUF_FLAG_KEYFRAME) {
had_key_frame = true;
E_LOG_DEBUG(buf, "Got key frame!");
E_LOG_DEBUG(buf, "Got key frame (from V4L2)!");
} else if (buf->used >= 5 && (data[4] & 0x1F) == 0x07) {
had_key_frame = true;
E_LOG_DEBUG(buf, "Got key frame (from buffer)!");
}
if (had_key_frame) {

View File

@ -48,7 +48,7 @@ void http_snapshot(http_worker_t *worker, FILE *stream)
if (!buf) {
http_404_header(worker, stream);
fprintf(stream, "No snapshot captured yet.\r\n");
return;
goto error;
}
fprintf(stream, "HTTP/1.1 200 OK\r\n");