Skip to content

fix(mod_shout): update handle->pos in shout_file_read() to fix backward seek for MP3 files#3

Merged
pinc444 merged 2 commits intomasterfrom
copilot/fix-backward-seek-issue
Mar 24, 2026
Merged

fix(mod_shout): update handle->pos in shout_file_read() to fix backward seek for MP3 files#3
pinc444 merged 2 commits intomasterfrom
copilot/fix-backward-seek-issue

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 24, 2026

shout_file_seek() correctly sets handle->pos via mpg123_seek(), but shout_file_read() never advances handle->pos after reading samples. This causes position tracking to desync after any backward seek, breaking subsequent seek operations.

  • Add handle->pos += *len in shout_file_read(), consistent with all other format modules (mod_sndfile, mod_opusfile, mod_native_file)
// src/mod/formats/mod_shout/mod_shout.c — shout_file_read()
	handle->pos += *len;
	handle->sample_count += *len;

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Add handle->pos += *len in shout_file_read() to keep the file position
counter in sync after backward seeks. Without this, mpg123_seek()
correctly repositions the decoder but subsequent reads never update
handle->pos, causing the position to drift and breaking backward
seek behavior.

This matches the pattern used by other format modules (mod_sndfile,
mod_opusfile, mod_native_file) which all update handle->pos in their
read functions.

Co-authored-by: pinc444 <148037078+pinc444@users.noreply.github.com>
Agent-Logs-Url: https://github.com/pinc444/freeswitch/sessions/3063de57-1880-4d2e-b422-c6dea22f6b7f
Copilot AI changed the title [WIP] Fix backward seek issue in MP3 playback fix(mod_shout): update handle->pos in shout_file_read() to fix backward seek for MP3 files Mar 24, 2026
Copilot AI requested a review from pinc444 March 24, 2026 21:44
@pinc444 pinc444 marked this pull request as ready for review March 24, 2026 21:46
@pinc444 pinc444 merged commit c5ddff4 into master Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants