forked from len0rd/rockbox
Don't assume reading the duration field advances the buffer 12 bytes, instead check the return value and seek accordingly. Improves (fixes?) seeking in sample submitted by Lear.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16595 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6ab1c90513
commit
191b7e8380
1 changed files with 4 additions and 2 deletions
|
|
@ -389,6 +389,10 @@ static int get_timestamp(int *duration)
|
||||||
datap += 4;
|
datap += 4;
|
||||||
*duration = get_short_le(datap);
|
*duration = get_short_le(datap);
|
||||||
|
|
||||||
|
/*the get_timestamp function advances us 12-13 bytes past the packet start,
|
||||||
|
need to undo this here so that we stay synced with the packet*/
|
||||||
|
ci->seek_buffer(ci->curpos-bytesread);
|
||||||
|
|
||||||
return send_time;
|
return send_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -430,8 +434,6 @@ static int seek(int ms, asf_waveformatex_t* wfx)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((time+duration>=ms && time<=ms) || count > 10) {
|
if ((time+duration>=ms && time<=ms) || count > 10) {
|
||||||
/*the get_timestamp function advances us 12 bytes past the packet start*/
|
|
||||||
ci->seek_buffer(ci->curpos-12);
|
|
||||||
DEBUGF("Found our packet! Now at %d packet\n", packet_num);
|
DEBUGF("Found our packet! Now at %d packet\n", packet_num);
|
||||||
return time;
|
return time;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue