summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-02-18 19:06:09 +0200
committerSebastian Dröge <sebastian@centricular.com>2015-02-19 01:03:35 +0200
commit84ab11afdbfd87bf1aa916cc7803163536513339 (patch)
treebceb8e21de3942e194047875e16890700ba45de5 /sys
parentc37e82587c57b28337972c2ea5bee26ce9f9e8e3 (diff)
downloadgstreamer-plugins-bad-84ab11afdbfd87bf1aa916cc7803163536513339.tar.gz
avfvideosrc: Only set latency if we already know our caps
Otherwise we might set bogus values or GST_CLOCK_TIME_NONE. Also make sure to reset the caps field to NULL after unreffing the caps to prevent accidential use afterwards, and unref any old caps before we remember new caps.
Diffstat (limited to 'sys')
-rw-r--r--sys/applemedia/avfvideosrc.m5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/applemedia/avfvideosrc.m b/sys/applemedia/avfvideosrc.m
index 2ed8e2254..ec225498f 100644
--- a/sys/applemedia/avfvideosrc.m
+++ b/sys/applemedia/avfvideosrc.m
@@ -326,6 +326,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
if (caps)
gst_caps_unref (caps);
+ caps = NULL;
});
}
@@ -663,6 +664,8 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
dictionaryWithObject:[NSNumber numberWithInt:newformat]
forKey:(NSString*)kCVPixelBufferPixelFormatTypeKey];
+ if (caps)
+ gst_caps_unref (caps);
caps = gst_caps_copy (new_caps);
[session startRunning];
@@ -716,7 +719,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
BOOL result = NO;
if (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY) {
- if (device != nil) {
+ if (device != nil && caps != NULL) {
GstClockTime min_latency, max_latency;
min_latency = max_latency = latency;