﻿# Opus decoder reset: a new conversation must not inherit an unrelated stream history

Opus decoder reset: a new conversation must not inherit an unrelated stream history. A focused voice-infrastructure guide with the documented mechanism, a reproducible validation scenario, evidence and operational li.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/voice-opus-reset-stream-history/
Language: en

An Opus decoder retains information between packets. Reusing its allocation for an unrelated recording can therefore produce a different beginning from decoding that recording in a fresh state. In a voice worker, allocation reuse and stream continuity are separate decisions. The documented reset control provides a boundary, but the application must decide when that boundary actually occurs.

## The audio contract

OPUS_RESET_STATE restores codec state to the equivalent of a fresh initialization. The generic control documentation specifically connects it to switching streams and avoiding history-dependent back-to-back decoding differences. This is different from clearing a network queue or discarding a waveform buffer. Packet decoding within one continuous stream should retain its history and order. Resetting on every transport message would remove intended continuity, while never resetting a pooled decoder would carry it across unrelated sources.

## Implementation details

Define a decoder lease that belongs to one continuous elementary stream. Reset or recreate it before assigning it to a new independent stream, and check control-operation errors. Keep sample-rate and channel configuration compatible with the new assignment; a state reset is not a general configuration migration. Serialize access to a decoder instance as required by the API. For interleaved sessions, maintain independent states instead of alternating unrelated payloads through one supposedly reusable history. Document how reconnects distinguish continuation from a genuinely new stream.

## A constructed validation case

Decode a target recording in a newly initialized instance. Then decode an unrelated prefix followed by that target in a reused instance, first without reset and then with the documented reset. Compare the target outputs under identical configuration and library revision. Also include a continuous-stream control that must not reset between its packets. The evidence should show which stream boundary caused a reset and whether the reset path reproduces the intended fresh-state behavior, rather than merely showing that all calls returned samples.

## Operational limits

The check isolates codec history, not every source of nondeterminism in a voice application. Resampling state, container trimming and model caches have their own ownership rules. Treat a decoder reset as one explicit lifecycle action and retain those separate contracts when diagnosing differences between isolated and pooled execution.

## Primary references

[Opus Ctls](https://opus-codec.org/docs/opus_api-1.5/group__opus__genericctls.html); [Rfc6716](https://www.rfc-editor.org/rfc/rfc6716.html).

This is a proposed voice-system validation, not an executed Retrivium benchmark. Preserve the implementation version and unresolved outcomes; interface documentation does not establish the quality or timing of a deployed voice service.

## Related reading

[Mimi streaming frames: network chunks must be buffered before codec input](/journal/fg2-mimi-streaming-frame-buffer-contract/); [StyleTTS2 long-form inference: previous style is explicit session state](/journal/fg2-styletts2-long-form-style-state-isolation/).
