Closed dasisdormax closed 11 months ago
Is there any reason for
int32_t
instead of unsigned ? Other than that, LGTM
Yep. frames_in_pcm - m_current_frame
did end up less than zero.
I'll include your suggestions.
Yep.
frames_in_pcm - m_current_frame
did end up less than zero.
Hmm. This is weird, but understandable for wacky android audio (or my half-hearted code). If I understand everything correctly,
uint32_t frames_to_process = std::clamp(frames_in_pcm - m_current_frame, 0, frames);
should be a better solution ? We wouldn't want to play a negative amount of frames, but it's been awhile since I touched this code, may be wrong
The latest version works fine in my testing and still fixes the issue.
It uses clamp as suggested with signed integers as input, and uses the result ( > 0 ) as unsigned int.
Okay, looking good. Thank you !
This fixes a segfault that occurred when playing specific files.
In these cases, the playback would continue even after the file was ended. There, the library would play back the raw memory contents after the buffer, until eventually the app gets killed for illegal memory accesses.