SIGCONT causes fast-forwardffect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]<

 



Hi,
I have bash based cgi script set which uses mplayer in a while loop
thatuns as a bg process. It passes values from a form based web
page (viaOST). I use SIGSTOP & SIGCONT for pause and resume functions.

When I click 'resume'nd the mplayer loop is un-paused, it seems to
wanto fast forward to where it should be in time. So if you pause it
for one minute,hen resume, it sounds like it is on fast forward for a
second oro, until it is where it would have been in the song had the
process not been frozen. Thenverything plays normally.

Here ishe relevant part of the code:
pressing pauseuns:
 kill -s SIGSTOP `/sbin/pidof mplayer` &> /dev/null

pressingesume runs:
 kill -s SIGCONT `/sbin/pidof mplayer` &> /dev/null 

(I haveried removing the stdout/err redirs as well)

Here ishe mplayer loop. Note the bg call after 'done' putting the
entireoop in the background via a previous iteration of the
script (via cgi call to 'play').

 whileead TRACK
  do
    #nipped some 'now playing' status tracking etc

   ${MPLAYER} -quiet ${TRACK} < /dev/null &> /dev/null

    #nipped some 'now playing' status tracking etc
  et TRACK_NUM=TRACK_NUM+1
  done < ${PLAY_LIST} &> /dev/null &

The player needso be in the background, so I don't think there is a
wayo pass a keystroke to a process running in the bg of a different
shell.

I caneproduce it at the cli with this, which just replicates the cgi
POST: (thenun SIGSTOP etc from a diff shell (same user))

QueryString="song=%2Fdata%2Fmedia%2Fmusic%2Falbums%2FGenesis%2FNursery_Cryme-72_1.flac%3C%2Ftd"
export QueryString
./cm_playing-cgi.sh

However, notsing the cgi, it is fine, just SIGSTOP mplayer, then
SIGCONT (diffhell) it works as expected. (note the line wraps!)

mplayer /data/media/music/albums/Genesis/Nursery_Cryme-72_1.flac
< /dev/null &> /dev/null &


As wild guess I would say that mplayer is not aware it is paused
athe process level (related to being in a bg'd while-loop??), so
when it isesumed it tries to catch up to where the system clock or
someimer says it should be. I'm thinking I need to tell it not to
synco the real time, but just carry on.

Doesnyone have any ideas what causes this and how I can prevent it?

Thanks.
Pete

-- 
Pete Nesbitt

http://www.linux1.ca


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux