fix(flac): add FLAC frame-sync scan to getAlignedSegmentSize; extend IFormatDecoder rawData param
StreamDecoder peeks candidate bytes; FlacFormatDecoder scans backward for 0xFF/0xF8 sync. Fixes mid-stream decode failure where segments started mid-frame.
This commit is contained in:
@@ -73,12 +73,18 @@ export interface IFormatDecoder {
|
||||
* @param availableBytes - bytes available starting at the current processedBytes position
|
||||
* @param requestedSize - maximum desired segment size
|
||||
* @param streamComplete - true when the stream has ended (allows draining the tail)
|
||||
* @param rawData - optional; the first `Math.min(requestedSize, availableBytes)` raw audio
|
||||
* bytes (starting at the current processedBytes position in the stream), made available
|
||||
* for format-specific frame-sync scanning. WAV and MP3 decoders ignore this parameter;
|
||||
* FLAC and similar variable-frame formats use it to find the last clean frame boundary
|
||||
* within the candidate window.
|
||||
*/
|
||||
getAlignedSegmentSize(
|
||||
info: FormatInfo,
|
||||
availableBytes: number,
|
||||
requestedSize: number,
|
||||
streamComplete: boolean
|
||||
streamComplete: boolean,
|
||||
rawData?: Uint8Array
|
||||
): number;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user