Skip to content

Commit

Permalink
Rewrite VP8 isKeyFrame check (#2999)
Browse files Browse the repository at this point in the history
#### 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 #...
  • Loading branch information
xdrudis authored Jan 12, 2025
1 parent 5edce95 commit cdacd1c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/media/ivfwriter/ivfwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ func (i *IVFWriter) WriteRTP(packet *rtp.Packet) error {
return err
}

isKeyFrame := vp8Packet.Payload[0] & 0x01
isKeyFrame := (vp8Packet.Payload[0] & 0x01) == 0
switch {
case !i.seenKeyFrame && isKeyFrame == 1:
case !i.seenKeyFrame && !isKeyFrame:
return nil
case i.currentFrame == nil && vp8Packet.S != 1:
return nil
Expand Down

0 comments on commit cdacd1c

Please sign in to comment.