Skip to content

Support multiple sps/pps/vps in h265 AU#366

Merged
JoTurk merged 1 commit into
mainfrom
jo/h265-multi-sps-pps-vps
Jul 22, 2026
Merged

Support multiple sps/pps/vps in h265 AU#366
JoTurk merged 1 commit into
mainfrom
jo/h265-multi-sps-pps-vps

Conversation

@JoTurk

@JoTurk JoTurk commented Jul 18, 2026

Copy link
Copy Markdown
Member

Description

As discussed in discord, the SkipAggregation behavior isn't correct for H265 because streams can have multiple sps/pps/vps with different ids. while I wasn't able to find any non-svc real media files with this it's correct in the spec and chrome can play even tho chrome doesn't support SHVC http://download.tsi.telecom-paristech.fr/gpac/MPEG/LHEVCFF/Conformance/shvc_hev1_single_track.mp4 it's able to play this file after the fix (tested with hardware decode NVENC).
The problem is that the order in this file is:

#id=0  VPS
#id=0  SPS  
#id=0  PPS
#id=1  SPS  
#id=1  PPS
#id=0  IDR 
#id=1  IDR

chrome picks layer #0 and because we cache the last SPS/PPS the file doesn't play before this fix. I'm not sure if we should merge this as this sounds like a niche with more complexity trade off but it might become more common with svc h265 or other uses and it can save someone a few hours of debug in the future.
This is only a draft because i didn't add tests yet

@JoTurk
JoTurk requested review from Juliapixel and Sean-Der and removed request for Sean-Der July 18, 2026 15:57
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.63087% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.19%. Comparing base (2b19d5b) to head (378032e).

Files with missing lines Patch % Lines
codecs/h265_packet.go 94.63% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #366      +/-   ##
==========================================
+ Coverage   81.76%   82.19%   +0.42%     
==========================================
  Files          28       28              
  Lines        3526     3656     +130     
==========================================
+ Hits         2883     3005     +122     
- Misses        453      457       +4     
- Partials      190      194       +4     
Flag Coverage Δ
go 82.19% <94.63%> (+0.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JoTurk
JoTurk force-pushed the jo/h265-multi-sps-pps-vps branch from 4740371 to eb5531d Compare July 18, 2026 16:04
@JoTurk
JoTurk requested a review from Sean-Der July 18, 2026 16:08

@Ibn-Butt-Toota Ibn-Butt-Toota left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can create a section in the readme to document spec-breaking implementations or conflicts like this so it can be easier for observers to find? Or maybe if it's feasible we could add an experimental flag...

@JoTurk

JoTurk commented Jul 18, 2026

Copy link
Copy Markdown
Member Author

@Ibn-Butt-Toota thank you for the review, this is the spec correct way to cache sps/pps/vps the problem is that it's not clear if multiple sps/pps/vps are used outside of shvc and if it's common :)

@Ibn-Butt-Toota

Copy link
Copy Markdown

Sorry I misread the main comment. Thank you for clarifying. The PR still looks good (I know it's pending tests still).

@Sean-Der Sean-Der left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh hell yea, thank you for fixing this @JoTurk !

@JoTurk
JoTurk force-pushed the jo/h265-multi-sps-pps-vps branch 7 times, most recently from 59f94a3 to 9f54ad4 Compare July 22, 2026 13:31
@JoTurk
JoTurk force-pushed the jo/h265-multi-sps-pps-vps branch from 9f54ad4 to e61bd16 Compare July 22, 2026 14:09
@JoTurk
JoTurk marked this pull request as ready for review July 22, 2026 14:10
@JoTurk

JoTurk commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

@Sean-Der thank you for the review <3 turned out there were many other edge cases with multiple sps/pps/vps idk why h265 is this complex, hopefully I handled all of them :)

@JoTurk
JoTurk merged commit e61bd16 into main Jul 22, 2026
17 checks passed
@JoTurk
JoTurk deleted the jo/h265-multi-sps-pps-vps branch July 22, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants