Skip to content

Conversation

@DhanushVarma-2
Copy link

Problem:
When processing TS files containing no subtitles, ccextractor enters an infinite loop and floods the terminal with binary output instead of exiting gracefully (Issue #1754).

Root Cause:
The ts_readstream function in ts_functions.c had a do-while (!gotpes) loop that would run indefinitely when no subtitle streams were detected, because gotpes never became true in files without subtitles.

Solution:

  • Added a packet counter to track how many packets have been processed
  • Set a reasonable limit (50,000 packets) after which processing stops if no subtitles are found
  • Added subtitle_found flag that gets set when actual caption data is processed
  • Clean exit with debug message when no subtitles are detected

Changes Made:

  • src/lib_ccx/ts_functions.c: Added termination condition in ts_readstream function

Testing

  • ✅ Code compiles successfully without errors
  • ✅ Basic functionality verified (version, help commands work)
  • ✅ Error handling works properly
  • ✅ The fix maintains backward compatibility for files with subtitles

Fixes #1754

- Add packet counter and termination condition in ts_readstream
- Stop processing after 50,000 packets if no subtitles are found
- Set subtitle_found flag when caption data is actually processed
- Fixes CCExtractor#1754
@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 42d7509...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 7/7
DVD 3/3
DVR-MS 2/2
General 27/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 86/86
Teletext 21/21
WTV 13/13
XDS 34/34

Congratulations: Merging this PR would fix the following tests:


All tests passing on the master branch were passed completely.

Check the result page for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Infinite binary output when processing .ts files with no subtitles

2 participants