Commit Graph

41 Commits

Author SHA1 Message Date
Saxon Milton 2dd2c464c6 Simplify createOrUpdate method
Every time we want to create or update, let's just start a new
revid pipeline. Now that our frequency of requests to vidforward
to create or update are much lower (because of the new state
machine) we can deal with the overhead of creating a new pipeline
and reduce the complexity of the code.

Approved-by: Trek Hopton
2024-04-10 22:17:40 +00:00
Saxon Milton b992358fd6 Recover control request panics
When running a go service, especially as a background systemd
service, it's not obvious when there is a panic in a handler, so
we're now recovering any panics on our level and logging.

Approved-by: Alan Noble
2024-04-07 11:48:15 +00:00
Saxon Milton 66a1687316 Print stacktrace in questionable situations
It would be useful to see what the stack looks like when we get
consecutive watchdog patting failures. We can then try to work out
what's ultimately causing this issue.

Approved-by: Trek Hopton
2024-04-07 20:19:59 +09:30
Saxon Nelson-Milton a40faaa23e Increase debug logging 2024-04-07 00:48:40 +00:00
David Sutton d9301fe40c file_test.go: Update Tests (#421)
(b *Broadcast) UnmarshalJSON no longer starts revid (see PR #510).

(m *BroadcastManager) MarshalJSON no longer needs to worry about slate exit signals due to broadcast status (see PR #511).

Merged in 421-fix-JSON-marshalling (pull request #528)
Approved-by: Saxon Milton
2023-10-20 08:27:06 +00:00
Saxon Milton 524e010fe1 * vidforward: actually set revid pipeline
We need to actually get the returned value from
initOrStartPipeline and set the pipeline.

* vidforward: add some logging to config load

* vidforward: update utils version

Approved-by: Alan Noble
Approved-by: Trek Hopton
2023-10-14 00:49:42 +00:00
Saxon Milton 072f069d1a Merged in init-or-start (pull request #514)
vidforward: initOrStartPipeline

This function checks whether a revid pipeline has been created,
and if not creates it. It then also checks to see if it has been
started, and if not, starts the pipeline.
2023-10-14 00:32:10 +00:00
Saxon Nelson-Milton 4587f31c42 vidforward: remove run_script from create_service.sh
We no longer use a run script; the vidforward executable is started
directly from the service.
2023-09-20 21:59:35 +00:00
Saxon Nelson-Milton 79d3e7280b vidforward: Remove RUN_SCRIPT_DIR parameter from Makefile
This is no longer needed considering there's no longer a run
script; instead we call the binary directly in the service file.
2023-09-20 21:57:36 +00:00
Saxon Nelson-Milton e4263464ef vidforward: remove reference to non-existent run.sh file
This file used to be used for startup, but now we just start the
process directly in the service. It probably existed in the dir
last time this was tested so no errors were thrown, but on a clean
install this was a problem.
2023-09-20 21:57:18 +00:00
Saxon Milton 19eafa3228 vidforward: save manager state at end of process request
As added redundancy, let's save the manager state at the end of
the process request method as well.
2023-09-20 21:25:04 +00:00
Saxon Nelson-Milton 1621dc709b vidforward: add SIGKILL to signal.Notify for term callback
Just for further redundancy, let's also call the termination
callback (which saves the manager state in our case) for SIGKILL.
2023-09-19 10:47:10 +00:00
Saxon Milton da9ed6d689 vidforward: getPipeline handles revid creation and start
It simplifies things if getPipeline handles creation and starting
of the revid pipeline. We don't need to be doing this in multiple
places.

Approved-by: Trek Hopton
2023-09-18 23:28:51 +00:00
Saxon Milton 4087be907a vidforward: simplify manager file save/load
When saving and loading manager state to and from file, we don't
need to worry about the slate exit signals. Now that we have
broadcast status i.e. "play" or "slate", we can derive whether we
need an exit signal based only on that.

Approved-by: Trek Hopton
2023-09-18 23:25:28 +00:00
Saxon Nelson-Milton db84c5bfcf Use correct log level global variable 2023-09-17 23:16:30 +00:00
Saxon Nelson-Milton 16df4ed2aa Add more logging to createOrUpdate function
It'd be useful to see more of what's going on in here.
2023-09-17 11:03:30 +00:00
Saxon Nelson-Milton ee7cb57fe5 vidforward: global logger returns underlying logger
The globalLogger type wraps a logger.Logger. If you use GetLogger
which gets the global logger (which provides an interface
logger.Logger) a type assertion to JSONLogger will fail, because
the type is actually globalLogger. We need to provide the
underlying logger instead when we return from GetLogger.
2023-06-23 23:40:30 +00:00
Saxon Nelson-Milton 9080a5d2c1 vidforward: improve non-active mechanism
This change improves the mechanism that deals with recv requests
from non active macs. We're no only logging every minute so that
we don't clutter the logs. We're also dealing with both non active
and slate recvs with the same mechanism using a switch.
2023-06-21 20:19:33 +09:30
Saxon Nelson-Milton 26e77709aa vidforward: only update broadcast if changed
For control requests, we only update aspects of the broadcast if
they have changed. Therefore, if the urls list has not changed
the revid pipeline is not updated, similarly if the status has
not changed, we don't do anything there.
2023-06-21 20:03:39 +09:30
Saxon Nelson-Milton bcbb187bef vidforward: add config file watcher
This change adds a file watcher and then uses this file watcher
to perform updates based on changes in a configuration file. This
configuration file contains logging parameters for the time being
in the hope that it will help with debugging.

Testing was also added for this functionality.
2023-06-21 19:48:02 +09:30
Saxon Milton 853aa31260 Merged in handle-slate-upload (pull request #503)
Add slate request handler

Resolves issue #385

Approved-by: Trek Hopton
Approved-by: David Sutton
2023-06-14 21:23:43 +00:00
Trek H 8eb407e918 removed nocv tag from Makefiles 2023-05-29 15:19:05 +09:30
Saxon Nelson-Milton 382f202bb0 Add slate request handler
This change adds a request handler for /slate. This endpoint can
now be used to upload a new slate file.
2023-05-27 09:42:46 +09:30
Saxon Nelson-Milton 418b33040c vidforward/file.go: check length of urls on load 2023-03-13 12:37:03 +10:30
Saxon Nelson-Milton c82d7a8e55 vidforward: use consistent revid construction function 2023-03-12 19:40:26 +10:30
Saxon Milton a4754e5ead Merged in revid-rtmp-url-slice (pull request #496)
revid: accept multiple RTMP outputs

Approved-by: Alan Noble
2023-03-11 22:59:12 +00:00
Saxon Nelson-Milton 7055edb525 cmd/vidforward: start revid pipeline on load 2023-03-12 08:39:21 +10:30
Saxon Nelson-Milton 0059ec1017 vidforward: modify viforward to accept multiple RTMP URLs
This change modifies vidforward to accept multiple RTMP URLs in
its control request handler. This allows for the creation of a
revid pipeline for a mac with multiple RTMP outputs.
2023-03-05 08:39:39 +10:30
Saxon Nelson-Milton f9cfbda44f Load broadcast state on startup 2023-02-16 10:18:15 +10:30
Saxon Nelson-Milton b68da55793 Fix slate path 2023-02-09 01:39:57 +00:00
Saxon Nelson-Milton adc62a6442 Improving logging 2023-02-08 17:15:30 +10:30
Saxon Nelson-Milton 683bb923cb Fix various vidforward issues
This change fixes some bugs relating to the Makefile and the
systemd watchdog notifier system. We have also removed the run.sh
script which was the culprit of latter problem (not sure exactly
how, but probably something to do with PIDs).
2023-02-08 16:41:52 +10:30
Saxon Nelson-Milton 842e2a2d93 Add functionality for broadcastManager state save
This change adds functionality for broadcastManager state save.
This is done by marshalling the broadcastManager and saving to a
file. Loading is performed by unmarshalling an re-populating a
broadcastManager value. Testing has been added for this
functionality. Other functionality has been added a side effect.
2023-02-04 12:29:47 +10:30
Saxon Nelson-Milton 5a07b6ed5f cmd/vidforward: add Makefile and service setup script
This change provides a Makefile that will build the vidforward
service binary and also utilise a script to setup of a systemd
service for this binary.
2022-12-05 20:16:31 +10:30
Saxon Nelson-Milton 8f8b9ca0f4 cmd/vidforward: add watchdog notifier
This change adds a "watchdog notifier" utility which tracks the
health of request handlers and notifies an external systemd
watchdog if everything looks good. This allows us to cause a
termination if any request handlers get hung.
2022-12-05 19:54:14 +10:30
Saxon Nelson-Milton 3ea4aff365 cmd/vidforward: restructure code
This change creates two new files. Firstly, slate.go, to house
slate related functionality. Secondly, utils.go to house generic
utilities and helpers.
2022-11-27 10:07:04 +10:30
Saxon Nelson-Milton f3cf74ce51 cmd/vidforward: add slate image write functionality
This includes adding facilities to handle termination signals
and err handling. Some modifications have been made to the file
input to accomodate the concurrency requirements. The slate
read mechanism is still fairly rudimentary and can only read
from a hardcoded file, but at this stage is for prototyping
purposes.
2022-11-26 13:38:25 +10:30
Saxon Nelson-Milton a4a9ab07f8 cmd/vidforward/main.go: add control API endpoint with PUT and DELETE methods
This change removes usage of netsender to provide remote
configuration of the service and replaces with a basic control
REST API with PUT and DELETE methods. PUT requests add or update
a broadcast, and DELETE removes a broadcast. In addition to these
changes, some modification of the NOOP lexer has been performed
including tuning of the controller.
2022-11-14 20:46:21 +10:30
Saxon Nelson-Milton dddfcc256b vidforward & codecutil & mts & device & revid: improved Noop lexer code using ring buffer structure and improved overall commenting and code 2022-09-21 16:47:58 +09:30
Saxon Nelson-Milton b312774b49 cmd/vidforward & revid & device & codec/codecutil: fixes bugs and improving stream quality 2022-09-14 07:44:35 +00:00
Saxon Nelson-Milton 46e97debd5 cmd/vidforward & revid: initial implementation of vidforwarding software 2022-09-09 11:24:29 +09:30