Commit faf76ab1 authored by Byron Campen's avatar Byron Campen
Browse files

Bug 1832176: Fix bug where we could set mPendingRidChangeFromCompatMode...

Bug 1832176: Fix bug where we could set mPendingRidChangeFromCompatMode without setting mPendingParameters. r=jib

This could cause a crash if the timing was just right.

Depends on D177647

Differential Revision: https://phabricator.services.mozilla.com/D177648
parent 3293e5c9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -575,6 +575,7 @@ already_AddRefed<Promise> RTCRtpSender::SetParameters(
  // If any of the following conditions are met,
  // return a promise rejected with a newly created InvalidModificationError:

  bool pendingRidChangeFromCompatMode = false;
  // encodings.length is different from N.
  if (paramsCopy.mEncodings.Length() != oldParams->mEncodings.Length()) {
    nsCString error("Cannot change the number of encodings with setParameters");
@@ -589,7 +590,7 @@ already_AddRefed<Promise> RTCRtpSender::SetParameters(
    }
    // Make sure we don't use the old rids in SyncToJsep while we wait for the
    // queued task below to update mParameters.
    mPendingRidChangeFromCompatMode = true;
    pendingRidChangeFromCompatMode = true;
    mSimulcastEnvelopeSet = true;
    if (!mHaveWarnedBecauseEncodingCountChange) {
      mHaveWarnedBecauseEncodingCountChange = true;
@@ -743,6 +744,7 @@ already_AddRefed<Promise> RTCRtpSender::SetParameters(
  // This also allows PeerConnectionImpl to detect when there is a pending
  // setParameters, which has implcations for the handling of
  // setRemoteDescription.
  mPendingRidChangeFromCompatMode = pendingRidChangeFromCompatMode;
  mPendingParameters = Some(paramsCopy);
  uint32_t serialNumber = ++mNumSetParametersCalls;
  MaybeUpdateConduit();