Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lp1934785 SoundSourceFFmpeg: Ignore inaudible samples before start of stream #4245

Merged
merged 6 commits into from
Sep 3, 2021
Next Next commit
ReadAheadFrameBuffer: Add debugging option for analysis
Add overridable compile time options for analyzing gaps and overlaps
in the decoded audio stream.
uklotzde committed Aug 25, 2021
commit 200fc7f3c371905a562467e7b345a38b0c505300
19 changes: 19 additions & 0 deletions src/sources/readaheadframebuffer.cpp
Original file line number Diff line number Diff line change
@@ -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;