mirror of
https://github.com/jech/galene.git
synced 2024-12-22 23:35:46 +01:00
More tweaks to layer switching.
I'm not seeing any non-keyframe spatial sync frames, so simplify the code by only switching spatial layers on keyframes.
This commit is contained in:
parent
d29f6d6e5d
commit
6aa7a9394a
1 changed files with 14 additions and 21 deletions
|
@ -231,9 +231,10 @@ func (down *rtpDownTrack) Write(buf []byte) (int, error) {
|
|||
|
||||
layer := down.getLayerInfo()
|
||||
|
||||
// increase eagerly if this is the first time we see a given layer
|
||||
if flags.Tid > layer.maxTid || flags.Sid > layer.maxSid {
|
||||
if flags.Tid > layer.maxTid {
|
||||
// increase eagerly if this is the first time we
|
||||
// see a given layer
|
||||
if layer.tid == layer.maxTid {
|
||||
layer.wantedTid = flags.Tid
|
||||
layer.tid = flags.Tid
|
||||
|
@ -253,32 +254,24 @@ func (down *rtpDownTrack) Write(buf []byte) (int, error) {
|
|||
}
|
||||
|
||||
if flags.Start && (layer.tid != layer.wantedTid) {
|
||||
if layer.wantedTid < layer.tid || flags.TidUpSync {
|
||||
if flags.Keyframe {
|
||||
layer.tid = layer.wantedTid
|
||||
down.setLayerInfo(layer)
|
||||
} else if layer.wantedTid < layer.tid {
|
||||
layer.tid = layer.wantedTid
|
||||
down.setLayerInfo(layer)
|
||||
} else if flags.TidUpSync && flags.Tid <= layer.wantedTid {
|
||||
layer.tid = flags.Tid
|
||||
down.setLayerInfo(layer)
|
||||
}
|
||||
}
|
||||
|
||||
if flags.Start && (layer.sid != layer.wantedSid) {
|
||||
if layer.wantedSid < layer.sid {
|
||||
if flags.Keyframe {
|
||||
layer.sid = layer.wantedSid
|
||||
down.setLayerInfo(layer)
|
||||
} else {
|
||||
down.remote.RequestKeyframe()
|
||||
}
|
||||
} else if layer.wantedSid > layer.sid {
|
||||
if flags.Keyframe {
|
||||
layer.sid = layer.wantedSid
|
||||
down.setLayerInfo(layer)
|
||||
} else if flags.Sid == layer.sid + 1 {
|
||||
if flags.SidUpSync {
|
||||
layer.sid = layer.sid + 1
|
||||
down.setLayerInfo(layer)
|
||||
} else {
|
||||
down.remote.RequestKeyframe()
|
||||
}
|
||||
}
|
||||
if flags.Keyframe {
|
||||
layer.sid = layer.wantedSid
|
||||
down.setLayerInfo(layer)
|
||||
} else {
|
||||
down.remote.RequestKeyframe()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue