decoder: handle corrupted input frames more gracefully
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
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()
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading decode_av in pytrickle/decoder.py at line 111 and its caller in pytrickle/media.py at line 154, focusing on how decode errors and input termination are handled. Reproduce corrupted frames or a sustained connectivity drop if possible; done means repeated corruption or connectivity loss no longer ends the stream unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- audio-video-rtc, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100