diff options
author | Alessandro Decina <alessandro.decina@collabora.co.uk> | 2010-12-09 11:04:19 +0100 |
---|---|---|
committer | Alessandro Decina <alessandro.decina@collabora.co.uk> | 2010-12-09 11:55:57 +0100 |
commit | ec6c307334938dc036a3cb2e24fbbb2dddc359d6 (patch) | |
tree | fe710ad8903d69810d5dd1fb48a951eae6a9066f /sys | |
parent | b6d5763e05d8dd4067c2c0b4c5f3ac8ac142753a (diff) |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/applemedia/qtkitvideosrc.m | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/applemedia/qtkitvideosrc.m b/sys/applemedia/qtkitvideosrc.m index 7e2ceefd3..2f9d0b20b 100644 --- a/sys/applemedia/qtkitvideosrc.m +++ b/sys/applemedia/qtkitvideosrc.m @@ -241,6 +241,7 @@ openFailed: GstStructure *s; NSDictionary *outputAttrs; BOOL success; + NSRunLoop *mainRunLoop; g_assert (device != nil); @@ -276,6 +277,16 @@ openFailed: [output setDelegate:self]; [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; } |