Ticket #2434: mythplayback.diff

File mythplayback.diff, 2.1 KB (added by tomimo@…, 14 years ago)

This patch fixes the incorrect locking of pausevideo-variable & videoThreadPaused-conditional.

  • libs/libmythtv/NuppelVideoPlayer.h

     
    521521    QWaitCondition decoderThreadPaused;
    522522    QWaitCondition videoThreadPaused;
    523523    QMutex   vidExitLock;
     524    QMutex   pauseLock;
     525    bool     pause_signal;
    524526    bool     eof;             ///< At end of file/ringbuffer
    525527    bool     m_double_framerate;///< Output fps is double Video (input) rate
    526528    bool     m_can_double;    ///< VideoOutput capable of doubling frame rate
  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    150150      eof(false),                   m_double_framerate(false),
    151151      m_can_double(false),          paused(false),
    152152      pausevideo(false),            actuallypaused(false),
     153      pause_signal(false),
    153154      video_actually_paused(false), playing(false),
    154155      decoder_thread_alive(true),   killplayer(false),
    155156      killvideo(false),             livetv(false),
     
    451452
    452453void NuppelVideoPlayer::PauseVideo(bool wait)
    453454{
     455    pauseLock.lock();
    454456    video_actually_paused = false;
    455457    pausevideo = true;
    456458
    457459    if (wait && !video_actually_paused)
    458460    {
    459         while (!videoThreadPaused.wait(1000))
     461        while (!pause_signal && !videoThreadPaused.wait(&pauseLock, 1000))
    460462        {
    461463            if (eof)
     464            {
     465                pause_signal=false;
     466                pauseLock.unlock();
    462467                return;
     468            }
    463469            VERBOSE(VB_IMPORTANT, "Waited too long for video out to pause");
    464470        }
    465471    }
     472    pause_signal=false;
     473    pauseLock.unlock();
    466474}
    467475
    468476void NuppelVideoPlayer::UnpauseVideo(void)
    469477{
     478    pauseLock.lock();
    470479    pausevideo = false;
     480    pause_signal=true;
     481    pauseLock.unlock();
     482    videoThreadPaused.wakeAll();
    471483}
    472484
    473485void NuppelVideoPlayer::SetPrebuffering(bool prebuffer)