Ticket #3692: 3692-v1-alt1.patch

File 3692-v1-alt1.patch, 2.5 KB (added by danielk, 17 years ago)

Alternate potential fix

  • libs/libmythtv/dvbrecorder.cpp

     
    619619                   add_stream_type[i], kFilterPriorityHigh);
    620620    }
    621621
    622 
    623622    // [Re]start dummy video
    624623    StartDummyVideo();
    625624
     
    13131312void *DVBRecorder::run_dummy_video(void *param)
    13141313{
    13151314    DVBRecorder *dvbrec = (DVBRecorder*) param;
     1315    dvbrec->_stop_dummy = false;
     1316    dvbrec->_dummy_stopped = false;
    13161317    dvbrec->RunDummyVideo();
    13171318    dvbrec->_dummy_stopped = true;
    1318     dvbrec->_wait_stop.wakeAll();
    13191319    return NULL;
    13201320}
    13211321
     
    13581358    _ts_change_count = 0;
    13591359
    13601360    // Start the dummy video thread.
    1361     _stop_dummy = false;
    1362     int ret = pthread_create(&_video_thread, NULL, run_dummy_video, this);
    1363     _dummy_stopped = (0 != ret);
     1361    pthread_create(&_video_thread, NULL, run_dummy_video, this);
     1362    while (_dummy_stopped)
     1363        usleep(50);
    13641364}
    13651365
    13661366void DVBRecorder::RunDummyVideo(void)
     
    13901390
    13911391    unsigned long frameTime = (unsigned long)(1000 / _frames_per_sec);
    13921392    int64_t last_synch = 0;
    1393     _wait_time.wait(frameTime * 4); // Initial wait
     1393    _wait_time.wait(frameTime * 5); // Initial wait
    13941394
    1395     while (! _stop_dummy)
     1395    while (!_stop_dummy)
    13961396    {
    1397         _wait_time.wait(frameTime);
    13981397        _ts_lock.lock();
    13991398        int64_t synch_ts = _synch_time_stamp;
    14001399        _ts_lock.unlock();
     
    14171416        {
    14181417            CreateVideoFrame(); // Just generate one frame
    14191418        }
     1419        _wait_time.wait(frameTime);
    14201420    }
    14211421
    14221422    close(_video_stream_fd);
     
    14261426// Stop the dummy video thread
    14271427void DVBRecorder::StopDummyVideo(void)
    14281428{
    1429     while (!_dummy_stopped)
    1430     {
    1431         _stop_dummy = true;
    1432         _wait_time.wakeAll();
    1433         _wait_stop.wait(1000);
    1434         pthread_join(_video_thread, NULL);
    1435     }
     1429    if (_dummy_stopped)
     1430        return;
     1431
     1432    _stop_dummy = true;
     1433    _wait_time.wakeAll();
     1434    pthread_join(_video_thread, NULL);
    14361435}
    14371436
    14381437void DVBRecorder::CreateVideoFrame(void)
  • libs/libmythtv/dvbrecorder.h

     
    185185    bool            _stop_dummy;
    186186    bool            _dummy_stopped;
    187187    QWaitCondition  _wait_time;
    188     QWaitCondition  _wait_stop;
    189188    QMutex          _ts_lock;
    190189    uint            _video_cc;
    191190