I'm not trying to convince you to surrender. I'm just pointing out the difference between audio and video and how the boatload of renderers I've had to deal with act. We will try something. It will likely work for most but not all renderers.
I'd like to add that I ALWAYS appreciate your thoughtful analysis!
Ah Ok bob, many thanks for the gracious comment.
I think the issue breaks down into the following sub topics:
1) How to calculate Content-Length as accurately as possible in the first place? I suggest to set the transcoder maxRate and minRate switches both to a value N and then set Content-Length := N X (duration X (1 + F)) -- where F := 3% extra safety factor (say)
2) How to handle a regular GET on the transcoded stream? Keep serving the content stream until the transcoder is done and then close the socket. Depending on the accuracy of N and the safety factor F above, you might actually serve fewer bytes (or in extreme cases more bytes) than the calculated Content-Length. Some renderers keep pulling bytes until the server closes the socket (in which case there is usually no problem). Some renderers keep pulling bytes until the played duration has expired, and some only pull the Content-Length number of bytes and then close the socket themselves (in both these cases it is important that the safety factor F is greater than zero).
EDIT: apropos "keep serving the content stream until the transcoder is done and then close the socket", if the MC server is pushing the track, the alternative approach could be "keep serving the content stream until the transcoder is done and then send the Seek(Next) and/or Stop() command" -- however I have not tested that myself...3) How to handle a GET with a Range-bytes offset? If the byte offset is within the previously announced Content-Length, then always respond with Http 206 Partial Content and deliver the requested number of bytes from approximately the right part of the track. If the Range-bytes window is close to the end of the track, (i.e. if the window would lie inside the safety factor F of the putative Content-Length) then tweak the Range-bytes offset by an amount such that the request can always be satisfied with real bytes from before the end of the transcoded stream. Basic rules: never fail a valid Range-bytes request; always deliver some valid stream bytes. (Keep in mind that the renderer has no way of knowing if the stream bytes are from the exact part of the stream that it requested; and even the user would in general be satisfied if the stream bytes are not too far away from the perfect requested location..)