mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
qtkitvideosrc: fix up refcounting
Should keep a strong reference to the device, but we don't need to manage the reference count of elements of an NSMutableArray as it takes care of that for us.
This commit is contained in:
parent
b39609b405
commit
3a44d4c1f9
1 changed files with 6 additions and 7 deletions
|
@ -187,6 +187,7 @@ static GstPushSrcClass * parent_class;
|
|||
}
|
||||
device = [devices objectAtIndex:deviceIndex];
|
||||
}
|
||||
[device retain];
|
||||
|
||||
GST_INFO ("Opening '%s'", [[device localizedDisplayName] UTF8String]);
|
||||
|
||||
|
@ -194,6 +195,8 @@ static GstPushSrcClass * parent_class;
|
|||
GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND,
|
||||
("Failed to open device '%s'",
|
||||
[[device localizedDisplayName] UTF8String]), (NULL));
|
||||
[device release];
|
||||
device = nil;
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -213,6 +216,7 @@ static GstPushSrcClass * parent_class;
|
|||
[output release];
|
||||
output = nil;
|
||||
|
||||
[device release];
|
||||
device = nil;
|
||||
}
|
||||
|
||||
|
@ -276,8 +280,6 @@ static GstPushSrcClass * parent_class;
|
|||
[session stopRunning];
|
||||
[output setDelegate:nil];
|
||||
|
||||
for (id frame in queue)
|
||||
CVBufferRelease ((CVImageBufferRef) frame);
|
||||
[queueLock release];
|
||||
queueLock = nil;
|
||||
[queue release];
|
||||
|
@ -356,12 +358,9 @@ static GstPushSrcClass * parent_class;
|
|||
return;
|
||||
}
|
||||
|
||||
if ([queue count] == FRAME_QUEUE_SIZE) {
|
||||
CVBufferRelease ((CVImageBufferRef) [queue lastObject]);
|
||||
if ([queue count] == FRAME_QUEUE_SIZE)
|
||||
[queue removeLastObject];
|
||||
}
|
||||
|
||||
CVBufferRetain (videoFrame);
|
||||
[queue insertObject:(id)videoFrame
|
||||
atIndex:0];
|
||||
|
||||
|
@ -379,6 +378,7 @@ static GstPushSrcClass * parent_class;
|
|||
}
|
||||
|
||||
frame = (CVPixelBufferRef) [queue lastObject];
|
||||
CVBufferRetain (frame);
|
||||
[queue removeLastObject];
|
||||
[queueLock unlockWithCondition:
|
||||
([queue count] == 0) ? NO_FRAMES : HAS_FRAME_OR_STOP_REQUEST];
|
||||
|
@ -657,4 +657,3 @@ gst_qtkit_video_src_create (GstPushSrc * pushsrc, GstBuffer ** buf)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue