-
Notifications
You must be signed in to change notification settings - Fork 11
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
[RTC-477] Allow for muting tracks without renegotiation #392
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #392 +/- ##
==========================================
- Coverage 55.19% 54.89% -0.31%
==========================================
Files 75 75
Lines 3299 3339 +40
==========================================
+ Hits 1821 1833 +12
- Misses 1478 1506 +28
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
edd670f
to
4df211a
Compare
@@ -41,6 +41,7 @@ defmodule Membrane.RTC.Engine.Integration.MixProject do | |||
{:membrane_rtc_engine_file, path: "../file"}, | |||
{:membrane_rtc_engine_sip, path: "../sip"}, | |||
{:membrane_rtc_engine_recording, path: "../recording"}, | |||
{:membrane_rtc_engine_webrtc, path: "../webrtc", override: true}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need override?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The monorepo structure introduces some problems during the process of releasing our packages. Setting override: true
here for packages which other packages depend on (engine
, webrtc
) helps alleviate some of these issues -- namely, CI will be able to run the tests even if other endpoints are locked onto hex versions of engine
and webrtc
instead of relative paths. This has virtually no downsides here, in the integration test suite.
You can take a look at /release.sh
for some insights into the process of releasing the engine and its endpoints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Engine changes LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add PR description? In particular:
- How is a track muted on the FE side?
- If track is muted, does it send any data?
- What do we do with bandwidth estimation when current track is muted? Do we try to keep it on the same level?
- Can it happen that muted track becomes inactive?
@type t :: %__MODULE__{variant: Track.variant()} | ||
@type t :: %__MODULE__{ | ||
variant: Track.variant(), | ||
reason: :inactive | :muted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we describe the difference between those two?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The track variant can be paused due to two reasons.
:inactive
means that VariantTracker
has detected reduced or no activity of the variant and has set it to this state
:muted
means that we have explicitly paused variant, indicating that the lack of data sent is deliberate and that we may resume it in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but let's write this in docs
@type t :: %__MODULE__{variant: Track.variant()} | ||
@type t :: %__MODULE__{ | ||
variant: Track.variant(), | ||
reason: :inactive | :muted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but let's write this in docs
@spec variant_inactive(t(), Track.variant()) :: {t(), selector_action_t()} | ||
def variant_inactive(selector, variant) do | ||
@spec variant_paused(t(), Track.variant(), :inactive | :muted) :: {t(), selector_action_t()} | ||
def variant_paused(selector, variant, :inactive) do | ||
Membrane.Logger.debug("Variant inactive #{variant}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Membrane.Logger.debug("Variant inactive #{variant}") | |
Membrane.Logger.debug("Variant paused #{variant}") |
86ae2fa
to
d7c54c8
Compare
This allows for explicitly muting and then unmuting tracks.
The flow is as follows:
mute
event from frontend AND replace the track with null so no data is sent.This is how it looks like on the FE:
The above is POC, and will probably end up with a dedicated function in
membrane-webrtc-js
.mute
event is handled byTrackSender
which sends%TrackVariantPaused{reason: :muted}
events.TrackReceiver
marks the currently active variant asmuted_variant
unmute
event is sent from FE as well as the track being replaced with an actual videoTrackSender
sendsTrackVariantResumed
events toTrackReceiver
VariantSelector
withinTrackReceiver
requests the last paused variant, ignoring the limitation of the bandwidth, which at this point is probably 0.I don't think that setting
muted
variant asinactive
is possible. That's because both when switching tomuted
andinactive
state we check whether the variant is in theactive
state first.