how about first documenting all requirements to the buffering mechanism and then try to design a solution that fits best? (sorry just my 2ct, I know more theory than practice, but sometimes standing back is quite usefull).
So what should the time shift buffer allow:
1. Each stream sent to a client should be buffered
2. Each stream buffer should hold at least min buff size bytes of stream to allow skipping
3. When a client changes channel or switches off, my idea: unused buffer is discarded, a new buffer is created viewing is started from the live point on.
4. When a client pauses a stream, the stream buffer continues recording to the buffer, playback is halted. Buffer grows unti lmax buff size is reached
5. When max buff size is reached, the server stops adding to this stream buffer
6. If another client is timeshifting of the same buffer which has grown to full size, and current client would miss data, a second buffer should be started and all currently viewing clients should be moved to the new buffer as soon as they pass the starting point of this buffer.
7. Any client can scan through all existing buffers for a given channel
8. Buffer shrinks to min buff size after all clients view point is past this point in the buffer (can be lazy).
Other requirements?
So what should the time shift buffer allow:
1. Each stream sent to a client should be buffered
2. Each stream buffer should hold at least min buff size bytes of stream to allow skipping
3. When a client changes channel or switches off, my idea: unused buffer is discarded, a new buffer is created viewing is started from the live point on.
4. When a client pauses a stream, the stream buffer continues recording to the buffer, playback is halted. Buffer grows unti lmax buff size is reached
5. When max buff size is reached, the server stops adding to this stream buffer
6. If another client is timeshifting of the same buffer which has grown to full size, and current client would miss data, a second buffer should be started and all currently viewing clients should be moved to the new buffer as soon as they pass the starting point of this buffer.
7. Any client can scan through all existing buffers for a given channel
8. Buffer shrinks to min buff size after all clients view point is past this point in the buffer (can be lazy).
Other requirements?