Proper dav1d decoding and flushing

This commit is contained in:
DataHoarder 2022-11-11 10:55:56 +01:00
parent ace16a6b6a
commit 86a790167d
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk

View file

@ -94,16 +94,13 @@ func (d *Decoder) Properties() frame.StreamProperties {
func (d *Decoder) decodeFrame() C.int {
var res C.int
if res = C.dav1d_send_data(d.ctx, &d.data); res < 0 {
if res != -ErrEAGAIN {
return res
}
}
if res = d.flushPicture(); res < 0 {
if res != -ErrEAGAIN {
return res
}
} else {
return res
}
if d.data.sz == 0 {
@ -115,6 +112,19 @@ func (d *Decoder) decodeFrame() C.int {
}
}
res = -1
return res
}
}
if res = C.dav1d_send_data(d.ctx, &d.data); res < 0 {
if res != -ErrEAGAIN {
return res
}
}
if res = d.flushPicture(); res < 0 {
if res != -ErrEAGAIN {
return res
}
}
return res