[haiku-development] Re: Streaming Fixes for the Plugin Manager

  • From: "Adrien Destugues" <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 03 Mar 2016 10:59:00 +0000

This is what I would have thought without having thought it through:
Preconditions:
1) We should avoid refetching data whenever possible (for example, while 
sniffing)
2) Many streams are actually positionable to allow for seeking (HTTP is 
usually positionable).
3) Therefore, we need to differentiate between streams that are truly non 
seekable, and those that
are.

There are a few more caveats:
a) Currently our API for seekable streams (BPositionIO) assume they have a 
(fixed) size. This is not the case if you listen to a web radio, for example, 
which is an endless stream of data.
b) In the case of ffmpeg, in some cases it will try to seek to the end of a 
file to sniff data there and detect the format. This is not possible on such 
infinite streams, of course.
c) Adding a seekable overlay onto a mostly streamed media is easy: you can just 
download it all and let it sit in memory (or in a seekable file). The real 
problem is knowing when data is not needed anymore and can be dropped.

For c) at a minimum we need to know if we are in the sniffing state (data can 
be read multiple times, possibly by different plugins), or in "runtime" (ffmpeg 
has started decoding the stream, now there should be mostly no seeks). Once in 
runtime we can decide to allow only pause and fast-forward for really streamed 
data, or we can decide to keep some megabytes behind the current play time 
buffered to allow some seeking a few minutes back.

-- 
Adrien.

Other related posts: