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 substream param to switch in VideoRoom #3197

Merged
merged 1 commit into from May 8, 2023

Conversation

brave44
Copy link
Contributor

@brave44 brave44 commented Apr 2, 2023

Ability to specify substream while switching in VideoRoom.

#3196

@januscla
Copy link

januscla commented Apr 2, 2023

Thanks for your contribution, @brave44! Please make sure you sign our CLA, as it's a required step before we can merge this.

@lminiero
Copy link
Member

Apologies for this late response, I have been abroad for a few weeks.

I think this is very incomplete at the moment. First of all, you're accessing a new property but not validating it, which is something we do automatically with JANUS_VALIDATE_JSON_OBJECT: check switch_update_parameters which is where the stream properties we support are defined (and which looks like where you're adding the new property). Besides, for some reason you only added a way to specify substreams but not the simulcast temporal layer: any functionality extension that only adds one of them and not both is by definition incomplete.

@lminiero lminiero added the multistream Related to Janus 1.x label Apr 11, 2023
@brave44
Copy link
Contributor Author

brave44 commented Apr 11, 2023

Apologies for this late response, I have been abroad for a few weeks.

I think this is very incomplete at the moment. First of all, you're accessing a new property but not validating it, which is something we do automatically with JANUS_VALIDATE_JSON_OBJECT: check switch_update_parameters which is where the stream properties we support are defined (and which looks like where you're adding the new property). Besides, for some reason you only added a way to specify substreams but not the simulcast temporal layer: any functionality extension that only adds one of them and not both is by definition incomplete.

Thanks for reply, I'll correct the request according to your comments.

Right now we found out that simulcasting_context_reset in switch causes video freeze right after switch. Picture freezes and we monitor freezeCount and totalFreezesDuration in webRTC stats.

By removing

janus_rtp_simulcasting_context_reset(&stream->sim_context);
janus_vp8_simulcast_context_reset(&stream->vp8_context);
janus_rtp_svc_context_reset(&stream->svc_context);

from switch (along with setting substream param) we have no freezes at all. Plus, if only set substream but not remove _context_reset, I see bitrate spike right after switch. (Spike to default bitrate witch is max bitrate). I think it's understandable and that what context resetting causes - it resets to defaults.

Maybe we don't need context resetting in switch at all? Simulcast context already been set, we working with existed stream, and just need new data in this stream, with ability to set desired substream. Why reset needed? What you think?

@lminiero
Copy link
Member

Maybe we don't need context resetting in switch at all? Simulcast context already been set, we working with existed stream, and just need new data in this stream, with ability to set desired substream. Why reset needed? What you think?

The reset is needed because the video publisher is not the same. In fact, we reset and then copy the rid_ext_id property, which may be different (or entirely unavailable), plus the new substream/temporal targets. This way it's as if we're starting fresh with a new stream (which indeed we are).

Are you sure the problem is not in janus_vp8_simulcast_context_reset(&stream->vp8_context) instead? That one may indeed have to be left alone, since just as janus_rtp_switching_context it's more specific to the subscriber stream itself: more precisely, it dictates how to rewrite PictureIDs, when doing simulcast, so resetting that may cause the wrong one to be written in RTP packets, possibly causing freezes.

@brave44
Copy link
Contributor Author

brave44 commented Apr 18, 2023

Are you sure the problem is not in janus_vp8_simulcast_context_reset(&stream->vp8_context) instead? That one may indeed have to be left alone, since just as janus_rtp_switching_context it's more specific to the subscriber stream itself: more precisely, it dictates how to rewrite PictureIDs, when doing simulcast, so resetting that may cause the wrong one to be written in RTP packets, possibly causing freezes.

Thanks, will try and let you know the results. Right now I deleted them both, and have no freezes, so may be it was vp8_simulcast_context_reset indeed.

…ext reset on switch:

Ability to specify substream while switching in VideoRoom.

meetecho#3196
@brave44
Copy link
Contributor Author

brave44 commented May 6, 2023

@lminiero I think you was right, janus_vp8_simulcast_context_reset was causing freezes, everything working good without it. Plus, I added validations and temporal layer param. Hope you'll take a look.

@lminiero
Copy link
Member

lminiero commented May 8, 2023

Thanks for the patch! I'll have a look later this afternoon and merge if it works for me too 👍

@lminiero
Copy link
Member

lminiero commented May 8, 2023

Looks good, merging ✌️

@lminiero lminiero merged commit 1c99362 into meetecho:master May 8, 2023
8 checks passed
@lminiero
Copy link
Member

lminiero commented May 8, 2023

I guess I'll have to add a similar approach for SVC as well, which at the moment isn't covered either.

@brave44
Copy link
Contributor Author

brave44 commented May 8, 2023

Thanks for your great work, man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multistream Related to Janus 1.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants