Opus: update resume offset correctly while playing.

The codec wasn't calling ci->set_offset() while decoding; as a result,
the saved offset in ci.id3->offset was only updated at the start of the
file and when seeking.

To reproduce the problem in the simulator or on a real device:
- Start playing an Opus file.
- Let it play until 15s, then turn the player off.
- Turn back on and resume playback. This'll resume correctly from 15s
  (using time-based resume, I think, as the offset was 0?).
- Let it play until 30s, then turn the player off again.
- Turn back on and resume playback. This'll resume from 15s, based on
  the initial position from last time, when it should resume from 30s.

I believe this will also fix FS#12799 ("Resuming opus file from bookmark
is not working correctly").

Change-Id: Iba67368e0029c968ef802693767e0722719bc38b
This commit is contained in:
Adam Sampson 2016-08-26 13:42:03 +01:00 committed by Michael Giacomelli
parent cf82f208e3
commit 1f8ea9fe27
2 changed files with 2 additions and 0 deletions

View file

@ -653,6 +653,7 @@ Udo Schläpfer
Åka Sikrom
Thomas White
Karl Huber
Adam Sampson
The libmad team
The wavpack team

View file

@ -449,6 +449,7 @@ enum codec_status codec_run(void)
}
/* report progress */
ci->set_offset((size_t) ci->curpos);
ci->set_elapsed((granule_pos - header.preskip) / 48);
/* Decode audio packets */