We should allow users to configure how many simultaneous ffmpeg instances are running at any single time, with more recent stream/concat process pairs favored.
The reason we need this is because some session-based streaming uses an inactive timeout before killing the backing ffmpeg processes. So, when flipping quickly between channels, users can theoretically spawn many ffmpeg processes while Tunarr waits for the inactive signal. Instead, we can be proactive in scenarios like this and just start killing the longest-lived process pairs. If we want to get really clever, we could also key this by client so one client cannot kill another's stream, but this option can be added later.
This is especially necessary now as the default streaming setup for MPEGTS will spawn 3(!) ffmpeg processes: 1 for the underlying stream, 1 to great HLS segments, and 1 to concat those segments back together
We should allow users to configure how many simultaneous ffmpeg instances are running at any single time, with more recent stream/concat process pairs favored.
The reason we need this is because some session-based streaming uses an inactive timeout before killing the backing ffmpeg processes. So, when flipping quickly between channels, users can theoretically spawn many ffmpeg processes while Tunarr waits for the inactive signal. Instead, we can be proactive in scenarios like this and just start killing the longest-lived process pairs. If we want to get really clever, we could also key this by client so one client cannot kill another's stream, but this option can be added later.