avfvideosrc: fix unconditional buffer queue unlock

Unless stopRequest is set, we should unlock conditionally -- otherwise,
the 'create:' method can wake up to an empty buffer queue
and pull a nil buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=748054
This commit is contained in:
Ilya Konstantinov 2015-05-07 21:18:27 +02:00 committed by Matthew Waters
parent 6007829e77
commit c948484c7f

View file

@ -824,7 +824,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
{
[bufQueueLock lock];
stopRequest = NO;
[bufQueueLock unlock];
[bufQueueLock unlockWithCondition:([bufQueue count] == 0) ? NO_BUFFERS : HAS_BUFFER_OR_STOP_REQUEST];
return YES;
}
@ -862,7 +862,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
[self getSampleBuffer:sampleBuffer timestamp:&timestamp duration:&duration];
if (timestamp == GST_CLOCK_TIME_NONE) {
[bufQueueLock unlock];
[bufQueueLock unlockWithCondition:([bufQueue count] == 0) ? NO_BUFFERS : HAS_BUFFER_OR_STOP_REQUEST];
return;
}