1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 16:45:58 +01:00

Remove track muting.

This commit is contained in:
Juliusz Chroboczek 2020-04-30 20:54:09 +02:00
parent 118ad7a3a7
commit 8fa68f9605
2 changed files with 1 additions and 33 deletions

View file

@ -353,9 +353,6 @@ func upLoop(conn *upConnection, track *upTrack) {
} }
for _, l := range local { for _, l := range local {
if l.muted() {
continue
}
err := l.track.WriteRTP(&packet) err := l.track.WriteRTP(&packet)
if err != nil && err != io.ErrClosedPipe { if err != nil && err != io.ErrClosedPipe {
log.Printf("%v", err) log.Printf("%v", err)
@ -601,9 +598,6 @@ func rtcpDownListener(g *group, conn *downConnection, track *downTrack, s *webrt
for _, p := range ps { for _, p := range ps {
switch p := p.(type) { switch p := p.(type) {
case *rtcp.PictureLossIndication: case *rtcp.PictureLossIndication:
if track.muted() {
continue
}
err := conn.remote.sendPLI(track.remote) err := conn.remote.sendPLI(track.remote)
if err != nil { if err != nil {
log.Printf("sendPLI: %v", err) log.Printf("sendPLI: %v", err)
@ -631,9 +625,6 @@ func rtcpDownListener(g *group, conn *downConnection, track *downTrack, s *webrt
} }
} }
case *rtcp.TransportLayerNack: case *rtcp.TransportLayerNack:
if track.muted() {
continue
}
sendRecovery(p, track) sendRecovery(p, track)
} }
} }
@ -671,8 +662,6 @@ func updateUpBitrate(up *upConnection) {
bitrate := atomic.LoadUint64(&l.maxBitrate.bitrate) bitrate := atomic.LoadUint64(&l.maxBitrate.bitrate)
loss := atomic.LoadUint32(&l.loss) loss := atomic.LoadUint32(&l.loss)
if now < ms || now > ms+5000 || bitrate == 0 { if now < ms || now > ms+5000 || bitrate == 0 {
// no rate information
l.setMuted(false)
continue continue
} }
@ -687,17 +676,12 @@ func updateUpBitrate(up *upConnection) {
if loss <= 13 { if loss <= 13 {
// less than 10% loss, go ahead // less than 10% loss, go ahead
bitrate = minrate2 bitrate = minrate2
} else if loss <= 64 || !isvideo { } else if loss <= 64 {
if bitrate < minrate1 { if bitrate < minrate1 {
bitrate = minrate1 bitrate = minrate1
} }
} else {
// video track with dramatic loss
l.setMuted(true)
continue
} }
} }
l.setMuted(false)
if track.maxBitrate > bitrate { if track.maxBitrate > bitrate {
track.maxBitrate = bitrate track.maxBitrate = bitrate
} }

View file

@ -76,27 +76,11 @@ type timeStampedBitrate struct {
type downTrack struct { type downTrack struct {
track *webrtc.Track track *webrtc.Track
remote *upTrack remote *upTrack
isMuted uint32
maxBitrate *timeStampedBitrate maxBitrate *timeStampedBitrate
rate *estimator.Estimator rate *estimator.Estimator
loss uint32 loss uint32
} }
func (t *downTrack) muted() bool {
return atomic.LoadUint32(&t.isMuted) != 0
}
func (t *downTrack) setMuted(muted bool) {
if t.muted() == muted {
return
}
m := uint32(0)
if muted {
m = 1
}
atomic.StoreUint32(&t.isMuted, m)
}
type downConnection struct { type downConnection struct {
id string id string
pc *webrtc.PeerConnection pc *webrtc.PeerConnection