Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in

Issue 1530: Harmonize op_raw_total() and op_raw_seek() (Closed)

Can't Edit
Can't Publish+Mail
Start Review
1 week, 6 days ago by derf
1 week ago


op_raw_seek() will fail if you try to seek to a byte position
 beyond the end of the file.
However, the "end" is defined in terms of _of->end, which is
 specifically the end of the last Ogg page found in the underlying
 source (excluding any trailing non-Ogg data).
op_raw_total(_of,-1) returns the total size of the stream by using
 _of->end, but it was also subtracting the offset of the first Opus
 page in the first link.
Since there might have been other Ogg streams concurrently
 multiplexed with the first Opus stream whose BOS pages appear
 first, or there might simply be non-Ogg junk at the start, that
 left the caller with no way to determine the valid range of byte
 offsets that could be passed to op_raw_seek().

Instead, make op_raw_total() pretend the first link starts at
 offset 0, and explicitly document that it's what defines the range
 of valid values to op_raw_seek().
This is how our own seeking_example.c was using it, anyway.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
M include/opusfile.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/opusfile.c View 1 chunk +2 lines, -2 lines 0 comments Download


Total messages: 4
1 week, 6 days ago #1
r+ I think the change to op_raw_total() is very unlikely to affect real users, so ...
1 week ago #2
On 2017/05/19 18:08:30, tdaede wrote: > I think the change to op_raw_total() is very unlikely ...
1 week ago #3
1 week ago #4

RSS Feeds Recent Issues | This issue
This is Rietveld