Cache and restore forwarder state on resume (#786)

* WIP commit

* Clean up

* spelling mistake

* Run subscribed track onBind in a go routine

* Address comments and more safety net

* Cache and restore forwarder state on resume

* conflicts

* mage generate
This commit is contained in:
Raja Subramanian
2022-06-24 22:02:03 +05:30
committed by GitHub
parent 407996702b
commit 46bce33fb8
8 changed files with 236 additions and 112 deletions
+32
View File
@@ -15,6 +15,16 @@ type TranslationParamsVP8 struct {
Header *buffer.VP8
}
type VP8MungerState struct {
ExtLastPictureId int32
PictureIdUsed int
LastTl0PicIdx uint8
Tl0PicIdxUsed int
TidUsed int
LastKeyIdx uint8
KeyIdxUsed int
}
type VP8MungerParams struct {
pictureIdWrapHandler VP8PictureIdWrapHandler
extLastPictureId int32
@@ -48,6 +58,28 @@ func NewVP8Munger(logger logger.Logger) *VP8Munger {
}
}
func (v *VP8Munger) GetLast() VP8MungerState {
return VP8MungerState{
ExtLastPictureId: v.extLastPictureId,
PictureIdUsed: v.pictureIdUsed,
LastTl0PicIdx: v.lastTl0PicIdx,
Tl0PicIdxUsed: v.tl0PicIdxUsed,
TidUsed: v.tidUsed,
LastKeyIdx: v.lastKeyIdx,
KeyIdxUsed: v.keyIdxUsed,
}
}
func (v *VP8Munger) SeedLast(state VP8MungerState) {
v.extLastPictureId = state.ExtLastPictureId
v.pictureIdUsed = state.PictureIdUsed
v.lastTl0PicIdx = state.LastTl0PicIdx
v.tl0PicIdxUsed = state.Tl0PicIdxUsed
v.tidUsed = state.TidUsed
v.lastKeyIdx = state.LastKeyIdx
v.keyIdxUsed = state.KeyIdxUsed
}
func (v *VP8Munger) SetLast(extPkt *buffer.ExtPacket) {
vp8, ok := extPkt.Payload.(buffer.VP8)
if !ok {