Skip to content

Instantly share code, notes, and snippets.

@gkatsev
Last active August 29, 2015 14:07
Show Gist options
  • Save gkatsev/fc0fc7fa5603fe346e59 to your computer and use it in GitHub Desktop.
Save gkatsev/fc0fc7fa5603fe346e59 to your computer and use it in GitHub Desktop.

Mid-segment switching

Things to aim for

  • turn the in-memory buffer from segments to tags
  • in drainBuffer, seed in enough tags so that 1s (less? more?) of content is in there, with at least a delta of one keyframe
  • when new segments arrive, replace overlapping tags in the in-memory buffer
    • never replace tags in previous discontinuities

Equations

Vars

  • current segment duration: tₖ
  • proposed segment download estimate: tₙ
  • proposed next segment download estimate: tₙ₊₁
  1. tₙ₊₁ + tₙ < tₖ
  2. tₙ < tₖ * 1/2
@gkatsev
Copy link
Author

gkatsev commented Sep 30, 2014

  • current segment duration: tc
  • proposed segment download estimate: tn
  • proposed next segment download estimate: tn+1
  1. tn+1 + tn < tc
  2. tn < tc * 1/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment