[vlc-devel] [PATCH 4/5] stream_ReadLine: support arbitrary length limit

Pierre Ynard linkfanel at yahoo.fr
Tue Sep 8 16:26:44 CEST 2020


> In that case, a readchunk() returning (for example) 4Kb regardless of
> line separation should also work, shouldn't it? (the script would just
> have to call readchunk() again after anchoring on the beginning of the
> tag)

Yes. But it's troublesome as it consumes potentially too much data from
the stream, and it makes it difficult to properly return to a readline()
model afterwards, and not miss any other piece of data you need that may
or may not have been returned within or across the boundary of those 4
kB.

Requesting big arbitrary chunks can also degrade performance compared to
a line-based model as you have to wait for the network and that whole
chunk to be received before you can start processing it, and it can
delay parsing and then loading of the media.

The fix I implemented for youtube.lua does indeed take a similar
approach, but using peek() which doesn't consume the stream data, after
I realized that peek() was exposed to lua playlist scripts (for their
underlying main stream object at least):

https://git.videolan.org/?p=vlc.git;a=commitdiff;h=e3378ac3a892728bb8775d1bd243b31fa721ba49

-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the vlc-devel mailing list