1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-12 09:46:46 +02:00

Fix a few A/V race conditions

This commit is contained in:
Jfreegman
2016-09-22 18:00:14 -04:00
parent 38ec96e96a
commit c24e1bd2b8
4 changed files with 35 additions and 20 deletions

View File

@ -236,7 +236,10 @@ VideoDeviceError init_video_devices()
VideoDeviceError terminate_video_devices()
{
/* Cleanup if needed */
lock;
video_thread_running = false;
unlock;
usleep(20000);
int i;
@ -614,16 +617,19 @@ void* video_thread_poll (void* arg) // TODO: maybe use thread for every input so
(void)arg;
uint32_t i;
while (video_thread_running)
{
while (1) {
lock;
if (!video_thread_running) {
unlock;
break;
}
unlock;
if ( video_thread_paused ) usleep(10000); /* Wait for unpause. */
else
{
for (i = 0; i < size[vdt_input]; ++i)
{
else {
for (i = 0; i < size[vdt_input]; ++i) {
lock;
if ( video_devices_running[vdt_input][i] != NULL )
{
if ( video_devices_running[vdt_input][i] != NULL ) {
/* Obtain frame image data from device buffers */
VideoDevice* device = video_devices_running[vdt_input][i];
uint16_t video_width = device->video_width;