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

H264 spreader #194

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

H264 spreader #194

wants to merge 1 commit into from

Conversation

jvary
Copy link

@jvary jvary commented Jul 3, 2022

REQUEST FOR COMMENTS:
H264 spreader : reduces the RTP payload size so 3rd parties RTP sources can be properly redirected over SRTP/WebRTC without IP fragmentation.

High level steps:

  • Passes RTP content straight if possible
    • (if not FUA & not too big)
    • might RtpSeq offset if needed
  • Splits StapA in sub-nals
    • (and then sub-nals in FUA if still too big)
  • Splits StandAlone NAL in FUA
  • Spreads FUA in smaller FUA, carrying 'trailing data' to maximize the size of each FUA nal.
    • (flushing the trailing on RtpSequence discontinuity or change of type)

The steps above handle :

  • RtpSeq offset/adjustment of each packet
  • Rtp Marker 'delay'
  • 'Delay' of FUA 'end' bit if needed.

Advantages vs building whole H264 Frame as you initially proposed:

  • many packets just go through after two 'if'
  • less memory footprint
  • more continuous flow / less data burst
  • RTP sequence holes are 'kept', so it is easier to track quality / packet loss

Future improvement: back-buffer to persist between Process(), to avoid making new buffer for each new returned RTP.

jvary@genetec.com

@@ -0,0 +1,401 @@
/*
Copy link
Author

Choose a reason for hiding this comment

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

Not sure where this struct/file should go ? Top folder ? A new internal package ?

@@ -1,2 +1,16 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Copy link
Author

Choose a reason for hiding this comment

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

I added ‘stretchr/testify’ to get more concise tests. However, I get the feeling it will be frown upon because it brings too many dependencies ?

@stv0g stv0g changed the title h264 spreader H264 spreader Apr 18, 2023
@jvary
Copy link
Author

jvary commented Oct 26, 2023

Ok, it looks like there is little interest for this PR/feature, so closing it.

@jvary jvary closed this Oct 26, 2023
@Sean-Der
Copy link
Member

Sean-Der commented Oct 26, 2023

Hi @jvary i would like to take this! I am just very overwhelmed with PRs

@Sean-Der Sean-Der reopened this Oct 26, 2023
@Sean-Der
Copy link
Member

I will review and address all issues myself :)

@jvary
Copy link
Author

jvary commented Oct 26, 2023

Oh! Glad there is interest!
We continued development in-house (and fixed 1-2 bugs as well), so I will update this PR.
@Sean-Der : question : would you rather have the 'interface' dealing with raw slices (as right-now), or have rtp.Packet in input/output ?

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.

None yet

2 participants