thread shutdown v4l2

This commit is contained in:
niels
2015-12-01 19:58:52 +01:00
parent 1caa5f0daa
commit 352198d708

View File

@@ -2013,6 +2013,11 @@ static void *v4l2_grabber_thread( void *v )
while( 1 ) { while( 1 ) {
int err = (v4l2->rw); int err = (v4l2->rw);
if( i->stop ) {
veejay_msg(VEEJAY_MSG_DEBUG, "v4l2: Closing video capture device");
goto v4l2_grabber_exit;
}
lock_(i); lock_(i);
if( v4l2->pause_capture ) { if( v4l2->pause_capture ) {
if( v4l2->rw == 0 ) { if( v4l2->rw == 0 ) {
@@ -2029,6 +2034,7 @@ static void *v4l2_grabber_thread( void *v )
} }
unlock_(i); unlock_(i);
if( ( !v4l2->is_streaming && v4l2->rw == 0 ) || ( v4l2->rw == 1 && v4l2->pause_read ) ) { if( ( !v4l2->is_streaming && v4l2->rw == 0 ) || ( v4l2->rw == 1 && v4l2->pause_read ) ) {
nanosleep(&req, NULL); nanosleep(&req, NULL);
continue; continue;
@@ -2052,10 +2058,6 @@ static void *v4l2_grabber_thread( void *v )
} }
} }
if( i->stop ) {
veejay_msg(VEEJAY_MSG_DEBUG, "v4l2: Closing video capture device");
goto v4l2_grabber_exit;
}
} }
v4l2_grabber_exit: v4l2_grabber_exit:
@@ -2115,6 +2117,10 @@ int v4l2_thread_pull( v4l2_thread_info *i , VJFrame *dst )
int status = 0; int status = 0;
lock_(i); lock_(i);
if(i->stop) {
unlock_(i);
return status;
}
//@ block until a buffer is captured //@ block until a buffer is captured
while( v->frames_done[v->frame_ready] < 1 ) { while( v->frames_done[v->frame_ready] < 1 ) {
veejay_msg(VEEJAY_MSG_DEBUG, "waiting for frame %d to become ready", veejay_msg(VEEJAY_MSG_DEBUG, "waiting for frame %d to become ready",