Skip to content

fix: do not parse mpeg-ts files as typescript files#26958

Closed
KnisterPeter wants to merge 2 commits intomicrosoft:masterfrom
KnisterPeter:gh21136-skip-parsing-mpegts
Closed

fix: do not parse mpeg-ts files as typescript files#26958
KnisterPeter wants to merge 2 commits intomicrosoft:masterfrom
KnisterPeter:gh21136-skip-parsing-mpegts

Conversation

@KnisterPeter
Copy link
Copy Markdown
Contributor

@KnisterPeter KnisterPeter commented Sep 7, 2018

MPEG-TS files consist of frames each 188 bytes long.
These files should not be parsed as typescript files
and therefore we look into the first 50 frames and
check if we find a 'valid' header.

Here's a checklist you might find useful.

  • There is an associated issue that is labeled
    'Bug' or 'help wanted' or is in the Community milestone
  • Code is up-to-date with the master branch
  • You've successfully run jake runtests locally
  • You've signed the CLA
  • There are new or updated unit tests validating the change

Fixes #21136

MPEG-TS files consist of frames each 188 bytes long.
These files should not be parsed as typescript files
and therefore we look into the first 50 frames and
check if we find a 'valid' header.

Closes microsoft#21136
@KnisterPeter
Copy link
Copy Markdown
Contributor Author

@mhegazy @RyanCavanaugh The tests are still missing here, but if you don't mind I would love to get some feedback if the direction of this fix is correct.

@RyanCavanaugh RyanCavanaugh added this to the Community milestone Sep 17, 2018
@RyanCavanaugh
Copy link
Copy Markdown
Member

Apologies for the delay here.

I think we need to optimize this for incurring the absolute minimum overhead in the common case where none of the files are MPEGs. Specifically, that means the order of operations should be:

  • Read the file as normal
  • If the length is enormous (20 MB?) then check for the signalling bytes
  • If the file is determined to be a transport stream, then fail in some reasonably graceful manner (doesn't have to be perfect since this should never be occurring except once by mistake)

@RyanCavanaugh RyanCavanaugh self-assigned this Jan 24, 2019
@RyanCavanaugh
Copy link
Copy Markdown
Member

Closing due to inactivity

@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code Helper attempts to index MPEG-TS files in project and eats 100% cpu

2 participants