Plug a couple of holes in stream transitions. (#1905)
* Plug a couple of holes in stream transitions. 1. Missed negative sign meant stealing bits from other tracks was not working. 2. When a track change (mute, unmute, subscription change) cannot be allocated, explicitly pause so that stream state update happens. Refactor stream state update a bit to make it a bit cleaner. * correct comment
This commit is contained in:
@@ -42,7 +42,7 @@ type Track struct {
|
||||
|
||||
isDirty bool
|
||||
|
||||
isPaused bool
|
||||
streamState StreamState
|
||||
}
|
||||
|
||||
func NewTrack(
|
||||
@@ -61,7 +61,7 @@ func NewTrack(
|
||||
nackInfos: make(map[uint16]sfu.NackInfo),
|
||||
nackHistory: make([]string, 0, 10),
|
||||
receiverReportHistory: make([]string, 0, 10),
|
||||
isPaused: true,
|
||||
streamState: StreamStateInactive,
|
||||
}
|
||||
t.SetPriority(0)
|
||||
t.SetMaxLayer(downTrack.MaxLayer())
|
||||
@@ -78,12 +78,12 @@ func (t *Track) SetDirty(isDirty bool) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (t *Track) SetPaused(isPaused bool) bool {
|
||||
if t.isPaused == isPaused {
|
||||
func (t *Track) SetStreamState(streamState StreamState) bool {
|
||||
if t.streamState == streamState {
|
||||
return false
|
||||
}
|
||||
|
||||
t.isPaused = isPaused
|
||||
t.streamState = streamState
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user