Make RTPTransceiver Stopped an atomic

Add an accessor to make getting value easy. Also add
TestPeerConnection_SkipStoppedTransceiver. This commit also cleans
up RTPTransceiver creation. We used a helper function, when we should
have just used the provide constructor
This commit is contained in:
Sean DuBois
2021-09-03 22:00:40 -04:00
parent 294595aff5
commit 6c3620093d
5 changed files with 97 additions and 59 deletions

View File

@@ -12,9 +12,20 @@ func (b *atomicBool) set(value bool) { // nolint: unparam
i = 1
}
atomic.StoreInt32(&(b.val), i)
atomic.StoreInt32(&b.val, i)
}
func (b *atomicBool) get() bool {
return atomic.LoadInt32(&(b.val)) != 0
return atomic.LoadInt32(&b.val) != 0
}
func (b *atomicBool) compareAndSwap(old, new bool) (swapped bool) {
var oldval, newval int32
if old {
oldval = 1
}
if new {
newval = 1
}
return atomic.CompareAndSwapInt32(&b.val, oldval, newval)
}