mirror of
https://github.com/pikvm/ustreamer.git
synced 2025-12-23 18:50:00 +00:00
pikvm/pikvm#312: --exit-on-device-error
This commit is contained in:
parent
0e521ad0c6
commit
b089f896da
@ -276,6 +276,9 @@ Timeout for lock. Default: 1.
|
|||||||
.BR \-\-exit\-on\-parent\-death
|
.BR \-\-exit\-on\-parent\-death
|
||||||
Exit the program if the parent process is dead. Required \fBWITH_PDEATHSIG\fR feature. Default: disabled.
|
Exit the program if the parent process is dead. Required \fBWITH_PDEATHSIG\fR feature. Default: disabled.
|
||||||
.TP
|
.TP
|
||||||
|
.BR \-\-exit\-on\-device\-error
|
||||||
|
Exit on any device error instead of polling until success. Default: disabled.
|
||||||
|
.TP
|
||||||
.BR \-\-exit\-on\-no\-clients \fIsec
|
.BR \-\-exit\-on\-no\-clients \fIsec
|
||||||
Exit the program if there have been no stream or sink clients or any HTTP requests in the last N seconds. Default: 0 (disabled).
|
Exit the program if there have been no stream or sink clients or any HTTP requests in the last N seconds. Default: 0 (disabled).
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
@ -117,6 +117,7 @@ enum _US_OPT_VALUES {
|
|||||||
# ifdef WITH_PDEATHSIG
|
# ifdef WITH_PDEATHSIG
|
||||||
_O_EXIT_ON_PARENT_DEATH,
|
_O_EXIT_ON_PARENT_DEATH,
|
||||||
# endif
|
# endif
|
||||||
|
_O_EXIT_ON_DEVICE_ERROR,
|
||||||
_O_EXIT_ON_NO_CLIENTS,
|
_O_EXIT_ON_NO_CLIENTS,
|
||||||
# ifdef WITH_SETPROCTITLE
|
# ifdef WITH_SETPROCTITLE
|
||||||
_O_PROCESS_NAME_PREFIX,
|
_O_PROCESS_NAME_PREFIX,
|
||||||
@ -227,6 +228,7 @@ static const struct option _LONG_OPTS[] = {
|
|||||||
# ifdef WITH_PDEATHSIG
|
# ifdef WITH_PDEATHSIG
|
||||||
{"exit-on-parent-death", no_argument, NULL, _O_EXIT_ON_PARENT_DEATH},
|
{"exit-on-parent-death", no_argument, NULL, _O_EXIT_ON_PARENT_DEATH},
|
||||||
# endif
|
# endif
|
||||||
|
{"exit-on-device-error", no_argument, NULL, _O_EXIT_ON_DEVICE_ERROR},
|
||||||
{"exit-on-no-clients", required_argument, NULL, _O_EXIT_ON_NO_CLIENTS},
|
{"exit-on-no-clients", required_argument, NULL, _O_EXIT_ON_NO_CLIENTS},
|
||||||
# ifdef WITH_SETPROCTITLE
|
# ifdef WITH_SETPROCTITLE
|
||||||
{"process-name-prefix", required_argument, NULL, _O_PROCESS_NAME_PREFIX},
|
{"process-name-prefix", required_argument, NULL, _O_PROCESS_NAME_PREFIX},
|
||||||
@ -490,6 +492,7 @@ int options_parse(us_options_s *options, us_capture_s *cap, us_encoder_s *enc, u
|
|||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
# endif
|
# endif
|
||||||
|
case _O_EXIT_ON_DEVICE_ERROR: OPT_SET(stream->exit_on_device_error, true);
|
||||||
case _O_EXIT_ON_NO_CLIENTS: OPT_NUMBER("--exit-on-no-clients", stream->exit_on_no_clients, 0, 86400, 0);
|
case _O_EXIT_ON_NO_CLIENTS: OPT_NUMBER("--exit-on-no-clients", stream->exit_on_no_clients, 0, 86400, 0);
|
||||||
# ifdef WITH_SETPROCTITLE
|
# ifdef WITH_SETPROCTITLE
|
||||||
case _O_PROCESS_NAME_PREFIX: OPT_SET(process_name_prefix, optarg);
|
case _O_PROCESS_NAME_PREFIX: OPT_SET(process_name_prefix, optarg);
|
||||||
|
|||||||
@ -612,6 +612,10 @@ static int _stream_init_loop(us_stream_s *stream) {
|
|||||||
goto offline_and_retry;
|
goto offline_and_retry;
|
||||||
|
|
||||||
offline_and_retry:
|
offline_and_retry:
|
||||||
|
if (stream->exit_on_device_error) {
|
||||||
|
US_LOG_INFO("Device error, exiting ...");
|
||||||
|
us_process_suicide();
|
||||||
|
}
|
||||||
for (uint count = 0; count < stream->error_delay * 10; ++count) {
|
for (uint count = 0; count < stream->error_delay * 10; ++count) {
|
||||||
if (atomic_load(&run->stop)) {
|
if (atomic_load(&run->stop)) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -80,6 +80,7 @@ typedef struct {
|
|||||||
bool notify_parent;
|
bool notify_parent;
|
||||||
bool slowdown;
|
bool slowdown;
|
||||||
uint error_delay;
|
uint error_delay;
|
||||||
|
bool exit_on_device_error;
|
||||||
uint exit_on_no_clients;
|
uint exit_on_no_clients;
|
||||||
|
|
||||||
us_memsink_s *jpeg_sink;
|
us_memsink_s *jpeg_sink;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user