[MPlayer-dev-eng] [PATCH] watchpid slave command

Emmeran Seehuber rototor at rototor.de
Wed Aug 12 19:27:56 CEST 2009


[...]
>> This patch is useful if you build your own mplayer frontend and want
>> mplayer to exit if your frontend crashes. In our case we use mplayer in
>> our game Hive Rise (http://www.hiverise.com) to play ingame webradio. If
>> the game exits unexpectedly mplayer should stop playing. 

>The principle seems flawed to me: periodic polling is never a good option,
>and watching a PID is not reliable, because PID can be reused.

Yes this is true, there can be races. But usally the same PIDs are not given out again so fast. So I think/hope this is only a theoretical race.

>
>If your plumbing is done correctly, whenever your frontend crashed, mplayer
>should get an EOF condition on the slave fd: the best option is to make
>mplayer (optionally) exit on EOF from input fds. After a quick glance at the
>input code, I think this would require much less code than your patch.

The problem is that this not only affects slave input, it also affects slave output. At least on Windows mplayer blocks forever if it tries to write to a pipe which other side is no longer reading (because it is gone). Maybe on Linux mplayer would get a SIGPIPE here, but at least on Windows it does not get this and just plain simply hangs :( 

So it would be nessesery to check not only on input but also in mp_msg(). I´m not sure that a simple feof() checking before doing the fprintf() would be enough here. But I´ll try that when I find time.

Thanks for your comments.

cu,
  Emmy



More information about the MPlayer-dev-eng mailing list