decklinkaudiosrc: Allow disabling audio sample alignment code by setting the alignment-threshold to 0

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>
This commit is contained in:
Sebastian Dröge 2021-01-14 14:37:32 +02:00
parent 84db4b68fe
commit 4d07974b10

View file

@ -679,7 +679,9 @@ retry:
GST_SECOND); GST_SECOND);
// Discont! // 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_wait > 0) {
if (self->discont_time == GST_CLOCK_TIME_NONE) { if (self->discont_time == GST_CLOCK_TIME_NONE) {
self->discont_time = start_time; self->discont_time = start_time;
@ -706,6 +708,8 @@ retry:
self->next_offset = end_offset; self->next_offset = end_offset;
// Got a discont and adjusted, reset the discont_time marker. // Got a discont and adjusted, reset the discont_time marker.
self->discont_time = GST_CLOCK_TIME_NONE; self->discont_time = GST_CLOCK_TIME_NONE;
} else if (self->alignment_threshold == 0) {
// Don't align, just pass through timestamps
} else { } else {
// No discont, just keep counting // No discont, just keep counting
timestamp = timestamp =