decklinkaudiosrc: Allow disabling audio sample alignment code by setting the alignmen...
authorSebastian Dröge <sebastian@centricular.com>
Thu, 14 Jan 2021 12:37:32 +0000 (14:37 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 14 Jan 2021 12:37:32 +0000 (14:37 +0200)
And handle setting it to GST_CLOCK_TIME_NONE as always aligning without
ever detecting a discont.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1956>

sys/decklink/gstdecklinkaudiosrc.cpp

index 7ebf010..41e4f85 100644 (file)
@@ -679,7 +679,9 @@ retry:
         GST_SECOND);
 
     // Discont!
-    if (G_UNLIKELY (diff >= max_sample_diff)) {
+    if (self->alignment_threshold > 0
+        && self->alignment_threshold != GST_CLOCK_TIME_NONE
+        && G_UNLIKELY (diff >= max_sample_diff)) {
       if (self->discont_wait > 0) {
         if (self->discont_time == GST_CLOCK_TIME_NONE) {
           self->discont_time = start_time;
@@ -706,6 +708,8 @@ retry:
     self->next_offset = end_offset;
     // Got a discont and adjusted, reset the discont_time marker.
     self->discont_time = GST_CLOCK_TIME_NONE;
+  } else if (self->alignment_threshold == 0) {
+    // Don't align, just pass through timestamps
   } else {
     // No discont, just keep counting
     timestamp =