fix ogg (opus & vorbis) playback - release

This commit is contained in:
philippe44
2023-08-04 21:35:56 -07:00
parent 7b9f8bc788
commit 9f4839fc14
2 changed files with 10 additions and 6 deletions

View File

@@ -138,7 +138,9 @@ static int get_ogg_packet(void) {
size_t bytes = min(_buf_used(streambuf), _buf_cont_read(streambuf));
while (!(status = OG(&go, stream_packetout, &v->state, &v->packet)) && bytes) {
do {
// if sync_pageout (or sync_pageseek) is not called first, sync buffers build ups
while (!(status = OG(&go, sync_pageout, &u->sync, &u->page)) && bytes) {
size_t consumed = min(bytes, 4096);
char* buffer = OG(&gv, sync_buffer, &v->sync, consumed);
memcpy(buffer, streambuf->readp, consumed);
@@ -146,7 +148,7 @@ static int get_ogg_packet(void) {
_buf_inc_readp(streambuf, consumed);
bytes -= consumed;
} while (!(status = OG(&go, sync_pageseek, &v->sync, &v->page)) && bytes);
}
// if we have a new page, put it in
if (status) OG(&go, stream_pagein, &v->state, &v->page);