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

Add vp9 svc support by Dependency Descriptor #1586

Merged
merged 3 commits into from
Apr 6, 2023
Merged

Add vp9 svc support by Dependency Descriptor #1586

merged 3 commits into from
Apr 6, 2023

Conversation

cnderrauber
Copy link
Contributor

No description provided.

@@ -570,14 +570,14 @@ func (f *Forwarder) AllocateOptimal(availableLayers []int32, brs Bitrates, allow
alloc.TargetLayers.Spatial = l
}
}
alloc.TargetLayers.Temporal = buffer.DefaultMaxLayerTemporal
alloc.TargetLayers.Temporal = f.maxLayers.Temporal
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change to fix client preferred fps (temporary layer), can you verify it is correct? @boks1971

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be okay @cnderrauber , but we probably need to allow that opportunistic higher layer. I will looking at adding it back for simulcast tracks and use proper layer for DD tracks.

if profile != 3 {
return (vp9.Payload[0] & 0xC) == 0
}
return (vp9.Payload[0] & 0x6) == 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't fully understand this. I cannot read the bit stream format document :-). But, this RFC seems to say that we do not need to dig beyond the VP9 Payload Descriptor to determine key frame. I may change this function based on that when I do my refactor. Guess, we really do not need to know if key frame or not with dependency descriptor. We will need that only when using simulcast.

https://datatracker.ietf.org/doc/html/draft-ietf-payload-vp9-16. The actual text

      A key picture is a picture whose base
      spatial layer frame is a key frame, and which thus completely
      resets the encoder state.  This packet will have its P bit equal
      to zero, SID or L bit (described below) equal to zero, and B bit
      (described below) equal to 1.

This is what I used in the refactor branch I am working on. I will compare with the above and check if they match.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Guess, we really do not need to know if key frame or not with dependency descriptor.

That's true, actually, it works well without this keyframe detection function, just add it to be consistent with other codecs.


alloc.RequestLayerSpatial = alloc.TargetLayers.Spatial
} else {
requestLayerSpatial := int32(math.Min(float64(f.maxLayers.Spatial), float64(f.maxPublishedLayer)))
if f.currentLayers.IsValid() && requestLayerSpatial == f.requestLayerSpatial && f.currentLayers.Spatial == f.requestLayerSpatial {
// current is locked to desired, stay there
alloc.TargetLayers = f.currentLayers
alloc.TargetLayers = buffer.VideoLayer{Spatial: f.requestLayerSpatial, Temporal: f.maxLayers.Temporal}
alloc.RequestLayerSpatial = f.requestLayerSpatial
Copy link
Contributor

Choose a reason for hiding this comment

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

Might have to revert these changes back to how they were and deal with layer limiting based on DD or not. But, I will take care of it in the refactor branch.

@cnderrauber cnderrauber merged commit fb301e6 into master Apr 6, 2023
@cnderrauber cnderrauber deleted the vp9 branch April 6, 2023 13:51
hautvfami pushed a commit to Stark-Industries-Ltd/livekit that referenced this pull request Jul 21, 2023
* Add VP9 SVC support

* Fix preferred fps does not work

* Fix forwarder test
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