diff options
author | Alfred E. Heggestad <aeh@db.org> | 2015-03-21 18:31:52 +0100 |
---|---|---|
committer | Alfred E. Heggestad <aeh@db.org> | 2015-03-21 18:31:52 +0100 |
commit | a0a35ec8f22e612f9aec133b23ececaf8b056a16 (patch) | |
tree | b9db37d40e1daa7bb2a16c941619d57be79da216 | |
parent | d24e5bff254efd7a9f1dbc8d5bf82ed8fd2a52d8 (diff) |
vidloop: detect error in vidisp_display()
-rw-r--r-- | modules/vidloop/vidloop.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/modules/vidloop/vidloop.c b/modules/vidloop/vidloop.c index 835007d..aa5f7f9 100644 --- a/modules/vidloop/vidloop.c +++ b/modules/vidloop/vidloop.c @@ -42,6 +42,7 @@ struct video_loop { struct tmr tmr_bw; uint16_t seq; bool need_conv; + int err; }; @@ -65,8 +66,17 @@ static int display(struct video_loop *vl, struct vidframe *frame) err |= st->vf->dech(st, frame); } + if (err) { + warning("vidloop: error in video-filters (%m)\n", err); + } + /* display frame */ - (void)vidisp_display(vl->vidisp, "Video Loop", frame); + err = vidisp_display(vl->vidisp, "Video Loop", frame); + if (err == ENODEV) { + info("vidloop: video-display was closed\n"); + vl->vidisp = mem_deref(vl->vidisp); + vl->err = err; + } return err; } @@ -265,7 +275,13 @@ static void timeout_bw(void *arg) { struct video_loop *vl = arg; - tmr_start(&vl->tmr_bw, 5000, timeout_bw, vl); + if (vl->err) { + info("error in video-loop -- closing (%m)\n", vl->err); + gvl = mem_deref(gvl); + return; + } + + tmr_start(&vl->tmr_bw, 2000, timeout_bw, vl); calc_bitrate(vl); print_status(vl); |