[MPlayer-dev-eng] Bug in libmpdemux/cache2.c

Craig Shelley craig at microtron.org.uk
Sun Mar 14 15:34:01 CET 2004


Hi All,
I think there may be a bug in libmpdemux/cache2.c as of MPlayer-1.0pre3
When cache is enabled, the cache fill thread remains after mplayer has
been closed by the window manager. Using escape/q to quit works fine.

libmpdemux/cache2.c lines 284-293:

  
// cache thread mainloop:
  signal(SIGTERM,exit_sighandler); // kill
  while(1){
    if(!cache_fill((cache_vars_t*)s)){
	 usec_sleep(FILL_USLEEP_TIME); // idle
    }
//	 cache_stats(s->cache_data);
  }
}

This while loop remains running in the background, running strace -f on
mplayer, then closing the window produced the following output

[pid 12181] ioctl(7, FIONREAD, [0])     = 0
[pid 12181] gettimeofday({1079272556, 578096}, {0, 0}) = 0
[pid 12181] gettimeofday({1079272556, 578112}, {0, 0}) = 0
[pid 12181] write(7,
"\216\23\r\0E\0\0\0\1\0@\3\6\0@\3\7\0@\3YV12\0\0\0\0\0\0"..., 56) = -1
EPIPE (Broken pipe)	<-----I closed the window somewhere here
[pid 12181] --- SIGPIPE (Broken pipe) @ 0 (0) --- 
[pid 12181] +++ killed by SIGPIPE +++   
<... nanosleep resumed> NULL)           = 0
nanosleep({0, 50000000}, NULL)          = 0
nanosleep({0, 50000000}, NULL)          = 0
nanosleep({0, 50000000}, NULL)          = 0
nanosleep({0, 50000000}, NULL)          = 0
nanosleep({0, 50000000}, NULL)          = 0
nanosleep({0, 50000000}, NULL)          = 0
nanosleep({0, 50000000}, NULL)          = 0
nanosleep({0, 50000000}, NULL)          = 0
nanosleep({0, 50000000}, NULL)          = 0
nanosleep({0, 50000000}, NULL)          = 0
nanosleep({0, 50000000}, NULL)          = 0
^----this line repeats forever



>From the signal(2) manual page:
NOTES
       The effects of this call in a multi-threaded process are
unspecified.



I would imagine some other form of checking is required within this loop
to determine if the parent thread is still running.

Hope this helps with the development...

-- 
Craig Shelley <craig at microtron.org.uk>

Homepage: <http://www.microtron.org.uk>




More information about the MPlayer-dev-eng mailing list