fix(audio): acquire streams before negotiation when peer is answerer
When a sendrecv peer acts as the answerer, gUM is only called _after_ the remote offer is received. This is fine, but the error handling runs different in that scenario in a way that eventual gUM errors are treated as negotiation errors, leading to inconsistencies when surfacing the error to end users. If a peer is acting as answerer and is a transceiver, acquire the local streams _before_ actual negotiation so that gUM errors are surfaced correctly (and we spare uneeded negotiation steps).
This commit is contained in:
parent
fcbfcb1bbc
commit
555a8f6522
@ -97,11 +97,20 @@ class AudioBroker extends BaseBroker {
|
||||
this.webRtcPeer.peerConnection.onconnectionstatechange = this.handleConnectionStateChange.bind(this);
|
||||
|
||||
if (this.offering) {
|
||||
// We are the offerer
|
||||
this.webRtcPeer.generateOffer()
|
||||
.then(this.sendStartReq.bind(this))
|
||||
.catch(this._handleOfferGenerationFailure.bind(this));
|
||||
} else {
|
||||
} else if (peerRole === 'recvonly') {
|
||||
// We are the answerer and we are only listening, so we don't need
|
||||
// to acquire local media
|
||||
this.sendStartReq();
|
||||
} else {
|
||||
// We are the answerer and we are sending audio, so we need to acquire
|
||||
// local media before sending the start request
|
||||
this.webRtcPeer.mediaStreamFactory()
|
||||
.then(() => { this.sendStartReq(); })
|
||||
.catch(this._handleOfferGenerationFailure.bind(this));
|
||||
}
|
||||
|
||||
resolve();
|
||||
|
Loading…
Reference in New Issue
Block a user