Skip to content

Commit

Permalink
Apply missing Samples fix only to FFmpeg 4.4 and above
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Jul 24, 2023
1 parent af3eae9 commit 07a9099
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/sources/soundsourceffmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,24 +1159,27 @@ ReadableSampleFrames SoundSourceFFmpeg::readSampleFramesClamped(
}
const auto decodedFrameCount = m_pavDecodedFrame->nb_samples;
DEBUG_ASSERT(decodedFrameCount > 0);
auto streamFrameIndex =
SINT streamFrameIndex =
convertStreamTimeToFrameIndex(
*m_pavStream, m_pavDecodedFrame->pts);
// Only audible samples are counted, i.e. any inaudible aka
// "priming" samples are not included in nb_samples!
// https://bugs.launchpad.net/mixxx/+bug/1934785
if (streamFrameIndex < kMinFrameIndex) {

if (m_avutilVersion >= AV_VERSION_INT(56, 52, 100)) {
// From ffmpeg 4.4 only audible samples are counted, i.e. any inaudible aka
// "priming" samples are not included in nb_samples!
// https://github.com/mixxxdj/mixxx/issues/10464
if (streamFrameIndex < kMinFrameIndex) {
#if VERBOSE_DEBUG_LOG
const auto inaudibleFrameCountUntilStartOfStream =
kMinFrameIndex - streamFrameIndex;
kLogger.debug()
<< "Skipping"
<< inaudibleFrameCountUntilStartOfStream
<< "inaudible sample frames before the start of the stream";
const auto inaudibleFrameCountUntilStartOfStream =
kMinFrameIndex - streamFrameIndex;
kLogger.debug()
<< "Skipping"
<< inaudibleFrameCountUntilStartOfStream
<< "inaudible sample frames before the start of the stream";
#endif
streamFrameIndex = kMinFrameIndex;
streamFrameIndex = kMinFrameIndex;
}
}
DEBUG_ASSERT(streamFrameIndex >= kMinFrameIndex);

This comment has been minimized.

Copy link
@uklotzde

uklotzde Jul 24, 2023

Contributor

Why did you delete this DEBUG_ASSERT?

This comment has been minimized.

Copy link
@daschuer

daschuer Jul 24, 2023

Author Member

Because it is no longer correct in this place and too trivial in the inner scope.

decodedFrameRange = IndexRange::forward(
streamFrameIndex,
decodedFrameCount);
Expand Down

0 comments on commit 07a9099

Please sign in to comment.