Skip to content

Commit

Permalink
Merge pull request mixxxdj#11879 from daschuer/gh11878
Browse files Browse the repository at this point in the history
Fix zeros in the first m4a chunk on Linux
  • Loading branch information
Swiftb0y authored Aug 28, 2023
2 parents af6ef77 + 5ed22e4 commit faae539
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sources/soundsourceffmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,13 +929,13 @@ bool SoundSourceFFmpeg::adjustCurrentPosition(SINT startIndex) {
// Need to seek to a new position before continue reading. For
// sample accurate decoding the actual seek position must be
// placed BEFORE the position where reading continues.
auto seekIndex =
math_max(static_cast<SINT>(0), startIndex - m_seekPrerollFrameCount);
// At the beginning of the stream, this is a negative position.
auto seekIndex = startIndex - m_seekPrerollFrameCount;

// Seek to codec frame boundaries if the frame size is fixed and known
if (m_pavStream->codecpar->frame_size > 0) {
seekIndex -= seekIndex % m_pavCodecContext->frame_size;
}
DEBUG_ASSERT(seekIndex >= 0);
DEBUG_ASSERT(seekIndex <= startIndex);

if (m_frameBuffer.tryContinueReadingFrom(seekIndex)) {
Expand Down

0 comments on commit faae539

Please sign in to comment.