Ticket #3692: 3692-v1-alt1.patch
File 3692-v1-alt1.patch, 2.5 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/dvbrecorder.cpp
619 619 add_stream_type[i], kFilterPriorityHigh); 620 620 } 621 621 622 623 622 // [Re]start dummy video 624 623 StartDummyVideo(); 625 624 … … 1313 1312 void *DVBRecorder::run_dummy_video(void *param) 1314 1313 { 1315 1314 DVBRecorder *dvbrec = (DVBRecorder*) param; 1315 dvbrec->_stop_dummy = false; 1316 dvbrec->_dummy_stopped = false; 1316 1317 dvbrec->RunDummyVideo(); 1317 1318 dvbrec->_dummy_stopped = true; 1318 dvbrec->_wait_stop.wakeAll();1319 1319 return NULL; 1320 1320 } 1321 1321 … … 1358 1358 _ts_change_count = 0; 1359 1359 1360 1360 // 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); 1364 1364 } 1365 1365 1366 1366 void DVBRecorder::RunDummyVideo(void) … … 1390 1390 1391 1391 unsigned long frameTime = (unsigned long)(1000 / _frames_per_sec); 1392 1392 int64_t last_synch = 0; 1393 _wait_time.wait(frameTime * 4); // Initial wait1393 _wait_time.wait(frameTime * 5); // Initial wait 1394 1394 1395 while (! 1395 while (!_stop_dummy) 1396 1396 { 1397 _wait_time.wait(frameTime);1398 1397 _ts_lock.lock(); 1399 1398 int64_t synch_ts = _synch_time_stamp; 1400 1399 _ts_lock.unlock(); … … 1417 1416 { 1418 1417 CreateVideoFrame(); // Just generate one frame 1419 1418 } 1419 _wait_time.wait(frameTime); 1420 1420 } 1421 1421 1422 1422 close(_video_stream_fd); … … 1426 1426 // Stop the dummy video thread 1427 1427 void DVBRecorder::StopDummyVideo(void) 1428 1428 { 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); 1436 1435 } 1437 1436 1438 1437 void DVBRecorder::CreateVideoFrame(void) -
libs/libmythtv/dvbrecorder.h
185 185 bool _stop_dummy; 186 186 bool _dummy_stopped; 187 187 QWaitCondition _wait_time; 188 QWaitCondition _wait_stop;189 188 QMutex _ts_lock; 190 189 uint _video_cc; 191 190