-
Notifications
You must be signed in to change notification settings - Fork 190
Check ICE State before suspending Orchestrator #3614
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3614 +/- ##
===================================================
- Coverage 30.78230% 30.77426% -0.00804%
===================================================
Files 153 153
Lines 45916 45928 +12
===================================================
Hits 14134 14134
- Misses 30958 30970 +12
Partials 824 824
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
@@ -809,6 +809,7 @@ func (ls *LivepeerServer) CreateWhip(server *media.WHIPServer) http.Handler { | |||
whepURL = "http://localhost:8889/" // default mediamtx output | |||
} | |||
whepURL = whepURL + streamName + "-out/whep" | |||
conn := server.CreateWHIP(ctx, ssr, whepURL, w, r) |
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.
Afaict it looks ok to move this line up/earlier but maybe worth @j0sh confirming
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.
We should preserve the original ordering.
Swapping them would block things like stream auth and orch selection which is undesirable, since CreateWHIP
is not guaranteed to complete quickly.
If the ice state is still needed, then it should be wired through the WHIPConnection
struct which is already available in this scope via the whipConn
var. A bit unwieldy, but that's why we have the distinction between MediaState and WHIPConnection.
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.
Thanks for this PR - in addition to the comment about reordering the conn
, is this PR still needed now that we have #3613 ? Specifically, I am curious about what exactly this PR fixes, eg what are the the scenarios when:
- we time out via the 15 second segment timeout
- we do not have an ICE timeout
- the state is not connected and we haven't cleaned up the stream
BTW this may still produce spurious suspensions because the ICE state doesn't immediately transition to connected
- here are the previous states.
But rather than checking for specific ICE states, which I feel are bound to change, we probably should tighten up our overall notion of when a stream is actually connected and when it isn't; I started a bit of that work in #3590 . This might also involve stricter ICE (peerconnection) checks, eg explicitly closing on the disconnected
and failed
states but we need to do a little more verification before going that far; I'll try to get that in shortly.
@@ -809,6 +809,7 @@ func (ls *LivepeerServer) CreateWhip(server *media.WHIPServer) http.Handler { | |||
whepURL = "http://localhost:8889/" // default mediamtx output | |||
} | |||
whepURL = whepURL + streamName + "-out/whep" | |||
conn := server.CreateWHIP(ctx, ssr, whepURL, w, r) |
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.
We should preserve the original ordering.
Swapping them would block things like stream auth and orch selection which is undesirable, since CreateWHIP
is not guaranteed to complete quickly.
If the ice state is still needed, then it should be wired through the WHIPConnection
struct which is already available in this scope via the whipConn
var. A bit unwieldy, but that's why we have the distinction between MediaState and WHIPConnection.
Thanks for the comments Josh!
I think that we still do need it. Look at this example:
So, we may either further reduce the ICE Timeout or use the ICE state to decide what to do if the out segment does not arrive by the given time. I think that from the user perspective waiting 15s for the out segment is a lot. Wdyt?
Yeah, I think it's a good idea. We need some general conditions and rules of when the stream is "connected". And the same for how long we "tolerate" out segments not coming back to the user before we stop or restart the whole piepeline. |
In this case, input stopped coming in ( It feels odd to attribute stream termination to "no output segments" when the issue is we actually had no input. We really should tighten up our criteria of what's considered connected and tear down the rest of the stream sooner than that. Consider the case when we do orchestrator swapping (instead of stream termination like we do now). The output segment times out, so we swap orchestrators ... then what? Wait some more until we swap again or have an official disconnect?
Agreed, but we should also have a clear distinction when the issue is actually from the O itself, rather than some other input issue. |
Before sending a "out segment timeout" error (and suspending Orchestrator), first check if the ICE Connection is connected.