[PR #1901] [CLOSED] Fix infinite loop in TS processing no subtitles (Issue #1754) #2691

Open
opened 2026-01-29 17:23:26 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1901
Author: @tusharbhatt7
Created: 12/25/2025
Status: Closed

Base: masterHead: master


📝 Commits (3)

  • 44ac486 Fix infinite loop by skipping junk, preserving User Data (Issue #1754)
  • cfdb397 Fix: Infinite loop on junk data (whitelisting) and H.264 regression (guarding process_m2v)
  • 728e6cd Fix: Remove startcode whitelist to prevent stalls, rely on skip_u32

📊 Changes

2 files changed (+40 additions, -2 deletions)

View changed files

📝 src/lib_ccx/es_functions.c (+4 -1)
📝 src/lib_ccx/general_loop.c (+36 -1)

📄 Description

Title: Fix infinite binary output loop for TS files with no subtitles (#1754)

Description:

Summary
This PR fixes a bug where processing certain Transport Stream (.ts) files that contain video streams but no subtitles would cause ccextractor to enter an infinite loop, continuously outputting binary data without making progress.

Related Issue
Fixes #1754

Changes

src/lib_ccx/general_loop.c
Implemented a safeguard in
process_non_multiprogram_general_loop
If the video decoder (process_m2v) returns 0 bytes consumed but the buffer still contains data (> 8 bytes), the logic now forcibly consumes the buffer.
This prevents the demuxer from getting stuck re-processing the same invalid or problematic video data indefinitely while waiting for a caption block that never arrives.
Verification
Verified using a synthetic .ts file generated to contain valid MPEG-2 Video PES headers but no subtitle data.
Before: The process would hang or output infinite binary data.
After: The process correctly identifies the video stream, finds no captions, and exits gracefully with EXIT_NO_CAPTIONS (Code 10).
Ran full build to ensure no regressions in standard general_loop behavior.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1901 **Author:** [@tusharbhatt7](https://github.com/tusharbhatt7) **Created:** 12/25/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (3) - [`44ac486`](https://github.com/CCExtractor/ccextractor/commit/44ac486dfd2215fa01c07398195ae0e6c46460f0) Fix infinite loop by skipping junk, preserving User Data (Issue #1754) - [`cfdb397`](https://github.com/CCExtractor/ccextractor/commit/cfdb397b1051b37e66d39e85e53dc5e74a57ffdf) Fix: Infinite loop on junk data (whitelisting) and H.264 regression (guarding process_m2v) - [`728e6cd`](https://github.com/CCExtractor/ccextractor/commit/728e6cd443d2878ce389fb4fa44596d36908eda9) Fix: Remove startcode whitelist to prevent stalls, rely on skip_u32 ### 📊 Changes **2 files changed** (+40 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/lib_ccx/es_functions.c` (+4 -1) 📝 `src/lib_ccx/general_loop.c` (+36 -1) </details> ### 📄 Description Title: Fix infinite binary output loop for TS files with no subtitles (#1754) Description: Summary This PR fixes a bug where processing certain Transport Stream (.ts) files that contain video streams but no subtitles would cause ccextractor to enter an infinite loop, continuously outputting binary data without making progress. Related Issue Fixes #1754 Changes src/lib_ccx/general_loop.c Implemented a safeguard in process_non_multiprogram_general_loop If the video decoder (process_m2v) returns 0 bytes consumed but the buffer still contains data (> 8 bytes), the logic now forcibly consumes the buffer. This prevents the demuxer from getting stuck re-processing the same invalid or problematic video data indefinitely while waiting for a caption block that never arrives. Verification Verified using a synthetic .ts file generated to contain valid MPEG-2 Video PES headers but no subtitle data. Before: The process would hang or output infinite binary data. After: The process correctly identifies the video stream, finds no captions, and exits gracefully with EXIT_NO_CAPTIONS (Code 10). Ran full build to ensure no regressions in standard general_loop behavior. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:23:26 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2691