This was done because I don't know why this wouldn't build on circleci with the standard pi audio command in pi.go.
cmd/treatment: merge pi.go into main.go
There's no need for two files
Approved-by: Alan Noble
When the speaker is powered on, the getAudioPath function is used to find the file path of the audio file to be played. This allows custom audio to be played without a network connection.
When the the audiofilepath is updated, the url will be checked if it has been downloaded before, and use the cache if available. Files are stored in /home/pi/<url> which should be unique for all audio files. The location of the current audio file being played is saved to /etc/netsender/treatment.conf.
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
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
In the Noop lexer we start a routine that's responsible for output
of the written frames at a consistent rate (to make certain
destinations happy i.e. youtube). We weren't however returning
from this in the case that the lexing function is returned, we'd
therefore then be left with a hanging routine (this would
eventually keep happening until stack overflow if had long enough
runtime for the service; not a big deal for systemd services, but
still crappy). So, now we create a context which is cancelled when
when the lex function returns and can detect this in the output
routine.
Approved-by: Alan Noble
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
audio-netsender: Fix sample rate validation
* audio-netsender: Fix sample rate validation
This change makes a simple change that makes the function compare the requested sample rate against the valid rates instead of the indices of the valid rates.
Approved-by: Alan Noble
A wav encoder will be useful for returning easily playable audio files to users of vidgrind that are not familiar with PCM audio. Currently the encoder only support PCM data, but can be updated with other types. The encoder implements the writer interface.
* codec/wav: Add unit tests for wav encoder
Merged in create-wav-encoder (pull request #529)
Approved-by: Trek Hopton
(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
This is done so that a SCUHU users can see the pi IP address has connected to their hotspot without having to then log in via SSH to turn the wifi off before deployment.
Approved-by: David Sutton
* revid: reordered the file write method to exit earlier and remove a flag that wasn't needed
* revid: add comments to MaxFileSize to specify that it is in bytes
Approved-by: Alan Noble
Approved-by: Saxon Milton
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
The reader and writer pipes should be created on call to Start
and not in NewManualInput. This is so that if Close is called,
which will close the reader and the writer, a call to start will
create them again.
Approved-by: Alan Noble
Approved-by: David Sutton
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.
Using a env var in CircleCI, these tests will be skipped when commits are pushed to bitbucket.
NOTE: this is a temporary patch, and these tests should be properly reviewed.
Approved-by: Trek Hopton
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.
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
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
Config.RTMPURL was being appended when updated, which means that
it would just continue to grow, and by the time we actually try
to use the RTMP URLs that are stored, we end up using old ones.
Instead this should just be completely replaced.