The DSS-SP paused-recording fix handles VOX pauses that emit an empty block
(frame_count == 0): its leading bytes finish the frame straddling into it,
the block's padding is discarded, and the next block re-syncs at its
2*byte1 (+2 when byte-swapped) anchor.
Real Olympus recordings contain a second kind of segment boundary that the
empty-block path does not cover: a "compact" block that still declares
frames (frame_count > 0) but whose declared frames fit entirely inside the
506-byte payload, leaving 0xFF padding after them
(frame_count * 42 + payload_offset <= 506). The linear demuxer streamed
straight through that padding as if it were further frames, so any recording
containing such a block desynced from that point to end of file. Audible
garble after the first mid-stream segment boundary, the rest intact.
Detect compact blocks (dss_block_payload_fits) and read exactly their
declared frames, then re-anchor the following block at its 2byte1 offset
(dss_align_after_compact_block). The same re-sync the empty-block and the
seek paths already perform. A frame that straddles from a full block into a
compact block is completed first (pending_block_), and any drift of the
linear reader into a compact block's padding is corrected
(dss_skip_compact_padding). The total frame count is precomputed
(dss_count_total_frames) so trailing padding frames in the final block are
not emitted and the stream duration is exact.
The change is a no-op on gap-free audio: no block is empty or compact there,
so the new paths are never taken. Verified bit-exact against the licensed
Olympus / NCH Switch decode on three real recordings (6 499 152, 3 688 872
and 119 328 samples), one of which has five mid-stream compact blocks; the
existing DSS-SP paused sample decodes byte-for-byte identically.
The DSS-SP paused-recording fix handles VOX pauses that emit an empty block
(frame_count == 0): its leading bytes finish the frame straddling into it,
the block's padding is discarded, and the next block re-syncs at its
2*byte1 (+2 when byte-swapped) anchor.
Real Olympus recordings contain a second kind of segment boundary that the
empty-block path does not cover: a "compact" block that still declares
frames (frame_count > 0) but whose declared frames fit entirely inside the
506-byte payload, leaving 0xFF padding after them
(frame_count * 42 + payload_offset <= 506). The linear demuxer streamed
straight through that padding as if it were further frames, so any recording
containing such a block desynced from that point to end of file. Audible
garble after the first mid-stream segment boundary, the rest intact.
Detect compact blocks (dss_block_payload_fits) and read exactly their
declared frames, then re-anchor the following block at its 2byte1 offset
(dss_align_after_compact_block). The same re-sync the empty-block and the
seek paths already perform. A frame that straddles from a full block into a
compact block is completed first (pending_block_), and any drift of the
linear reader into a compact block's padding is corrected
(dss_skip_compact_padding). The total frame count is precomputed
(dss_count_total_frames) so trailing padding frames in the final block are
not emitted and the stream duration is exact.
The change is a no-op on gap-free audio: no block is empty or compact there,
so the new paths are never taken. Verified bit-exact against the licensed
Olympus / NCH Switch decode on three real recordings (6 499 152, 3 688 872
and 119 328 samples), one of which has five mid-stream compact blocks; the
existing DSS-SP paused sample decodes byte-for-byte identically.