summaryrefslogtreecommitdiffstats
path: root/src/sources
diff options
context:
space:
mode:
authorUwe Klotz <uklotz@mixxx.org>2021-08-22 16:16:42 +0200
committerUwe Klotz <uklotz@mixxx.org>2021-08-25 09:26:39 +0200
commit200fc7f3c371905a562467e7b345a38b0c505300 (patch)
tree259900b923af2e7a529f1df95e00e382a1e89c22 /src/sources
parent3864fdc1aa1398ab52bd489d9d9b1882dd08ef77 (diff)
ReadAheadFrameBuffer: Add debugging option for analysis
Add overridable compile time options for analyzing gaps and overlaps in the decoded audio stream.
Diffstat (limited to 'src/sources')
-rw-r--r--src/sources/readaheadframebuffer.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/sources/readaheadframebuffer.cpp b/src/sources/readaheadframebuffer.cpp
index 407074963c..f2db73a920 100644
--- a/src/sources/readaheadframebuffer.cpp
+++ b/src/sources/readaheadframebuffer.cpp
@@ -3,10 +3,17 @@
#include "util/logger.h"
#include "util/sample.h"
+// Override or set to `true` to enable verbose debug logging.
#if !defined(VERBOSE_DEBUG_LOG)
#define VERBOSE_DEBUG_LOG false
#endif
+// Override or set to `true` to break with a debug assertion
+// if an overlap or gap in the audio stream has been detected.
+#if !defined(DEBUG_ASSERT_ON_DISCONTINUITIES)
+#define DEBUG_ASSERT_ON_DISCONTINUITIES false
+#endif
+
namespace mixxx {
namespace {
@@ -135,6 +142,9 @@ ReadableSampleFrames ReadAheadFrameBuffer::fillBuffer(
<< bufferedRange()
<< "and input buffer"
<< inputRange;
+#if DEBUG_ASSERT_ON_DISCONTINUITIES
+ DEBUG_ASSERT(!"Unexpected gap");
+#endif
switch (discontinuityGapMode) {
case DiscontinuityGapMode::Skip:
reset(inputRange.start());
@@ -314,6 +324,9 @@ WritableSampleFrames ReadAheadFrameBuffer::consumeAndFillBuffer(
<< outputRange
<< "with input buffer"
<< inputRange;
+#if DEBUG_ASSERT_ON_DISCONTINUITIES
+ DEBUG_ASSERT(!"Unexpected overlap");
+#endif
switch (discontinuityOverlapMode) {
case DiscontinuityOverlapMode::Ignore:
break;
@@ -345,6 +358,9 @@ WritableSampleFrames ReadAheadFrameBuffer::consumeAndFillBuffer(
<< bufferedRange()
<< "with input buffer"
<< inputRange;
+#if DEBUG_ASSERT_ON_DISCONTINUITIES
+ DEBUG_ASSERT(!"Unexpected overlap");
+#endif
switch (discontinuityOverlapMode) {
case DiscontinuityOverlapMode::Ignore:
break;
@@ -397,6 +413,9 @@ WritableSampleFrames ReadAheadFrameBuffer::consumeAndFillBuffer(
<< outputRange
<< "and input buffer"
<< inputRange;
+#if DEBUG_ASSERT_ON_DISCONTINUITIES
+ DEBUG_ASSERT(!"Unexpected gap");
+#endif
switch (discontinuityGapMode) {
case DiscontinuityGapMode::Skip:
break;