Skip to content

Commit

Permalink
Skip nil frames in decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
djthorpe committed Jul 29, 2024
1 parent 4254090 commit 4fc00ce
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/ffmpeg/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,17 @@ func (d *Decoder) decode(packet *ff.AVPacket, fn DecoderFrameFn) error {
dest = (*Frame)(d.frame)
}

// If we have a nil frame here, then don't pass back to the caller
if dest == nil {
ff.AVUtil_frame_unref(d.frame)
continue
}

// Copy across the timebase and pts
// TODO if dest != nil {
// TODO
// fmt.Println("pts=", d.frame.Pts())
// (*ff.AVFrame)(dest).SetPts(d.frame.Pts())
// (*ff.AVFrame)(dest).SetTimeBase(d.timeBase)
//}
// (*ff.AVFrame)(dest).SetPts(d.frame.Pts())
// (*ff.AVFrame)(dest).SetTimeBase(d.timeBase)

// Pass back to the caller
if err := fn(d.stream, dest); errors.Is(err, io.EOF) {
Expand Down

0 comments on commit 4fc00ce

Please sign in to comment.