osxvideosink: Fix crash in osxvideosink with external window output
authorAlexey Chernov <achernov@neosphere.com>
Fri, 11 Jan 2013 15:24:43 +0000 (19:24 +0400)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 16 Jan 2013 10:43:56 +0000 (11:43 +0100)
sys/osxvideo/cocoawindow.m
sys/osxvideo/osxvideosink.m

index 3ba3812..6b9540e 100644 (file)
@@ -69,8 +69,6 @@
   width = size.width;
   height = size.height;
 
-  [gstview setVideoSize: (int) width:(int) height];
-
   [super setContentSize:size];
 }
 
index 3492164..873df06 100644 (file)
@@ -683,6 +683,10 @@ gst_osx_video_sink_set_window_handle (GstVideoOverlay * overlay, guintptr handle
         osxvideosink->osxwindow->gstview,
         @selector(addToSuperview:), osxvideosink->superview, YES);
   }
+
+  if (window_id) {
+    osxvideosink->osxwindow->internal = FALSE;
+  }
 }
 
 static void
@@ -838,7 +842,12 @@ gst_osx_video_sink_get_type (void)
 
   GST_INFO_OBJECT (osxvideosink, "resizing");
   NSSize size = {osxwindow->width, osxwindow->height};
-  [osxwindow->win setContentSize:size];
+  if (osxwindow->internal) {
+    [osxwindow->win setContentSize:size];
+  }
+  if (osxwindow->gstview) {
+      [osxwindow->gstview setVideoSize :(int)osxwindow->width :(int)osxwindow->height];
+  }
   GST_INFO_OBJECT (osxvideosink, "done");
 
   [pool release];