Since all channels were saved sequentially, this would cause huge lag
spikes every time the channel save interval fired. This change adds a
delay between each channel so that the additional load is spread evenly
across the save interval.
The error messages were a bit difficult for users to understand due to a
combination of including useless technical information and lacking
userful user information. The error messages are more verbose now and
give a better indication of what went wrong.
Instead of emitting frames to each individual socket, group them into
socket.io rooms of people who can see hidden poll results and people who
can't, then just do 2 broadcasts.
Refactored the ffprobe stream-selection logic to handle rejected files
better:
* Streams tagged as a non-default disposition are not considered
* If a file has any video stream, the audio stream will be ignored
This should prevent videos from being misreported as invalid audio
codecs, etc.
If clients call it quickly in succession with large playlists, it can
cause node to get stuck stringifying socket.io frames and cause an out
of memory crash.
CyTube has been crashing recently due to things attempting to release
the reference after the channel was already closed (apparently the
uncaughtException handler isn't called for this?). This newer
implementation keeps track of what is ref'ing and unref'ing it, so it
can log an error if it detects a discrepancy.
Also changed the server to not delete the refCounter field from the
channel when it's unloaded, so that should reduce the number of errors
stemming from it being null/undefined.