I got a following setup: incoming stream is retranslated to clients via DVR.
Incoming stream has some timing (like, time indication in top left corner), and I need to sync outcoming streams with it. Current synchronization works like this:
// This will be calculated once at the start of the flashlet:
dvrStartingPosition = serverTime - (playheadTime + dvrTrait.timeOffset)*1000 - LATENCY; // calculates starting timestamp for current dvr session
// This will be calculated every time I want to know time of the incoming stream
currentTime = dvrStartingPosition + (playheadTime + dvrTrait.timeOffset)*1000;
LATENCY here is a latency between incoming and outcoming stream. I'm more interested in making it constant than in minimizing it. Is there any way to achieve that? Or, maybe, any suggestions for synchronizing logic?