mirror of
https://github.com/jech/galene.git
synced 2024-11-10 02:35:58 +01:00
Move keyframe handling back to the packet level.
Doing that at the sample level suffers from too much delay due to buffering in the samplebuilder.
This commit is contained in:
parent
d47c6834dc
commit
564dcd4167
1 changed files with 4 additions and 10 deletions
|
@ -470,6 +470,9 @@ func (t *diskTrack) writeRTP(p *rtp.Packet) error {
|
||||||
kf, _ := gcodecs.Keyframe(codec, p)
|
kf, _ := gcodecs.Keyframe(codec, p)
|
||||||
if kf {
|
if kf {
|
||||||
t.savedKf = p
|
t.savedKf = p
|
||||||
|
t.lastKf = time.Now()
|
||||||
|
} else if time.Since(t.lastKf) > 4*time.Second {
|
||||||
|
requestKeyframe(t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +521,6 @@ func (t *diskTrack) writeBuffered(force bool) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
keyframe = true
|
|
||||||
if t.writer == nil {
|
if t.writer == nil {
|
||||||
if !t.conn.hasVideo {
|
if !t.conn.hasVideo {
|
||||||
err := t.conn.initWriter(0, 0)
|
err := t.conn.initWriter(0, 0)
|
||||||
|
@ -533,14 +535,6 @@ func (t *diskTrack) writeBuffered(force bool) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
now := time.Now()
|
|
||||||
if keyframe {
|
|
||||||
t.lastKf = now
|
|
||||||
} else if t.writer == nil || now.Sub(t.lastKf) > 4*time.Second {
|
|
||||||
requestKeyframe(t)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.writer == nil {
|
if t.writer == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue