Skip to content
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

[FIX] Fix several memory leaks using Leptonica API for hardcoded subtitle extraction #1105

Merged
merged 6 commits into from Sep 12, 2019

Conversation

@dbarelop
Copy link
Contributor

commented Sep 9, 2019

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

Leptonica functions in hardsubx_decoder.c such as pixConvertRGBToGray, pixSobelEdgeFilter, pixDilateGray or pixThresholdToBinary allocate a new Pix struct everytime they are called, rather than modifying the one passed as an argument.

This leads to a memory leak everytime the functions _process_frame_white_basic, _process_frame_color_basic, _display_frame or _process_frame_tickertext are called, which happens at every frame of the input video and results in a huge memory consumption, even for a video the size of a few hundred MBs.

The proposed fix keeps track of all the created Pix structs and destroys them properly after each call to the mentioned functions. Library inclusions for Leptonica and Tesseract libraries have also been modified to look up the standard include directories.

@ccextractor-bot

This comment has been minimized.

Copy link
Collaborator

commented Sep 9, 2019

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results:

Report Name Tests Passed
Broken 12/13
DVB 3/7
DVR-MS 2/2
General 27/27
Hauppage 3/3
MP4 3/3
NoCC 10/10
Teletext 14/21
WTV 13/13
XDS 33/34
CEA-708 14/14
DVD 3/3
Options 81/86

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).

Your PR breaks these cases:


Check the result page for more info.

@cfsmp3 cfsmp3 requested a review from anshul1912 Sep 12, 2019

}
}
av_packet_unref(&ctx->packet);
}

This comment has been minimized.

Copy link
@anshul1912

anshul1912 Sep 12, 2019

Contributor

We use tab for indentation

This comment has been minimized.

Copy link
@cfsmp3

cfsmp3 Sep 12, 2019

Contributor

OK I'm merging anyway. We're due for some proper automated formatting anyway, the code is a mess with a mix of things, styles, etc :-)

@cfsmp3 cfsmp3 merged commit 7598225 into CCExtractor:master Sep 12, 2019

1 of 4 checks passed

CI - linux Tests queued
Details
CI - windows Tests queued
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
WIP Ready for review
Details
@ccextractor-bot

This comment has been minimized.

Copy link
Collaborator

commented Sep 12, 2019

CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results:

Report Name Tests Passed
Broken 13/13
DVB 4/7
DVR-MS 2/2
General 27/27
Hauppage 3/3
MP4 3/3
NoCC 10/10
Teletext 21/21
WTV 13/13
XDS 34/34
CEA-708 14/14
DVD 3/3
Options 85/86

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).

Your PR breaks these cases:


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
Projects
None yet
4 participants
You can’t perform that action at this time.