Compare commits

...

5 Commits
v5.18 ... v5.20

Author SHA1 Message Date
Maxim Devaev
4ec02d46b9 Bump version: 5.19 → 5.20 2022-08-17 17:59:16 +03:00
Maxim Devaev
527afb66df fixed arch deps 2022-08-17 17:55:59 +03:00
Maxim Devaev
5502758a7e Bump version: 5.18 → 5.19 2022-07-30 13:10:16 +03:00
Maxim Devaev
faa1776407 simplified us_errno_to_string() 2022-07-30 13:05:00 +03:00
Maxim Devaev
3d7fb8c8dd fixed #162: optional sigabbrev_np() 2022-07-30 02:59:21 +03:00
13 changed files with 56 additions and 32 deletions

View File

@@ -1,7 +1,7 @@
[bumpversion] [bumpversion]
commit = True commit = True
tag = True tag = True
current_version = 5.18 current_version = 5.20
parse = (?P<major>\d+)\.(?P<minor>\d+) parse = (?P<major>\d+)\.(?P<minor>\d+)
serialize = serialize =
{major}.{minor} {major}.{minor}

View File

@@ -32,7 +32,7 @@
#define US_JLOG_ERROR(x_prefix, x_msg, ...) JANUS_LOG(LOG_ERR, "== %s/%-9s -- " x_msg "\n", US_PLUGIN_NAME, x_prefix, ##__VA_ARGS__) #define US_JLOG_ERROR(x_prefix, x_msg, ...) JANUS_LOG(LOG_ERR, "== %s/%-9s -- " x_msg "\n", US_PLUGIN_NAME, x_prefix, ##__VA_ARGS__)
#define US_JLOG_PERROR(x_prefix, x_msg, ...) { \ #define US_JLOG_PERROR(x_prefix, x_msg, ...) { \
char m_perror_buf[1024] = {0}; \ char *const m_perror_str = us_errno_to_string(errno); \
char *m_perror_ptr = us_errno_to_string(errno, m_perror_buf, 1023); \ JANUS_LOG(LOG_ERR, "[%s/%-9s] " x_msg ": %s\n", US_PLUGIN_NAME, x_prefix, ##__VA_ARGS__, m_perror_str); \
JANUS_LOG(LOG_ERR, "[%s/%-9s] " x_msg ": %s\n", US_PLUGIN_NAME, x_prefix, ##__VA_ARGS__, m_perror_ptr); \ free(m_perror_str); \
} }

View File

@@ -1,6 +1,6 @@
.\" Manpage for ustreamer-dump. .\" Manpage for ustreamer-dump.
.\" Open an issue or pull request to https://github.com/pikvm/ustreamer to correct errors or typos .\" Open an issue or pull request to https://github.com/pikvm/ustreamer to correct errors or typos
.TH USTREAMER-DUMP 1 "version 5.18" "January 2021" .TH USTREAMER-DUMP 1 "version 5.20" "January 2021"
.SH NAME .SH NAME
ustreamer-dump \- Dump uStreamer's memory sink to file ustreamer-dump \- Dump uStreamer's memory sink to file

View File

@@ -1,6 +1,6 @@
.\" Manpage for ustreamer. .\" Manpage for ustreamer.
.\" Open an issue or pull request to https://github.com/pikvm/ustreamer to correct errors or typos .\" Open an issue or pull request to https://github.com/pikvm/ustreamer to correct errors or typos
.TH USTREAMER 1 "version 5.18" "November 2020" .TH USTREAMER 1 "version 5.20" "November 2020"
.SH NAME .SH NAME
ustreamer \- stream MJPEG video from any V4L2 device to the network ustreamer \- stream MJPEG video from any V4L2 device to the network

View File

@@ -3,7 +3,7 @@
pkgname=ustreamer pkgname=ustreamer
pkgver=5.18 pkgver=5.20
pkgrel=1 pkgrel=1
pkgdesc="Lightweight and fast MJPEG-HTTP streamer" pkgdesc="Lightweight and fast MJPEG-HTTP streamer"
url="https://github.com/pikvm/ustreamer" url="https://github.com/pikvm/ustreamer"
@@ -22,8 +22,8 @@ if [ -e /usr/bin/python3 ]; then
makedepends+=(python-setuptools) makedepends+=(python-setuptools)
fi fi
if [ -e /usr/include/janus/plugins/plugin.h ];then if [ -e /usr/include/janus/plugins/plugin.h ];then
depends+=(janus-gateway-pikvm alsa-lib opus) depends+=(janus-gateway alsa-lib opus)
makedepends+=(janus-gateway-pikvm alsa-lib opus) makedepends+=(janus-gateway alsa-lib opus)
_options="$_options WITH_JANUS=1" _options="$_options WITH_JANUS=1"
fi fi

View File

@@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=ustreamer PKG_NAME:=ustreamer
PKG_VERSION:=5.18 PKG_VERSION:=5.20
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_MAINTAINER:=Maxim Devaev <mdevaev@gmail.com> PKG_MAINTAINER:=Maxim Devaev <mdevaev@gmail.com>

View File

@@ -19,7 +19,7 @@ def _find_sources(suffix: str) -> List[str]:
if __name__ == "__main__": if __name__ == "__main__":
setup( setup(
name="ustreamer", name="ustreamer",
version="5.18", version="5.20",
description="uStreamer tools", description="uStreamer tools",
author="Maxim Devaev", author="Maxim Devaev",
author_email="mdevaev@gmail.com", author_email="mdevaev@gmail.com",

View File

@@ -195,7 +195,9 @@ int main(int argc, char *argv[]) {
static void _signal_handler(int signum) { static void _signal_handler(int signum) {
US_LOG_INFO_NOLOCK("===== Stopping by SIG%s =====", us_signum_to_string(signum)); char *const name = us_signum_to_string(signum);
US_LOG_INFO_NOLOCK("===== Stopping by %s =====", name);
free(name);
_g_stop = true; _g_stop = true;
} }

View File

@@ -23,7 +23,7 @@
#pragma once #pragma once
#define US_VERSION_MAJOR 5 #define US_VERSION_MAJOR 5
#define US_VERSION_MINOR 18 #define US_VERSION_MINOR 20
#define US_MAKE_VERSION2(_major, _minor) #_major "." #_minor #define US_MAKE_VERSION2(_major, _minor) #_major "." #_minor
#define US_MAKE_VERSION1(_major, _minor) US_MAKE_VERSION2(_major, _minor) #define US_MAKE_VERSION1(_major, _minor) US_MAKE_VERSION2(_major, _minor)

View File

@@ -116,9 +116,9 @@ extern pthread_mutex_t us_g_log_mutex;
} }
#define US_LOG_PERROR(x_msg, ...) { \ #define US_LOG_PERROR(x_msg, ...) { \
char m_perror_buf[1024] = {0}; \ char *const m_perror_str = us_errno_to_string(errno); \
char *m_perror_ptr = us_errno_to_string(errno, m_perror_buf, 1024); \ US_LOG_ERROR(x_msg ": %s", ##__VA_ARGS__, m_perror_str); \
US_LOG_ERROR(x_msg ": %s", ##__VA_ARGS__, m_perror_ptr); \ free(m_perror_str); \
} }
#define US_LOG_INFO(x_msg, ...) { \ #define US_LOG_INFO(x_msg, ...) { \
@@ -149,9 +149,9 @@ extern pthread_mutex_t us_g_log_mutex;
#define US_LOG_VERBOSE_PERROR(x_msg, ...) { \ #define US_LOG_VERBOSE_PERROR(x_msg, ...) { \
if (us_g_log_level >= US_LOG_LEVEL_VERBOSE) { \ if (us_g_log_level >= US_LOG_LEVEL_VERBOSE) { \
char m_perror_buf[1024] = {0}; \ char *m_perror_str = us_errno_to_string(errno); \
char *m_perror_ptr = us_errno_to_string(errno, m_perror_buf, 1023); \ US_LOG_PRINTF(US_COLOR_BLUE, "VERB ", US_COLOR_BLUE, x_msg ": %s", ##__VA_ARGS__, m_perror_str); \
US_LOG_PRINTF(US_COLOR_BLUE, "VERB ", US_COLOR_BLUE, x_msg ": %s", ##__VA_ARGS__, m_perror_ptr); \ free(m_perror_str); \
} \ } \
} }

View File

@@ -38,6 +38,12 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/file.h> #include <sys/file.h>
#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 32
# define HAS_SIGABBREV_NP
#else
# include <signal.h>
#endif
#ifdef NDEBUG #ifdef NDEBUG
# error WTF dude? Asserts are good things! # error WTF dude? Asserts are good things!
@@ -181,20 +187,34 @@ INLINE int us_flock_timedwait_monotonic(int fd, long double timeout) {
return retval; return retval;
} }
INLINE char *us_errno_to_string(int error, char *buf, size_t size) { INLINE char *us_errno_to_string(int error) {
assert(buf != NULL);
assert(size > 0);
locale_t locale = newlocale(LC_MESSAGES_MASK, "C", NULL); locale_t locale = newlocale(LC_MESSAGES_MASK, "C", NULL);
const char *str = "!!! newlocale() error !!!"; char *buf;
strncpy(buf, (locale ? strerror_l(error, locale) : str), size - 1);
buf[size - 1] = '\0';
if (locale) { if (locale) {
buf = us_strdup(strerror_l(error, locale));
freelocale(locale); freelocale(locale);
} else {
buf = us_strdup("!!! newlocale() error !!!");
} }
return buf; return buf;
} }
INLINE const char *us_signum_to_string(int signum) { INLINE char *us_signum_to_string(int signum) {
const char *const str = sigabbrev_np(signum); # ifdef HAS_SIGABBREV_NP
return (str == NULL ? "???" : str); const char *const name = sigabbrev_np(signum);
# else
const char *const name = (
signum == SIGTERM ? "TERM" :
signum == SIGINT ? "INT" :
signum == SIGPIPE ? "PIPE" :
NULL
);
# endif
char *buf;
if (name != NULL) {
US_ASPRINTF(buf, "SIG%s", name);
} else {
US_ASPRINTF(buf, "SIG[%d]", signum);
}
return buf;
} }

View File

@@ -28,11 +28,11 @@ char *us_bufferevent_format_reason(short what) {
US_CALLOC(reason, 2048); US_CALLOC(reason, 2048);
// evutil_socket_error_to_string() is not thread-safe // evutil_socket_error_to_string() is not thread-safe
char perror_buf[1024] = {0}; char *const perror_str = us_errno_to_string(EVUTIL_SOCKET_ERROR());
const char *perror_ptr = us_errno_to_string(EVUTIL_SOCKET_ERROR(), perror_buf, 1024);
bool first = true; bool first = true;
strcat(reason, perror_ptr); strcat(reason, perror_str);
free(perror_str);
strcat(reason, " ("); strcat(reason, " (");
# define FILL_REASON(x_bev, x_name) { \ # define FILL_REASON(x_bev, x_name) { \

View File

@@ -67,7 +67,9 @@ static void *_server_loop_thread(UNUSED void *arg) {
} }
static void _signal_handler(int signum) { static void _signal_handler(int signum) {
US_LOG_INFO_NOLOCK("===== Stopping by SIG%s =====", us_signum_to_string(signum)); char *const name = us_signum_to_string(signum);
US_LOG_INFO_NOLOCK("===== Stopping by %s =====", name);
free(name);
us_stream_loop_break(_g_stream); us_stream_loop_break(_g_stream);
us_server_loop_break(_g_server); us_server_loop_break(_g_server);
} }