This interface is implemented by a SourceStream that caches
downloaded data for fast delivery to the handler. It provides control
over enabling/disabling the buffering and provides a way to query if
a certain number of bytes are available to be read from the stream.
Buffering here refers to jitter-buffering. Buffering is normally enabled.
It enables smooth playback even if the incoming data rate fluctuates.
The amount of buffering is implementation dependant.
When parsing the header of a media file, the parser
may want to read a few bytes to check for say a valid
magic header; if the magic header is illegal, the
parser can throw a BadHeaderException. The parser
may build several tables and extract media track
information.
The parser typically doen't need to wait for the buffers to be
filled.
So it is desirable to turn off buffering when parsing the
header and turn it on after the header is read.
This won't have any effect on playback smoothness
since playback cannot start until the header is parsed. |