Skip to main content

resume_offset

Function resume_offset 

Source
pub fn resume_offset(existing_bytes: u64, status: u16) -> u64
Expand description

Where to resume writing a partial download, given how the server answered.

A byte offset of 0 means “start the file again”; anything else means “append from here”.

This is what makes non-original downloads survive. Those presets ask Jellyfin to transcode, and a live transcode is chunked with no Content-Length and cannot be byte-seeked: the server ignores Range and answers 200 with the whole stream from the beginning, not 206 with the requested tail. The worker sent the header and appended the body regardless, so every retry — and every resume — concatenated a fresh copy of the whole transcode onto the bytes already on disk. The file grew past its real size and would not play. Only a 206 actually promises the tail; a 200 means we must discard what we have and take the stream from the top.

TRACES: UR-071 | DR-170