mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-10 09:33:43 +00:00
expose blank to rawsink
This commit is contained in:
@@ -71,7 +71,7 @@ typedef struct {
|
|||||||
|
|
||||||
static _pool_s *_stream_init_loop(stream_s *stream);
|
static _pool_s *_stream_init_loop(stream_s *stream);
|
||||||
static _pool_s *_stream_init_one(stream_s *stream);
|
static _pool_s *_stream_init_one(stream_s *stream);
|
||||||
static void _stream_expose_frame(stream_s *stream, frame_s *frame, unsigned captured_fps);
|
static bool _stream_expose_frame(stream_s *stream, frame_s *frame, unsigned captured_fps);
|
||||||
|
|
||||||
static _pool_s *_workers_pool_init(stream_s *stream);
|
static _pool_s *_workers_pool_init(stream_s *stream);
|
||||||
static void _workers_pool_destroy(_pool_s *pool);
|
static void _workers_pool_destroy(_pool_s *pool);
|
||||||
@@ -268,7 +268,19 @@ static _pool_s *_stream_init_loop(stream_s *stream) {
|
|||||||
LOG_DEBUG("%s: stream->proc->stop=%d", __FUNCTION__, atomic_load(&stream->proc->stop));
|
LOG_DEBUG("%s: stream->proc->stop=%d", __FUNCTION__, atomic_load(&stream->proc->stop));
|
||||||
|
|
||||||
while (!atomic_load(&stream->proc->stop)) {
|
while (!atomic_load(&stream->proc->stop)) {
|
||||||
_stream_expose_frame(stream, NULL, 0);
|
if (_stream_expose_frame(stream, NULL, 0)) {
|
||||||
|
# ifdef WITH_RAWSINK
|
||||||
|
# define BLANK(_next) stream->blank->_next
|
||||||
|
if (stream->rawsink && rawsink_server_put(
|
||||||
|
stream->rawsink, BLANK(data), BLANK(used), V4L2_PIX_FMT_JPEG,
|
||||||
|
BLANK(width), BLANK(height), BLANK(grab_ts)
|
||||||
|
) < 0) {
|
||||||
|
stream->rawsink = NULL;
|
||||||
|
LOG_ERROR("RAW sink completely disabled due error");
|
||||||
|
}
|
||||||
|
# undef BLANK
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
if (access(stream->dev->path, R_OK|W_OK) < 0) {
|
if (access(stream->dev->path, R_OK|W_OK) < 0) {
|
||||||
if (access_error != errno) {
|
if (access_error != errno) {
|
||||||
@@ -310,10 +322,11 @@ static _pool_s *_stream_init_one(stream_s *stream) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _stream_expose_frame(stream_s *stream, frame_s *frame, unsigned captured_fps) {
|
static bool _stream_expose_frame(stream_s *stream, frame_s *frame, unsigned captured_fps) {
|
||||||
# define VID(_next) stream->video->_next
|
# define VID(_next) stream->video->_next
|
||||||
|
|
||||||
frame_s *new = NULL;
|
frame_s *new = NULL;
|
||||||
|
bool changed = false;
|
||||||
|
|
||||||
A_MUTEX_LOCK(&VID(mutex));
|
A_MUTEX_LOCK(&VID(mutex));
|
||||||
|
|
||||||
@@ -351,14 +364,17 @@ static void _stream_expose_frame(stream_s *stream, frame_s *frame, unsigned capt
|
|||||||
|
|
||||||
if (new) {
|
if (new) {
|
||||||
frame_copy(new, VID(frame));
|
frame_copy(new, VID(frame));
|
||||||
|
changed = true;
|
||||||
} else if (VID(frame->used) == 0) { // Инициализация
|
} else if (VID(frame->used) == 0) { // Инициализация
|
||||||
frame_copy(stream->blank, VID(frame));
|
frame_copy(stream->blank, VID(frame));
|
||||||
frame = NULL;
|
frame = NULL;
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
VID(online) = frame;
|
VID(online) = frame;
|
||||||
VID(captured_fps) = captured_fps;
|
VID(captured_fps) = captured_fps;
|
||||||
atomic_store(&VID(updated), true);
|
atomic_store(&VID(updated), true);
|
||||||
A_MUTEX_UNLOCK(&VID(mutex));
|
A_MUTEX_UNLOCK(&VID(mutex));
|
||||||
|
return changed;
|
||||||
|
|
||||||
# undef VID
|
# undef VID
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <linux/videodev2.h>
|
||||||
|
|
||||||
#include "../common/tools.h"
|
#include "../common/tools.h"
|
||||||
#include "../common/threading.h"
|
#include "../common/threading.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user