osxvideosink: default to the main in case we are not setup yet
authorAndoni Morales Alastruey <ylatuya@gmail.com>
Tue, 9 Jul 2013 13:33:18 +0000 (15:33 +0200)
committerAndoni Morales Alastruey <ylatuya@gmail.com>
Wed, 10 Jul 2013 15:43:00 +0000 (17:43 +0200)
sys/osxvideo/osxvideosink.m

index 6d4e9f3..3f628e5 100644 (file)
@@ -90,9 +90,16 @@ gst_osx_video_sink_call_from_main_thread(GstOSXVideoSink *osxvideosink,
     NSObject * object, SEL function, NSObject *data, BOOL waitUntilDone)
 {
 
+  NSThread *thread;
   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
-  [object performSelector:function onThread:sink_class->ns_app_thread
+  if (sink_class->ns_app_thread == NULL){
+    thread = [NSThread mainThread];
+  } else {
+    thread = sink_class->ns_app_thread;
+  }
+
+  [object performSelector:function onThread:thread
           withObject:data waitUntilDone:waitUntilDone];
   [pool release];
 }