cache_block, cache_read, prefetch, record plugins?

This forum is about all development around libVLC.
oviano
Cone that earned his stripes
Cone that earned his stripes
Posts: 120
Joined: 12 Jan 2012 11:12

cache_block, cache_read, prefetch, record plugins?

Postby oviano » 31 Mar 2019 21:47

More of a general Q - I am trying to understand what each of these do and how they fit in with using the imem callback input.

If I remove these plugins then my code still works, so what is their precise purpose, as I cannot find any high level documentation.

I observe:

- that it tries to use “prefetch, cache_read” preferring the prefetch.
- it always tries to include “record” in the chain.
- it doesn’t seem to use “cache_block”.

My guess:

prefetch - gather enough data first before allowing the demuxer to parse it or something? What might go wrong if this isn’t used?
cache_read - gets used if I remove prefetch. How does it differ from prefetch?
record - some sort of hook to be able grab the bytestream and write it out again or something?

I’m using imem with my data coming across the Internet. Like I say if I remove these plugins my app seems to work but of course I don’t want to then have issues with sone edge cases or something.

I realise this is a bit of a vague request, just trying to understand what is needed for a minimal libvlc-based application.

unidan
Developer
Developer
Posts: 1493
Joined: 25 Mar 2018 01:00

Re: cache_block, cache_read, prefetch, record plugins?

Postby unidan » 01 Apr 2019 10:30

Hi, VLC is pipelined with different modules. When you have started the pipeline (after the Open() sequence of every module), the pipeline is fixed and can't be modified as it is autoconfigured and adding/removing a module might need a configuration change or new module load. So a pipeline change is a pipeline reconfiguration/creation. If you want to be able to record the stream, it means that you need a bypassed module ready to be enabled in the pipeline. Thus the record module which is idle if you don't use it.

Then, prefetch is what you think of, and if you don't have this but your access is slow, you can have stuttering (it acts like the beginning of a playback on youtube or other streaming services). So it's mostly to have a smooth startup of the playback.

cache_read/cache_block are there to compensate jitter in the playback, for example on youtube, it would be the grey bar indicating how much have been buffered. I'm not too knowledgeable on this so I can't really enter into the details. Both prefetch and cache modules are loaded at the beginning of a stream, see stream_AccessNew function for details. ;)

> I realise this is a bit of a vague request, just trying to understand what is needed for a minimal libvlc-based application.

For a minimal libvlc-based application, you might not even need to go this low level.

oviano
Cone that earned his stripes
Cone that earned his stripes
Posts: 120
Joined: 12 Jan 2012 11:12

Re: cache_block, cache_read, prefetch, record plugins?

Postby oviano » 01 Apr 2019 12:48

Thank you very much for that!

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: cache_block, cache_read, prefetch, record plugins?

Postby Rémi Denis-Courmont » 01 Apr 2019 17:21

It depends on the type of stream which one is used. They all do the same thing - caching, just different strategies.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

oviano
Cone that earned his stripes
Cone that earned his stripes
Posts: 120
Joined: 12 Jan 2012 11:12

Re: cache_block, cache_read, prefetch, record plugins?

Postby oviano » 01 Apr 2019 21:24

In my case it’s a stream received over the internet using a custom protocol but much like HLS in that it sends chunks. I then pass this data into libvlc using imem, although with certain settings of my player app it may buffer a number of chunks before passing them to libvlc.

Trying to figure out if there is any point in using the libvlc caching plug-ins.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 5 guests