Fix buffer re-use on short streaming
This commit is contained in:
@@ -32,10 +32,12 @@ void http_video(http_worker_t *worker, FILE *stream)
|
||||
int counter = 0;
|
||||
fprintf(stream, VIDEO_HEADER);
|
||||
|
||||
buffer_lock_use(&http_h264, 1);
|
||||
|
||||
while (!feof(stream)) {
|
||||
buffer_t *buf = buffer_lock_get(&http_h264, 3, &counter);
|
||||
if (!buf) {
|
||||
return;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (buf->v4l2_buffer.flags & V4L2_BUF_FLAG_KEYFRAME) {
|
||||
@@ -51,4 +53,7 @@ void http_video(http_worker_t *worker, FILE *stream)
|
||||
}
|
||||
buffer_consumed(buf);
|
||||
}
|
||||
|
||||
error:
|
||||
buffer_lock_use(&http_h264, -1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user