summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2019-01-24 22:54:34 -0600
committerWilliam Wilgus <me.theuser@yahoo.com>2019-01-25 17:50:39 +0100
commit8cadef4cbbdea20d68c0b389c32d7b64e312666b (patch)
treea5ccaee5b24118eb5785474f9352396a0981f5bb
parent07084f62c40d3197f3a11ac4e5fbe3b923e9ae1e (diff)
downloadrockbox-8cadef4cbbdea20d68c0b389c32d7b64e312666b.tar.gz
rockbox-8cadef4cbbdea20d68c0b389c32d7b64e312666b.zip
opus fix playback opustag skipping
Change-Id: I9ec35e276e24ec7b5a2e1199d6264d9f2d5d9fc2
-rw-r--r--lib/rbcodec/codecs/opus.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/rbcodec/codecs/opus.c b/lib/rbcodec/codecs/opus.c
index acae1aaacc..f0ad5e8ba4 100644
--- a/lib/rbcodec/codecs/opus.c
+++ b/lib/rbcodec/codecs/opus.c
@@ -72,7 +72,8 @@ static int seek_ogg_page(uint64_t filepos)
ci->seek_buffer(ci->curpos - sizeof(buf));
LOGF("next page %ld", ci->curpos);
return 1;
- }
+ } else
+ ci->seek_buffer(ci->curpos - (sizeof(buf) - 1));
}
}
return 0;
@@ -81,20 +82,19 @@ static int seek_ogg_page(uint64_t filepos)
/* seek to comment header */
static int seek_opus_tags(void)
{
- int pos = 0;
- const int64_t maxpos = sizeof(OpusHeader) + 1024;
const char synccode[] = "OpusTags";
- char buf[sizeof(synccode)];
+ char buf[sizeof(synccode) - 1]; /* Exclude null */
ci->seek_buffer(0);
- while (ci->read_filebuf(buf, 1) == 1 && ci->curpos < maxpos) {
+ while (ci->read_filebuf(buf, 1) == 1) {
if (buf[0] == synccode[0]) {
- if (ci->read_filebuf(&buf[1], sizeof(buf) - 2) != sizeof(buf) - 2)
+ if (ci->read_filebuf(&buf[1], sizeof(buf) - 1) != sizeof(buf) - 1)
break;
if (memcmp(buf, synccode, sizeof(buf)) == 0) {
ci->seek_buffer(ci->curpos - sizeof(buf));
LOGF("OpusTags %ld", ci->curpos);
return 1;
- }
+ } else
+ ci->seek_buffer(ci->curpos - (sizeof(buf) - 1));
}
}
/* comment header not found probably invalid file */