decklinkaudiosrc: Fix duration of the first audio frame after each discont
authorSebastian Dröge <sebastian@centricular.com>
Wed, 16 Dec 2020 16:32:25 +0000 (18:32 +0200)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 17 Dec 2020 09:00:24 +0000 (09:00 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1886>

sys/decklink/gstdecklinkaudiosrc.cpp

index 5824f90..7ebf010 100644 (file)
@@ -654,6 +654,8 @@ retry:
   // Convert to the sample numbers
   start_offset =
       gst_util_uint64_scale (start_time, self->info.rate, GST_SECOND);
+  // Convert back to round down to a sample multiple and get rid of rounding errors
+  start_time = gst_util_uint64_scale (start_offset, GST_SECOND, self->info.rate);
 
   end_offset = start_offset + sample_count;
   end_time = gst_util_uint64_scale_int (end_offset, GST_SECOND,