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 = [devices objectAtIndex:deviceIndex];
|
||||||
}
|
}
|
||||||
|
[device retain];
|
||||||
|
|
||||||
GST_INFO ("Opening '%s'", [[device localizedDisplayName] UTF8String]);
|
GST_INFO ("Opening '%s'", [[device localizedDisplayName] UTF8String]);
|
||||||
|
|
||||||
|
@ -194,6 +195,8 @@ static GstPushSrcClass * parent_class;
|
||||||
GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND,
|
GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND,
|
||||||
("Failed to open device '%s'",
|
("Failed to open device '%s'",
|
||||||
[[device localizedDisplayName] UTF8String]), (NULL));
|
[[device localizedDisplayName] UTF8String]), (NULL));
|
||||||
|
[device release];
|
||||||
|
device = nil;
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,6 +216,7 @@ static GstPushSrcClass * parent_class;
|
||||||
[output release];
|
[output release];
|
||||||
output = nil;
|
output = nil;
|
||||||
|
|
||||||
|
[device release];
|
||||||
device = nil;
|
device = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,8 +280,6 @@ static GstPushSrcClass * parent_class;
|
||||||
[session stopRunning];
|
[session stopRunning];
|
||||||
[output setDelegate:nil];
|
[output setDelegate:nil];
|
||||||
|
|
||||||
for (id frame in queue)
|
|
||||||
CVBufferRelease ((CVImageBufferRef) frame);
|
|
||||||
[queueLock release];
|
[queueLock release];
|
||||||
queueLock = nil;
|
queueLock = nil;
|
||||||
[queue release];
|
[queue release];
|
||||||
|
@ -356,12 +358,9 @@ static GstPushSrcClass * parent_class;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([queue count] == FRAME_QUEUE_SIZE) {
|
if ([queue count] == FRAME_QUEUE_SIZE)
|
||||||
CVBufferRelease ((CVImageBufferRef) [queue lastObject]);
|
|
||||||
[queue removeLastObject];
|
[queue removeLastObject];
|
||||||
}
|
|
||||||
|
|
||||||
CVBufferRetain (videoFrame);
|
|
||||||
[queue insertObject:(id)videoFrame
|
[queue insertObject:(id)videoFrame
|
||||||
atIndex:0];
|
atIndex:0];
|
||||||
|
|
||||||
|
@ -379,6 +378,7 @@ static GstPushSrcClass * parent_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = (CVPixelBufferRef) [queue lastObject];
|
frame = (CVPixelBufferRef) [queue lastObject];
|
||||||
|
CVBufferRetain (frame);
|
||||||
[queue removeLastObject];
|
[queue removeLastObject];
|
||||||
[queueLock unlockWithCondition:
|
[queueLock unlockWithCondition:
|
||||||
([queue count] == 0) ? NO_FRAMES : HAS_FRAME_OR_STOP_REQUEST];
|
([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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue