avfvideosrc: Only use the duration of the sample if it is valid

This commit is contained in:
Sebastian Dröge 2015-02-12 11:11:19 +02:00
parent c98348c141
commit 31f59cb344

View file

@ -908,8 +908,10 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
if (CMSampleBufferGetOutputSampleTimingInfoArray(sbuf, 1, &time_info, &num_timings) == noErr) { if (CMSampleBufferGetOutputSampleTimingInfoArray(sbuf, 1, &time_info, &num_timings) == noErr) {
timestamp = gst_util_uint64_scale (GST_SECOND, timestamp = gst_util_uint64_scale (GST_SECOND,
time_info.presentationTimeStamp.value, time_info.presentationTimeStamp.timescale); time_info.presentationTimeStamp.value, time_info.presentationTimeStamp.timescale);
duration = gst_util_uint64_scale (GST_SECOND,
time_info.duration.value, time_info.duration.timescale); if (CMTIME_IS_VALID (time_info.duration) && time_info.duration.timescale != 0)
duration = gst_util_uint64_scale (GST_SECOND,
time_info.duration.value, time_info.duration.timescale);
now = CMClockGetTime(inputClock); now = CMClockGetTime(inputClock);
inputClockNow = gst_util_uint64_scale (GST_SECOND, inputClockNow = gst_util_uint64_scale (GST_SECOND,