mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-11 10:03:43 +00:00
minor fix
This commit is contained in:
@@ -170,7 +170,7 @@ static void *_video_sink_thread(void *arg) {
|
|||||||
|
|
||||||
close_memsink:
|
close_memsink:
|
||||||
US_DELETE(mem, us_memsink_shared_unmap);
|
US_DELETE(mem, us_memsink_shared_unmap);
|
||||||
US_CLOSE_FD(fd, close);
|
US_CLOSE_FD(fd);
|
||||||
US_JLOG_INFO("video", "Memsink closed");
|
US_JLOG_INFO("video", "Memsink closed");
|
||||||
sleep(1); // error_delay
|
sleep(1); // error_delay
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ commands = cppcheck \
|
|||||||
--std=c17 \
|
--std=c17 \
|
||||||
--error-exitcode=1 \
|
--error-exitcode=1 \
|
||||||
--quiet \
|
--quiet \
|
||||||
--enable=warning,unusedFunction,portability,performance,style \
|
--enable=warning,portability,performance,style \
|
||||||
--suppress=assignmentInAssert \
|
--suppress=assignmentInAssert \
|
||||||
--suppress=variableScope \
|
--suppress=variableScope \
|
||||||
--inline-suppr \
|
--inline-suppr \
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ typedef struct {
|
|||||||
|
|
||||||
static void _MemsinkObject_destroy_internals(_MemsinkObject *self) {
|
static void _MemsinkObject_destroy_internals(_MemsinkObject *self) {
|
||||||
US_DELETE(self->mem, us_memsink_shared_unmap);
|
US_DELETE(self->mem, us_memsink_shared_unmap);
|
||||||
US_CLOSE_FD(self->fd, close);
|
US_CLOSE_FD(self->fd);
|
||||||
US_DELETE(self->frame, us_frame_destroy);
|
US_DELETE(self->frame, us_frame_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ static PyModuleDef _Module = {
|
|||||||
.m_size = -1,
|
.m_size = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
PyMODINIT_FUNC PyInit_ustreamer(void) { // cppcheck-suppress unusedFunction
|
PyMODINIT_FUNC PyInit_ustreamer(void) {
|
||||||
PyObject *module = PyModule_Create(&_Module);
|
PyObject *module = PyModule_Create(&_Module);
|
||||||
if (module == NULL) {
|
if (module == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ void us_device_close(us_device_s *dev) {
|
|||||||
for (uint index = 0; index < run->n_bufs; ++index) {
|
for (uint index = 0; index < run->n_bufs; ++index) {
|
||||||
us_hw_buffer_s *hw = &run->hw_bufs[index];
|
us_hw_buffer_s *hw = &run->hw_bufs[index];
|
||||||
|
|
||||||
US_CLOSE_FD(hw->dma_fd, close);
|
US_CLOSE_FD(hw->dma_fd);
|
||||||
|
|
||||||
if (dev->io_method == V4L2_MEMORY_MMAP) {
|
if (dev->io_method == V4L2_MEMORY_MMAP) {
|
||||||
if (hw->raw.allocated > 0 && hw->raw.data != NULL) {
|
if (hw->raw.allocated > 0 && hw->raw.data != NULL) {
|
||||||
@@ -254,7 +254,7 @@ void us_device_close(us_device_s *dev) {
|
|||||||
run->n_bufs = 0;
|
run->n_bufs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
US_CLOSE_FD(run->fd, close);
|
US_CLOSE_FD(run->fd);
|
||||||
run->persistent_timeout_reported = false;
|
run->persistent_timeout_reported = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -920,7 +920,7 @@ static int _device_open_export_to_dma(us_device_s *dev) {
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
for (uint index = 0; index < run->n_bufs; ++index) {
|
for (uint index = 0; index < run->n_bufs; ++index) {
|
||||||
US_CLOSE_FD(run->hw_bufs[index].dma_fd, close);
|
US_CLOSE_FD(run->hw_bufs[index].dma_fd);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ int us_memsink_server_put(us_memsink_s *sink, const us_frame_s *frame, bool *key
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int us_memsink_client_get(us_memsink_s *sink, us_frame_s *frame, bool *key_requested, bool key_required) { // cppcheck-suppress unusedFunction
|
int us_memsink_client_get(us_memsink_s *sink, us_frame_s *frame, bool *key_requested, bool key_required) {
|
||||||
assert(!sink->server); // Client only
|
assert(!sink->server); // Client only
|
||||||
|
|
||||||
if (us_flock_timedwait_monotonic(sink->fd, sink->timeout) < 0) {
|
if (us_flock_timedwait_monotonic(sink->fd, sink->timeout) < 0) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
#define US_CALLOC(x_dest, x_nmemb) assert(((x_dest) = calloc((x_nmemb), sizeof(*(x_dest)))) != NULL)
|
#define US_CALLOC(x_dest, x_nmemb) assert(((x_dest) = calloc((x_nmemb), sizeof(*(x_dest)))) != NULL)
|
||||||
#define US_REALLOC(x_dest, x_nmemb) assert(((x_dest) = realloc((x_dest), (x_nmemb) * sizeof(*(x_dest)))) != NULL)
|
#define US_REALLOC(x_dest, x_nmemb) assert(((x_dest) = realloc((x_dest), (x_nmemb) * sizeof(*(x_dest)))) != NULL)
|
||||||
#define US_DELETE(x_dest, x_free) { if (x_dest) { x_free(x_dest); x_dest = NULL; } }
|
#define US_DELETE(x_dest, x_free) { if (x_dest) { x_free(x_dest); x_dest = NULL; } }
|
||||||
#define US_CLOSE_FD(x_dest, x_close) { if (x_dest >= 0) { x_close(x_dest); x_dest = -1; } }
|
#define US_CLOSE_FD(x_dest) { if (x_dest >= 0) { close(x_dest); x_dest = -1; } }
|
||||||
#define US_MEMSET_ZERO(x_obj) memset(&(x_obj), 0, sizeof(x_obj))
|
#define US_MEMSET_ZERO(x_obj) memset(&(x_obj), 0, sizeof(x_obj))
|
||||||
|
|
||||||
#define US_SNPRINTF(x_dest, x_size, x_fmt, ...) assert(snprintf((x_dest), (x_size), (x_fmt), ##__VA_ARGS__) > 0)
|
#define US_SNPRINTF(x_dest, x_size, x_fmt, ...) assert(snprintf((x_dest), (x_size), (x_fmt), ##__VA_ARGS__) > 0)
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ void us_server_destroy(us_server_s *server) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
evhttp_free(run->http);
|
evhttp_free(run->http);
|
||||||
US_CLOSE_FD(run->ext_fd, close);
|
US_CLOSE_FD(run->ext_fd);
|
||||||
event_base_free(run->base);
|
event_base_free(run->base);
|
||||||
|
|
||||||
# if LIBEVENT_VERSION_NUMBER >= 0x02010100
|
# if LIBEVENT_VERSION_NUMBER >= 0x02010100
|
||||||
@@ -392,7 +392,7 @@ not_found:
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
US_CLOSE_FD(fd, close); // cppcheck-suppress unreadVariable
|
US_CLOSE_FD(fd); // cppcheck-suppress unreadVariable
|
||||||
US_DELETE(static_path, free);
|
US_DELETE(static_path, free);
|
||||||
US_DELETE(buf, evbuffer_free);
|
US_DELETE(buf, evbuffer_free);
|
||||||
US_DELETE(decoded_path, free);
|
US_DELETE(decoded_path, free);
|
||||||
|
|||||||
@@ -254,8 +254,8 @@ static void _drm_cleanup(us_drm_s *drm) {
|
|||||||
run->n_bufs = 0;
|
run->n_bufs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
US_CLOSE_FD(run->status_fd, close);
|
US_CLOSE_FD(run->status_fd);
|
||||||
US_CLOSE_FD(run->fd, close);
|
US_CLOSE_FD(run->fd);
|
||||||
|
|
||||||
run->crtc_id = 0;
|
run->crtc_id = 0;
|
||||||
run->next_n_buf = 0;
|
run->next_n_buf = 0;
|
||||||
@@ -391,7 +391,7 @@ static int _drm_check_status(us_drm_s *drm) {
|
|||||||
return (status_ch == 'd' ? -2 : 0);
|
return (status_ch == 'd' ? -2 : 0);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
US_CLOSE_FD(run->status_fd, close);
|
US_CLOSE_FD(run->status_fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ static void *_follower_thread(void *v_unix_follow) {
|
|||||||
|
|
||||||
const bool online = !connect(fd, (struct sockaddr *)&addr, sizeof(addr));
|
const bool online = !connect(fd, (struct sockaddr *)&addr, sizeof(addr));
|
||||||
atomic_store(&_g_ustreamer_online, online);
|
atomic_store(&_g_ustreamer_online, online);
|
||||||
US_CLOSE_FD(fd, close); // cppcheck-suppress unreadVariable
|
US_CLOSE_FD(fd); // cppcheck-suppress unreadVariable
|
||||||
|
|
||||||
usleep(200 * 1000);
|
usleep(200 * 1000);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user