pion/webrtc · error
incomplete frame data
Error message
incomplete frame data
What it means
Returned by IVFReader.ParseNextFrame when the frame header was read successfully but io.ReadFull hit io.ErrUnexpectedEOF while reading the frame's payload bytes, meaning the stream ended before the declared frame size was fully available.
Source
Thrown at pkg/media/ivfreader/ivfreader.go:23
package ivfreader
import (
"encoding/binary"
"errors"
"fmt"
"io"
)
const (
ivfFileHeaderSignature = "DKIF"
ivfFileHeaderSize = 32
ivfFrameHeaderSize = 12
)
var (
errNilStream = errors.New("stream is nil")
errIncompleteFrameHeader = errors.New("incomplete frame header")
errIncompleteFrameData = errors.New("incomplete frame data")
errIncompleteFileHeader = errors.New("incomplete file header")
errSignatureMismatch = errors.New("IVF signature mismatch")
errUnknownIVFVersion = errors.New("IVF version unknown, parser may not parse correctly")
errInvalidMediaTimebase = errors.New("invalid media timebase")
)
// IVFFileHeader 32-byte header for IVF files
// https://wiki.multimedia.cx/index.php/IVF
type IVFFileHeader struct {
signature string // 0-3
version uint16 // 4-5
headerSize uint16 // 6-7
FourCC string // 8-11
Width uint16 // 12-13
Height uint16 // 14-15
TimebaseDenominator uint32 // 16-19
TimebaseNumerator uint32 // 20-23
NumFrames uint32 // 24-27View on GitHub (pinned to 8c25dc09fa)
Solutions
- Verify and re-acquire the source IVF file (complete download, valid size).
- Catch this error specifically to treat truncation as a graceful end-of-stream if partial data is acceptable.
- Sanitize frame-size fields if the file comes from an untrusted producer.
Example fix
// before
payload, _, err := reader.ParseNextFrame()
if err != nil { return err }
// after
payload, _, err := reader.ParseNextFrame()
if err == ivfreader.ErrIncompleteFrameData {
log.Warn("frame payload truncated at end of file")
return nil
} else if err != nil {
return err
} Defensive patterns
Strategy: try-catch
Validate before calling
if fi.Size() < int64(32+12) {
return errors.New("file too small to contain frame data")
} Try / catch
frame, hdr, err := reader.ParseNextFrame()
if err == ivfreader.ErrIncompleteFrameData {
log.Warn("frame payload truncated at end of IVF stream")
return nil
} else if err != nil {
return err
} Prevention
- Re-download or re-capture truncated IVF files; check total size against expected duration/bitrate.
- Validate frame-size sanity (e.g. size <= remaining file bytes) when consuming untrusted files.
- Close producers before consuming so the stream isn't cut mid-frame.
When it happens
Trigger: ParseNextFrame where the payload (per the 12-byte frame header's size field) extends beyond the end of the stream.
Common situations: Truncated or partially downloaded IVF files, corrupt frame-size fields, reading a file mid-write, piping a stream that closed early.
Related errors
- incomplete frame header
- incomplete file header
- stream is nil
- IVF signature mismatch
- IVF version unknown, parser may not parse correctly
AI-assisted analysis of pion/webrtc@8c25dc09fa (2026-09-03).
Data as JSON: /api/errors/4aba598bf960723f.
Report an issue: GitHub.