-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
A/V sync problems with unaligned HLS streams #4308
Comments
@joeyparrish can you review it? Thanks! |
I can reproduce the issue. I'll take a closer look at the content. I suspect that this is a problem with your encoding, but I'll try to verify. |
Okay, I understand the problem now. This would occur with any content whose video segments or audio segments are not all aligned across playlists. For example, the first four segment lengths across 3 different streams:
Switching between 360p and 1080p would be fine, but between 360p and 720p or 720p and 1080p would trigger the issue. This appears to be a bug in StreamingEngine, which doesn't account for adaptation. On adaptation, just as on seek, we need to ask MediaSourceEngine to reset the timestamp offset, to ensure the new content is correctly placed on the timeline. |
We've had to turn off ad stitching and we think this issue is the root cause. Just wanted to add my voice to the issue, and it's pretty serious for us. |
Thanks. I bumped the priority and tentatively assigned the issue to @JulianDomingo. I'll take it back if Julian doesn't have the bandwidth for it. |
We could probably help with providing test streams if needed (or using yospace hls cmaf reference streams should work). |
This reverts the HLS parser to using per-stream mediaSequenceToStartTime values for VOD, which will allow us to play unaligned HLS streams on that sort of content. Issue shaka-project#4308
This reverts the HLS parser to using per-stream mediaSequenceToStartTime values for VOD, which will allow us to play unaligned HLS streams on that sort of content. Issue #4308
Fix is based on suggestions from @joeyparrish in #4308 (comment). During automatic adaptations, Shaka will now reset the timestamp offset to ensure the newly active track is properly aligned in the presentation. Verified by disabling ABR and manually triggering variant switches (`shaka.Player.selectVariantTrack()`) between seemingly problematic combinations (e.g., `400k` bps => `6000k` bps stream). Behavior was compared against production. Since `adaptation` events are only triggered by ABR logic (and ABR was disabled for manual testing), `selectVariantTrack()` logic was temporarily changed from: `this.switchVariant_(variant, /* fromAdaptation= */ false, clearBuffer, safeMargin);` => `this.switchVariant_(variant, /* fromAdaptation= */ true, clearBuffer, safeMargin);` to ensure the fixes proposed in this PR were taken into effect and being used during manual testing. Tested content is from the reported bug, located here: #4308 (comment) Closes #4308
Fix is based on suggestions from @joeyparrish in #4308 (comment). During automatic adaptations, Shaka will now reset the timestamp offset to ensure the newly active track is properly aligned in the presentation. Verified by disabling ABR and manually triggering variant switches (`shaka.Player.selectVariantTrack()`) between seemingly problematic combinations (e.g., `400k` bps => `6000k` bps stream). Behavior was compared against production. Since `adaptation` events are only triggered by ABR logic (and ABR was disabled for manual testing), `selectVariantTrack()` logic was temporarily changed from: `this.switchVariant_(variant, /* fromAdaptation= */ false, clearBuffer, safeMargin);` => `this.switchVariant_(variant, /* fromAdaptation= */ true, clearBuffer, safeMargin);` to ensure the fixes proposed in this PR were taken into effect and being used during manual testing. Tested content is from the reported bug, located here: #4308 (comment) Closes #4308
Fix is based on suggestions from @joeyparrish in #4308 (comment). During automatic adaptations, Shaka will now reset the timestamp offset to ensure the newly active track is properly aligned in the presentation. Verified by disabling ABR and manually triggering variant switches (`shaka.Player.selectVariantTrack()`) between seemingly problematic combinations (e.g., `400k` bps => `6000k` bps stream). Behavior was compared against production. Since `adaptation` events are only triggered by ABR logic (and ABR was disabled for manual testing), `selectVariantTrack()` logic was temporarily changed from: `this.switchVariant_(variant, /* fromAdaptation= */ false, clearBuffer, safeMargin);` => `this.switchVariant_(variant, /* fromAdaptation= */ true, clearBuffer, safeMargin);` to ensure the fixes proposed in this PR were taken into effect and being used during manual testing. Tested content is from the reported bug, located here: #4308 (comment) Closes #4308
This changes the HLS parser so that the media playlists are only downloaded when the createSegmentIndex function for the associated stream is called. Because there is some important information about HLS streams that is stored inside the media playlist, this also changes the player to call createSegmentIndex on the initial variant earlier in the load process, to make sure that information is available in time. As of this change, we will now require HLS streams to be aligned (see #4308) for livestreams. VOD content can still be unaligned. Closes #1936
Have you read the FAQ and checked for duplicate open issues?
Yes
What version of Shaka Player are you using?
v4.1.1
Can you reproduce the issue with our latest release version?
Yes
Are you using the demo app or your own custom app?
Demo App
What browser and OS are you using?
GoogleChrome, Firefox, Ubuntu
I have a media content with video and audio encoded separately and different rates. During its streaming, sometimes when an adaptation event occurs and bitrate is changed , shaka is repeating the download and playback of the last video segment, with a different rate, that is leading video and audio out of sync.
I've experienced this behaviour on shaka player demo and on a custom application using v4.1.1 and v3.4.0 on chrome and firefox, and changing the bandwidth using the browser network tools. I also made changes in the main playlist to be similar to a hls main playlist example provided by apple at https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8, but it didn't solve the problem.
Link to the main playlist of the encoded video:
https://storage.googleapis.com/akiry-public/video-and-audio-4s/upload_41af1db0-eb71-11ec-85da-710193d27b0f.m3u8
Screenshot of shaka player demo
The text was updated successfully, but these errors were encountered: