Bug 1591199: Don't assert when a candidate is gathered for a transceiver that is not associated, since that can happen in certain rollback scenarios. r=mjf

Depends on D60308

Differential Revision: https://phabricator.services.mozilla.com/D60309

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Byron Campen [:bwc] 2020-01-22 02:49:47 +00:00
Родитель c643dbf3ec
Коммит c035458265
1 изменённых файлов: 3 добавлений и 6 удалений

Просмотреть файл

@ -2083,22 +2083,18 @@ nsresult JsepSessionImpl::AddLocalIceCandidate(const std::string& candidate,
std::string* mid, std::string* mid,
bool* skipped) { bool* skipped) {
mLastError.clear(); mLastError.clear();
*skipped = true;
if (!mCurrentLocalDescription && !mPendingLocalDescription) { if (!mCurrentLocalDescription && !mPendingLocalDescription) {
JSEP_SET_ERROR("Cannot add ICE candidate when there is no local SDP"); JSEP_SET_ERROR("Cannot add ICE candidate when there is no local SDP");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }
JsepTransceiver* transceiver = GetTransceiverWithTransport(transportId); JsepTransceiver* transceiver = GetTransceiverWithTransport(transportId);
*skipped = !transceiver; if (!transceiver || !transceiver->IsAssociated()) {
if (*skipped) {
// mainly here to make some testing less complicated, but also just in case // mainly here to make some testing less complicated, but also just in case
return NS_OK; return NS_OK;
} }
MOZ_ASSERT(
transceiver->IsAssociated(),
"ICE candidate was gathered before the transceiver was associated! "
"This should never happen.");
*level = transceiver->GetLevel(); *level = transceiver->GetLevel();
*mid = transceiver->GetMid(); *mid = transceiver->GetMid();
@ -2115,6 +2111,7 @@ nsresult JsepSessionImpl::AddLocalIceCandidate(const std::string& candidate,
*level, ufrag); *level, ufrag);
} }
*skipped = false;
return rv; return rv;
} }