-
Notifications
You must be signed in to change notification settings - Fork 42
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
RTCRtpSender and RTCRtpReceiver state #399
Comments
At the moment, it is not clear when the onerror event handler will be called. |
If "onerror" is ever fired, it's not fatal. This was more done because we didn't want send() and receive() to have a promise but some issues may be discovered asynchronously later. If this is the case, the error can be fired and calling send() or receive() again can resolve the issue. I'm open for discussion on this behaviour but that's how it currently is working... |
We should have a section defining |
Is a promise needed on a E.g. if you called |
Since some errors might require accessing multiple objects (e.g. checking the header extension mappings for all receivers on the same transport), receive() (and send(), for that matter) might need to be async. If that change is made, I'm not sure what onerror would be used for. |
@robin-raymond What do you recommend we do here? Change send() and receive() to async? Clarify the usage of onerror? |
@aboba I'm thinking What does 1.0 return? Plus then we can have getParameters() method that returns the post-filled information for the sender method too if we so choose to add that and we can know it is safe to call because the promise was resolved... |
I think the movement is clearly towards a promise. There's just no other way to know what failed for an asynchronous based operation that fails later after receive() / send() returns. |
This is the fix that we need to do: partial interface RTCRtpSender {
Promise<void> send(RTCRtpParameters parameters);
attribute EventHandler? onerror; // REMOVE THIS
}
partial interface RTCRtpReceiver {
Promise<void> receive (RTCRtpParameters parameters);
attribute EventHandler? onerror; // REMOVE THIS
} The event summary also needs to remove those events for onerror. |
👍 BTW: wouldn't we need the very same for |
Yes, setTransport() probably needs to be async as well. |
@aboba @ibc I can't think of anything (other than the transport being in an invalid state, i.e. "closed") that would cause adverse affects only detected later. Do you have any ideas? I'm not sure there will be a possible "rejection", more of an exception of the transports are in the wrong state at the time of being passed into the sender/receiver. However, I think of is the promise would indicate when the change of transport has completed. For example, if you were remapping from one transport to another and you wanted to know when it was "safe" to dump an old transport in favour of a new one then you'd want to know when the promise was resolved and thus it's safe to close out the old transport. That's a justification for making "setTransport" a promise. I'm already convinced "send / receive" methods require a promise because "onerror" is just confusing when / if it fires. Thoughts? |
I'm not aware of which kind of internal complexity could make So I'm fine with |
setTransport should return a promise as per #467 |
Looks better. |
Neither the RTCRtpSender nor the RTCRtpReceiver objects have an associated state attribute or state change events. When the onerror event handler is fired is this equivalent to calling stop() (e.g. always non-recoverable)?
The text was updated successfully, but these errors were encountered: