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

Tolerate TS sync byte issues #3580

Closed
happylinks opened this issue Aug 17, 2021 · 4 comments
Closed

Tolerate TS sync byte issues #3580

happylinks opened this issue Aug 17, 2021 · 4 comments
Assignees
Labels
component: HLS The issue involves Apple's HLS manifest format priority: P3 Useful but not urgent status: archived Archived and locked; will not be updated type: enhancement New feature or request
Milestone

Comments

@happylinks
Copy link

happylinks commented Aug 17, 2021

Have you read the FAQ and checked for duplicate open issues?
Yes

What version of Shaka Player are you using?
3.2.0

Can you reproduce the issue with our latest release version?
Yes

Can you reproduce the issue with the latest code from master?
Yes

Are you using the demo app or your own custom app?
Reproducible in both

If custom app, can you reproduce the issue using our demo app?
Yes

What browser and OS are you using?
Chrome / OSX

For embedded devices (smart TVs, etc.), what model and firmware version are you using?
/

What are the manifest and license server URIs?

https://d246c3y55mjokh.cloudfront.net/cksftahaf0006i7t320b26g4s.m3u8

What configuration are you using? What is the output of player.getConfiguration()?

{
"drm": {
"retryParameters": {
"maxAttempts": 2,
"baseDelay": 1000,
"backoffFactor": 2,
"fuzzFactor": 0.5,
"timeout": 30000,
"stallTimeout": 5000,
"connectionTimeout": 10000
},
"servers": {},
"clearKeys": {},
"advanced": {},
"delayLicenseRequestUntilPlayed": false,
"logLicenseExchange": false,
"updateExpirationTime": 1,
"preferredKeySystems": []
},
"manifest": {
"retryParameters": {
"maxAttempts": 2,
"baseDelay": 1000,
"backoffFactor": 2,
"fuzzFactor": 0.5,
"timeout": 30000,
"stallTimeout": 5000,
"connectionTimeout": 10000
},
"availabilityWindowOverride": null,
"disableAudio": false,
"disableVideo": false,
"disableText": false,
"disableThumbnails": false,
"defaultPresentationDelay": 0,
"dash": {
"clockSyncUri": "",
"ignoreDrmInfo": false,
"disableXlinkProcessing": false,
"xlinkFailGracefully": false,
"ignoreMinBufferTime": false,
"autoCorrectDrift": true,
"initialSegmentLimit": 1000,
"ignoreSuggestedPresentationDelay": false,
"ignoreEmptyAdaptationSet": false,
"ignoreMaxSegmentDuration": false,
"keySystemsByURI": {
"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b": "org.w3.clearkey",
"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed": "com.widevine.alpha",
"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95": "com.microsoft.playready",
"urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95": "com.microsoft.playready",
"urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb": "com.adobe.primetime"
}
},
"hls": {
"ignoreTextStreamFailures": false,
"ignoreImageStreamFailures": false,
"useFullSegmentsForStartTime": true
}
},
"streaming": {
"retryParameters": {
"maxAttempts": 2,
"baseDelay": 1000,
"backoffFactor": 2,
"fuzzFactor": 0.5,
"timeout": 30000,
"stallTimeout": 5000,
"connectionTimeout": 10000
},
"rebufferingGoal": 2,
"bufferingGoal": 10,
"bufferBehind": 30,
"ignoreTextStreamFailures": false,
"alwaysStreamText": false,
"startAtSegmentBoundary": false,
"gapDetectionThreshold": 0.1,
"smallGapLimit": 0.5,
"jumpLargeGaps": false,
"durationBackoff": 1,
"forceTransmuxTS": false,
"safeSeekOffset": 5,
"stallEnabled": true,
"stallThreshold": 1,
"stallSkip": 0.1,
"useNativeHlsOnSafari": true,
"inaccurateManifestTolerance": 2,
"lowLatencyMode": false,
"autoLowLatencyMode": false,
"forceHTTPS": false,
"preferNativeHls": false,
"updateIntervalSeconds": 1
},
"offline": {
"usePersistentLicense": true
},
"abr": {
"enabled": true,
"useNetworkInformation": true,
"defaultBandwidthEstimate": 1000000,
"switchInterval": 8,
"bandwidthUpgradeTarget": 0.85,
"bandwidthDowngradeTarget": 0.95,
"restrictions": {
"minWidth": 0,
"maxWidth": null,
"minHeight": 0,
"maxHeight": null,
"minPixels": 0,
"maxPixels": null,
"minFrameRate": 0,
"maxFrameRate": null,
"minBandwidth": 0,
"maxBandwidth": null
}
},
"preferredAudioLanguage": "",
"preferredTextLanguage": "",
"preferredVariantRole": "",
"preferredTextRole": "",
"preferredAudioChannelCount": 2,
"preferredVideoCodecs": [],
"preferredAudioCodecs": [],
"preferForcedSubs": false,
"preferredDecodingAttributes": [],
"restrictions": {
"minWidth": 0,
"maxWidth": null,
"minHeight": 0,
"maxHeight": null,
"minPixels": 0,
"maxPixels": null,
"minFrameRate": 0,
"maxFrameRate": null,
"minBandwidth": 0,
"maxBandwidth": null
},
"playRangeStart": 0,
"playRangeEnd": null
}

What did you do?

  • Created an audio-only HLS output with AWS MediaConvert in a TS container.
  • Tried to play it with shaka-player
  • Gets error 4030.

What did you expect to happen?
Audio playing normally. In hls.js it does work fine.

What actually happened?

Error 4030 on the first chunk.
image

@theodab
Copy link
Contributor

theodab commented Aug 17, 2021

Your first TS file starts with the wrong sync byte (the first byte is 0x73, but TS packets are expected to start with the byte 0x47). It seems that HLS.js is more tolerant when it comes to malformed content than we are.

Indeed, looking at the HLS.js codebase, they will look forward until they see the sync byte when they parse TS files, and will merely trigger a warning log if the sync word is not at the start of the file. Meanwhile, we error in that situation.

We could also look ahead to see if the sync word is later, I suppose. I don't think that would break anything?

@theodab theodab added status: bad content Caused by invalid, broken, or unsupported content type: enhancement New feature or request component: HLS The issue involves Apple's HLS manifest format priority: P3 Useful but not urgent and removed needs triage labels Aug 17, 2021
@shaka-bot shaka-bot added this to the Backlog milestone Aug 17, 2021
@happylinks
Copy link
Author

Thanks for looking into that! Just for more context, the stream was generated with AWS MediaConvert with their default audio-only settings: https://docs.aws.amazon.com/mediaconvert/latest/ug/setting-up-audio-only.html

@smnmmnn
Copy link

smnmmnn commented Sep 6, 2021

Same problem here. I tried various packaging configurations with AWS MediaConvert, but always results in 4030 error.
Somewhat related: google/ExoPlayer #5039

@happylinks
Copy link
Author

Yeah, as a tmp fix I switch to HLS.js for the audio only streams I have, but it's not ideal.

@joeyparrish joeyparrish removed the status: bad content Caused by invalid, broken, or unsupported content label Sep 13, 2021
@joeyparrish joeyparrish changed the title Audio-only HLS stream gets HLS_COULD_NOT_PARSE_SEGMENT_START_TIME Tolerate TS sync byte issues Sep 13, 2021
@theodab theodab self-assigned this Sep 15, 2021
joeyparrish pushed a commit that referenced this issue Oct 12, 2021
All TS packets are expected to start with the sync byte 0x47, and
TS files are expected to start at the start of a packet. Because of
that, we assumed that any TS file that did not start with the sync
byte of 0x47 is invalid.
However, it is possible that a TS file might not start on a sync
byte... perhaps the first few bytes got cut off, for some reason?
In those cases, it would be better to just drop that cut-off first
packet, instead of entirely rejecting the TS file.
This CL changes the HLS parser to keep looking forward for the
length of a few packets for the first sync byte, when parsing TS
files to try to find their start time.

Closes #3580

Change-Id: I0bace4b3a84398e09046828d749f3f025dfad26f
joeyparrish pushed a commit that referenced this issue Oct 12, 2021
All TS packets are expected to start with the sync byte 0x47, and
TS files are expected to start at the start of a packet. Because of
that, we assumed that any TS file that did not start with the sync
byte of 0x47 is invalid.
However, it is possible that a TS file might not start on a sync
byte... perhaps the first few bytes got cut off, for some reason?
In those cases, it would be better to just drop that cut-off first
packet, instead of entirely rejecting the TS file.
This CL changes the HLS parser to keep looking forward for the
length of a few packets for the first sync byte, when parsing TS
files to try to find their start time.

Closes #3580

Change-Id: I0bace4b3a84398e09046828d749f3f025dfad26f
joeyparrish pushed a commit that referenced this issue Oct 12, 2021
All TS packets are expected to start with the sync byte 0x47, and
TS files are expected to start at the start of a packet. Because of
that, we assumed that any TS file that did not start with the sync
byte of 0x47 is invalid.
However, it is possible that a TS file might not start on a sync
byte... perhaps the first few bytes got cut off, for some reason?
In those cases, it would be better to just drop that cut-off first
packet, instead of entirely rejecting the TS file.
This CL changes the HLS parser to keep looking forward for the
length of a few packets for the first sync byte, when parsing TS
files to try to find their start time.

Closes #3580

Change-Id: I0bace4b3a84398e09046828d749f3f025dfad26f
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Nov 14, 2021
@shaka-project shaka-project locked and limited conversation to collaborators Nov 14, 2021
@avelad avelad modified the milestones: Backlog, v3.3 May 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: HLS The issue involves Apple's HLS manifest format priority: P3 Useful but not urgent status: archived Archived and locked; will not be updated type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants