Commit 4435a30a authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Use sequence parameter sets for h.264 keyframe detection.

RFC 6184 Section 8.5.1 implies that the sender will send a
a sequence parameter set in response to PLI.  Since a keyframe is
useless without parameters, use the SPS to detect keyframes.
parent f829da67
...@@ -150,7 +150,7 @@ func isKeyframe(codec string, packet *rtp.Packet) (bool, bool) { ...@@ -150,7 +150,7 @@ func isKeyframe(codec string, packet *rtp.Packet) (bool, bool) {
return false, false return false, false
} }
n := packet.Payload[i+offset] & 0x1F n := packet.Payload[i+offset] & 0x1F
if n == 5 { if n == 7 {
return true, true return true, true
} else if n >= 24 { } else if n >= 24 {
// is this legal? // is this legal?
...@@ -171,7 +171,7 @@ func isKeyframe(codec string, packet *rtp.Packet) (bool, bool) { ...@@ -171,7 +171,7 @@ func isKeyframe(codec string, packet *rtp.Packet) (bool, bool) {
// not a starting fragment // not a starting fragment
return false, true return false, true
} }
return (packet.Payload[1]&0x1F == 5), true return (packet.Payload[1]&0x1F == 7), true
} }
return false, false return false, false
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment