From: David Meybohm <dmeybohm@be...> - 2004-01-15 03:26:33
On Wed, Jan 14, 2004 at 08:59:31PM -0500, David Meybohm wrote:
> The cvs version will crash in playPlaylist when mplayer doesn't send a
> '\r' in it's output. This just reuses the message if there is no '\r'
> there. Makes sense?
There's more to it than this..my patch only prevents the crash
(For me, the crash happens when the cachesize is small). But it still
looks like the display can be corrupted, with or without that patch.
This happens because using fgets() on the mplayer pipe can cut into the
middle of mplayer's output...So, mplayer writes a string like "Cache
fill: ...\rCache fill: ...\rCache fil" <-- end of 4096 buffer. Then,
the UI gets updated with the string "Cache fil".
Any good ideas on how to fix that? I was thinking about writing a
little-fgets implementation that also stops on '\r' as well as '\n', and
putting that in the outer loop reading from mplayer. But DrawUI calls
usleep, so it would not be good to delay reading from the mplayer pipe
just to update the UI.