Member Junction
    Preparing search index...

    Function AssembleOpusRecordingPcm

    • Lays a session's shards out on one 48 kHz timeline and decodes them with one decoder.

      • A present shard is decoded packet by packet; exactly SampleCount samples are kept (decoded audio past it is dropped, a shortfall stays silent). Every packet is still decoded so the decoder state stays continuous into the next shard.
      • A run of missing indexes becomes one silent gap from the end of the previous shard to the start of the next present one (a trailing run: to the end of the recording), listing the missing indexes.
      • A present shard that starts after the end of the previous one leaves a silent gap with no indexes.
      • A shard with a packet libopus cannot decode is silenced whole, listed as a gap with its index and in DecodeFailures.
      • After any gap the decoder is reset.

      The samples are decoded straight into the returned WAV's data section (see allocatePcm16Wav).

      The shard count is expectedShards, or the highest present index + 1 when no terminal signal has arrived. The length is capturedSamples, or the end of the last shard when unknown (and never less than the end of the last shard: audio past a stale terminal is kept, not cut).

      Parameters

      • shards: RecordingShardContents[]

        Parsed shards (any order, unique indexes).

      • expectedShards: number

        Shard count from the terminal signal, or null when none arrived.

      • capturedSamples: number

        Captured sample count from the terminal signal, or null.

      • decoder: IOpusPacketDecoder

        The one decoder for this stream.

      Returns AssembledOpusRecording

      RecordingAssemblyError on a duplicate index, a shard overlapping the audio before it, or a shard/sample count over MAX_ASSEMBLY_SHARDS / MAX_ASSEMBLY_SAMPLES.