Skip to content

Commit

Permalink
Fix OGG Vorbis infinite error spam with corrupt file.
Browse files Browse the repository at this point in the history
When OGG Vorbis encountered unreadable file, it emitted infinite error spam.
This PR returns the full number of frames in the case of error, to prevent infinite loop.
  • Loading branch information
lawnjelly committed Nov 10, 2023
1 parent 2b987d1 commit 188266a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/vorbis/audio_stream_ogg_vorbis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ int AudioStreamPlaybackOggVorbis::_mix_internal(AudioFrame *p_buffer, int p_fram
}

int AudioStreamPlaybackOggVorbis::_mix_frames_vorbis(AudioFrame *p_buffer, int p_frames) {
ERR_FAIL_COND_V(!ready, 0);
ERR_FAIL_COND_V(!ready, p_frames);
if (!have_samples_left) {
ogg_packet *packet = nullptr;
int err;
Expand All @@ -156,10 +156,10 @@ int AudioStreamPlaybackOggVorbis::_mix_frames_vorbis(AudioFrame *p_buffer, int p
}

err = vorbis_synthesis(&block, packet);
ERR_FAIL_COND_V_MSG(err != 0, 0, "Error during vorbis synthesis " + itos(err));
ERR_FAIL_COND_V_MSG(err != 0, p_frames, "Error during vorbis synthesis " + itos(err));

err = vorbis_synthesis_blockin(&dsp_state, &block);
ERR_FAIL_COND_V_MSG(err != 0, 0, "Error during vorbis block processing " + itos(err));
ERR_FAIL_COND_V_MSG(err != 0, p_frames, "Error during vorbis block processing " + itos(err));

have_packets_left = !packet->e_o_s;
}
Expand Down

0 comments on commit 188266a

Please sign in to comment.