-
Notifications
You must be signed in to change notification settings - Fork 505
fix: prevent infinite loop when processing TS files with no subtitles #1763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix: prevent infinite loop when processing TS files with no subtitles #1763
Conversation
|
Why would no subtitles cause an infinite loop? Do you have an example file? I don't like the heuristics solution TBH. |
cfsmp3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please submit an example video to shows the problem.
There must be a way to fix it that doesn't consist on a random limit.
|
Example TS file (no subtitles): |
|
A hard packet limit is not ideal and was added only as a safeguard to prevent the infinite loop. |
- Check if all PMTs have been analyzed - After PMT analysis, verify if any caption streams (PIDs) were found - Exit after 1000 packets if num_of_PIDs == 0 (no caption streams) - Uses PMT-based detection instead of arbitrary packet limits This fix properly uses the Program Map Table data to determine if subtitle streams exist, rather than relying on arbitrary packet counts. Fixes CCExtractor#1754
8e5f4d2 to
8d4d84b
Compare
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 0b3ad40...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit f6cb862...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
Congratulations: Merging this PR would fix the following tests:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
|
What's the root cause of the problem? what is subtitles begin half way through the video (e.g. when a new segment or show starts)? |
Problem
When processing TS files containing no subtitles, ccextractor enters an infinite loop instead of exiting gracefully (Issue #1754).
Root Cause
The
ts_readstreamfunction had ado-while (!gotpes)loop that would run indefinitely when no subtitle streams were detected, becausegotpesnever became true in files without subtitles.Solution
Instead of using an arbitrary packet limit, this fix properly detects when no subtitle streams exist by:
ctx->num_of_PIDs == 0)CCX_EOFwith a clear debug message when no subtitles are foundWhy This Approach is Better
Changes Made
src/lib_ccx/ts_functions.c: Added PMT analysis tracking and caption stream detection ints_readstreamfunctionTesting
Fixes #1754