[vlc-devel] Getting stuck in stream_Read()

Frederic YHUEL fyhuel at viotech.net
Wed Apr 4 22:20:19 CEST 2012


2012/4/4 Rémi Denis-Courmont <remi at remlab.net>:
> Le mercredi 4 avril 2012 18:39:15 Frederic YHUEL, vous avez écrit :
>> Pressing stop has no effect in that case. You told about a
>> interruption/exception mechanism, could you be a little more verbose
>> about how I should implement that?
>
> There are no general rules how to do it. It is the plugin's responsibility
> neither to get stuck nor to poll.
>
> This is a non-issue for regular files as read() is non-blocking/non-
> interruptible. Most demuxers rely on the fact that stream_Read() will return
> quickly, and then pf_demux will return. At that point, the main loop of the
> input thread will stop.
>
> For access_demux plugins, the easiest and cleanest solution (IMHO) consists of
> setting pf_demux to NULL. Then a custom thread is used to feed the ES output,
> the input thread does not get blocked, and pf_deactivate will be called as
> soon as the user presses stops. RTP and XCB screen do that, and soon V4L2.
>
> For network access plugins, the waitpipe hack is used to wake up poll() inside
> the input thread. Most network access plugins use that, including HTTP and
> FTP.
>
> Then there are bugged plugins that must not be used as examples. Some just get
> stuck like live555. Others keep polling like DTV or avio.
>

Ok, thank you very much for the detailed answer!

-- 
Frédéric



More information about the vlc-devel mailing list