The streaming, which should be unlimited, needs indeed quite a different approach from transcoding, which is always limited to one or two session.
That's why I said we need to think about this.
A proper approach might be to drop the fork() altogether and use threads instead, it may not be that much work. Then for transcoding always use one thread. If another transcoding requests comes in, drop the current transcoding connection and continue on the new connection. For streaming threads, do actually spawn a new thread.
This will mean only one transcoding session can be started, even if the receiver supports two. That's not a big deal as it seems:
- most receivers have limitations on when a second transcoding session can be used (e.g. receiver needs to be in standby, source needs to be < UHD, or PiP needs to be off)
- for the die-hard transcoders, they could run a second instance of streamproxy on an alternative port
This would make the design a lot less complex.
When I first started streamproxy, quite a few years ago, it wasn't clear at all what transcoding capabilities future receivers would have. They might have ten transcoders or more, who knows. Now we know there are no receivers that more than two transcoders and even then they're limited.
Edited by Erik Slagter, 7 March 2019 - 20:36.