ref: a005abe2701b878770544e2e09f41ab9e2a399e7
parent: 709cb723bba3aa43ba40a5c70dba0b337bae54e2
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Tue Dec 15 17:30:13 EST 2020
ivfclose: be safer, set stuff to nil to support repeated calls
--- a/decoder_h264.c
+++ b/decoder_h264.c
@@ -164,15 +164,15 @@
Streamframe sf;
Aux *a;
int res, w, h, *stride;
- uvlong start;
+ uvlong start, framenum;
d = x;
a = d->aux;
lasttimestamp = 0;
start = nanosec();
- for(res = 0; res >= 0 && (res = Sread(d->s, &sf)) == 0 && sf.sz > 0;){
+ for(res = 0, framenum = 0; res >= 0 && (res = Sread(d->s, &sf)) == 0 && sf.sz > 0; framenum++){
if((res = WelsDecodeBs(&a->ctx, sf.buf, sf.sz, a->data, &a->info, nil)) != 0){
- werrstr("WelsDecodeBs: error %#x", res);
+ werrstr("frame %llud: decoder error %#x", framenum, res);
break;
}
if(a->info.iBufferStatus == 0)
--- a/stream_ivf.c
+++ b/stream_ivf.c
@@ -172,8 +172,12 @@
static void
ivfclose(Stream *s)
{
- Bterm(s->b);
+ if(s->b != nil){
+ Bterm(s->b);
+ s->b = nil;
+ }
free(s->buf);
+ s->buf = nil;
}
Streamops ivfops = {