Skip to content

Commit cdacd1c

Browse files
authored
Rewrite VP8 isKeyFrame check (#2999)
#### Description [RFC 6386](https://www.rfc-editor.org/rfc/rfc6386#section-9.1) describes the least significant bit of the first byte of the header as: ``` A 1-bit frame type (0 for key frames, 1 for interframes). ``` The change is functionally a no-op, but the naming implies the wrong logic (you would assume `isKeyFrame == 1` means it is a key frame, but the opposite is true). #### Reference issue Fixes #...
1 parent 5edce95 commit cdacd1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/media/ivfwriter/ivfwriter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ func (i *IVFWriter) WriteRTP(packet *rtp.Packet) error {
159159
return err
160160
}
161161

162-
isKeyFrame := vp8Packet.Payload[0] & 0x01
162+
isKeyFrame := (vp8Packet.Payload[0] & 0x01) == 0
163163
switch {
164-
case !i.seenKeyFrame && isKeyFrame == 1:
164+
case !i.seenKeyFrame && !isKeyFrame:
165165
return nil
166166
case i.currentFrame == nil && vp8Packet.S != 1:
167167
return nil

0 commit comments

Comments
 (0)