$OpenBSD$ index 6cac31f..f91c58d 100644 --- media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp.orig Fri Feb 20 15:40:37 2015 +++ media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp Fri Feb 20 15:40:37 2015 @@ -182,10 +182,10 @@ nsresult PeerConnectionMedia::Init(const std::vector& stun_serv } mIceCtx->SignalGatheringStateChange.connect( this, - &PeerConnectionMedia::IceGatheringStateChange); + &PeerConnectionMedia::IceGatheringStateChange_s); mIceCtx->SignalConnectionStateChange.connect( this, - &PeerConnectionMedia::IceConnectionStateChange); + &PeerConnectionMedia::IceConnectionStateChange_s); // Create three streams to start with. // One each for audio, video and DataChannel @@ -503,16 +503,52 @@ PeerConnectionMedia::AddRemoteStreamHint(int aIndex, bool aIsVideo) void -PeerConnectionMedia::IceGatheringStateChange(NrIceCtx* ctx, - NrIceCtx::GatheringState state) +PeerConnectionMedia::IceGatheringStateChange_s(NrIceCtx* ctx, + NrIceCtx::GatheringState state) { + ASSERT_ON_THREAD(mSTSThread); + // ShutdownMediaTransport_s has not run yet because it unhooks this function + // from its signal, which means that SelfDestruct_m has not been dispatched + // yet either, so this PCMedia will still be around when this dispatch reaches + // main. + GetMainThread()->Dispatch( + WrapRunnable(this, + &PeerConnectionMedia::IceGatheringStateChange_m, + ctx, + state), + NS_DISPATCH_NORMAL); +} + +void +PeerConnectionMedia::IceConnectionStateChange_s(NrIceCtx* ctx, + NrIceCtx::ConnectionState state) +{ + ASSERT_ON_THREAD(mSTSThread); + // ShutdownMediaTransport_s has not run yet because it unhooks this function + // from its signal, which means that SelfDestruct_m has not been dispatched + // yet either, so this PCMedia will still be around when this dispatch reaches + // main. + GetMainThread()->Dispatch( + WrapRunnable(this, + &PeerConnectionMedia::IceConnectionStateChange_m, + ctx, + state), + NS_DISPATCH_NORMAL); +} + +void +PeerConnectionMedia::IceGatheringStateChange_m(NrIceCtx* ctx, + NrIceCtx::GatheringState state) +{ + ASSERT_ON_THREAD(mMainThread); SignalIceGatheringStateChange(ctx, state); } void -PeerConnectionMedia::IceConnectionStateChange(NrIceCtx* ctx, - NrIceCtx::ConnectionState state) +PeerConnectionMedia::IceConnectionStateChange_m(NrIceCtx* ctx, + NrIceCtx::ConnectionState state) { + ASSERT_ON_THREAD(mMainThread); SignalIceConnectionStateChange(ctx, state); }