From 912e58c64c66d20dfebad036499e3ff02f017bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 4 Mar 2015 16:05:28 +0100 Subject: [PATCH] decklinkaudiosrc: Fix the timestamp and offset calculations even more --- sys/decklink/gstdecklinkaudiosrc.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/decklink/gstdecklinkaudiosrc.cpp b/sys/decklink/gstdecklinkaudiosrc.cpp index 5b070251ce..08fc3b9e59 100644 --- a/sys/decklink/gstdecklinkaudiosrc.cpp +++ b/sys/decklink/gstdecklinkaudiosrc.cpp @@ -504,14 +504,11 @@ gst_decklink_audio_src_create (GstPushSrc * bsrc, GstBuffer ** buffer) // Jitter and discontinuity handling, based on audiobasesrc start_time = timestamp; - end_time = p->capture_time; + end_time = p->capture_time + duration; // Convert to the sample numbers - end_offset = gst_util_uint64_scale (end_time, self->info.rate, GST_SECOND); - if (end_offset >= (guint64) sample_count) - start_offset = end_offset - sample_count; - else - start_offset = 0; + start_offset = gst_util_uint64_scale (start_time, self->info.rate, GST_SECOND); + end_offset = start_offset + sample_count; if (self->next_offset == (guint64) - 1) { discont = TRUE;