Bug 1001959 - Give up references to NrIceMediaStream on STS instead of main. r=jib

This commit is contained in:
Byron Campen [:bwc] 2014-04-28 09:01:29 -07:00
parent ef010696ee
commit 5a34f9cf91

View File

@ -1896,6 +1896,7 @@ PeerConnectionImpl::IceGatheringStateChange(
NS_DISPATCH_NORMAL);
}
#ifdef MOZILLA_INTERNAL_API
static bool isDone(PCImplIceConnectionState state) {
return state != PCImplIceConnectionState::Checking &&
state != PCImplIceConnectionState::New;
@ -1910,6 +1911,7 @@ static bool isFailed(PCImplIceConnectionState state) {
return state == PCImplIceConnectionState::Failed ||
state == PCImplIceConnectionState::Disconnected;
}
#endif
nsresult
PeerConnectionImpl::IceConnectionStateChange_m(PCImplIceConnectionState aState)
@ -2185,11 +2187,6 @@ PeerConnectionImpl::ExecuteStatsQuery_s(RTCStatsQuery *query) {
ASSERT_ON_THREAD(query->iceCtx->thread());
// NrIceCtx must be destroyed on STS, so it is not safe to dispatch it back
// to main.
RefPtr<NrIceCtx> iceCtxTmp(query->iceCtx);
query->iceCtx = nullptr;
// Gather stats from pipelines provided (can't touch mMedia + stream on STS)
for (size_t p = 0; p < query->pipelines.Length(); ++p) {
@ -2333,6 +2330,11 @@ PeerConnectionImpl::ExecuteStatsQuery_s(RTCStatsQuery *query) {
&(query->report));
}
// NrIceCtx and NrIceMediaStream must be destroyed on STS, so it is not safe
// to dispatch them back to main.
// We clear streams first to maintain destruction order
query->streams.Clear();
query->iceCtx = nullptr;
return NS_OK;
}