mirror of
https://github.com/jech/galene.git
synced 2024-11-09 10:15:58 +01:00
Fix keyframe detection for VP8 and VP9.
This commit is contained in:
parent
8bbf9d16d0
commit
42748d4ad8
1 changed files with 4 additions and 3 deletions
|
@ -266,10 +266,10 @@ func PacketFlags(codec string, buf []byte) (Flags, error) {
|
|||
if err != nil {
|
||||
return flags, err
|
||||
}
|
||||
|
||||
flags.Start = vp8.S != 0 && vp8.PID == 0
|
||||
flags.End = packet.Marker
|
||||
flags.Keyframe = vp8.S != 0 && (vp8.Payload[0]&0x1) == 0
|
||||
flags.Keyframe = vp8.S != 0 && vp8.PID == 0 &&
|
||||
len(vp8.Payload) > 0 && (vp8.Payload[0]&0x1) == 0
|
||||
flags.Pid = vp8.PictureID
|
||||
flags.Tid = vp8.TID
|
||||
flags.TidUpSync = flags.Keyframe || vp8.Y == 1
|
||||
|
@ -289,7 +289,8 @@ func PacketFlags(codec string, buf []byte) (Flags, error) {
|
|||
}
|
||||
flags.Start = vp9.B
|
||||
flags.End = vp9.E
|
||||
if (vp9.Payload[0] & 0xc0) == 0x80 {
|
||||
if vp9.B && len(vp9.Payload) > 0 &&
|
||||
(vp9.Payload[0] & 0xc0) == 0x80 {
|
||||
profile := (vp9.Payload[0] >> 4) & 0x3
|
||||
if profile != 3 {
|
||||
flags.Keyframe = (vp9.Payload[0] & 0xC) == 0
|
||||
|
|
Loading…
Reference in a new issue