Skip to content

decoder: handle corrupted input frames more gracefully #81

@eliteprox

Description

@eliteprox

When streaming to a remote go-livepeer gateway, incoming frames sometimes become corrupted and lead to the following error in the decoder. The trickle client recovers gracefully, but repeated corrupted frames or sustained connectivity drops will cause the stream to end.

2025-12-02 22:21:51 [ERROR] [libav.h264] [decoder.py:111] error while decoding MB 33 29
Stack (most recent call last):
  File "/workspace/miniconda3/envs/comfystream/lib/python3.12/threading.py", line 1032, in _bootstrap
    self._bootstrap_inner()
  File "/workspace/miniconda3/envs/comfystream/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/workspace/miniconda3/envs/comfystream/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/workspace/miniconda3/envs/comfystream/lib/python3.12/concurrent/futures/thread.py", line 93, in _worker
    work_item.run()
  File "/workspace/miniconda3/envs/comfystream/lib/python3.12/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/workspace/miniconda3/envs/comfystream/lib/python3.12/site-packages/pytrickle/media.py", line 154, in decode_runner
    decode_av(f"pipe:{in_pipe}", frame_callback, put_metadata, target_width, target_height, max_framerate)
  File "/workspace/miniconda3/envs/comfystream/lib/python3.12/site-packages/pytrickle/decoder.py", line 111, in decode_av
    for frame in packet.decode():
2025-12-02 22:21:51 [ERROR] [libav.h264] [decoder.py:111] negative number of zero coeffs at 73 21
Stack (most recent call last):
  File "/workspace/miniconda3/envs/comfystream/lib/python3.12/threading.py", line 1032, in _bootstrap
    self._bootstrap_inner()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions