[vlc-devel] [vlc thread priority] decode thread priority

Rémi Denis-Courmont remi at remlab.net
Tue Jul 31 16:32:15 CEST 2012

Le mardi 31 juillet 2012 17:06:52 Hong Aaron, vous avez écrit :
> As i am using HW decoder, So I raise the decoder thread
> priority to high priority( above input and gui thread, but below display
> thread), and I tested for decoding time for each frame cost about 12ms,
> btw, I set file cache to 5 second.

Increasing cache may cause more problems than it solves. Depending on the 
frame rate, 12 picture buffers obviously, the cache should be less than half a 
second... Otherwise, the decoder will constantly run out of output buffers.

I do not recall very well what the video output logic is, but basically:
- either the decoder will wait for buffers, nullifying the long file cache,
- or the decoder will allocate extra picture buffers in anonymous memory, 
increasing overhead for the video output rendering.

> I want confirm with you guys, Is raising decoder thread priority for HW
> decoder and and event flag for decoder to wait method reasonable ?

I don't think it will have any meaningful effects. Your mileage may vary.

In any case, it won't have any effect at all unless VLC has sufficient 
privileges to raise thread priority above SCHED_OTHER.

> Is there any side effect ? Any hint to solve the drop frame problem ?

In principle, it will favor video decoding over the rest. It might affect 
audio and UI negatively, and even the input and video output threads. Thus it 
might in fact be worse rather than better.

There is no generic answer to solving frame drop. You'd need to find what is 
actually causing the drop, e.g. memory/bus congestion, CPU starvation, etc.

Rémi Denis-Courmont

More information about the vlc-devel mailing list