mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
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.
This commit is contained in:
parent
c37e82587c
commit
84ab11afdb
1 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue