qtkitvideosrc: run the mainRunLoop for a while if not running.
QTCaptureSession::addInput and QTCaptureSession::addOutput call NSObject::performSelectorOnMainThread internally so they need the mainRunLoop to run at least for a while to complete.
This commit is contained in:
parent
b6d5763e05
commit
ec6c307334
@ -241,6 +241,7 @@ openFailed:
|
|||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
NSDictionary *outputAttrs;
|
NSDictionary *outputAttrs;
|
||||||
BOOL success;
|
BOOL success;
|
||||||
|
NSRunLoop *mainRunLoop;
|
||||||
|
|
||||||
g_assert (device != nil);
|
g_assert (device != nil);
|
||||||
|
|
||||||
@ -276,6 +277,16 @@ openFailed:
|
|||||||
[output setDelegate:self];
|
[output setDelegate:self];
|
||||||
[session startRunning];
|
[session startRunning];
|
||||||
|
|
||||||
|
mainRunLoop = [NSRunLoop mainRunLoop];
|
||||||
|
if ([mainRunLoop currentMode] == nil) {
|
||||||
|
/* QTCaptureSession::addInput and QTCaptureSession::addOutput call
|
||||||
|
* NSObject::performSelectorOnMainThread internally. If the mainRunLoop is
|
||||||
|
* not running we need to run it for a while for those methods to complete
|
||||||
|
*/
|
||||||
|
GST_INFO ("mainRunLoop not running");
|
||||||
|
[[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];
|
||||||
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user