diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-04-30 22:59:56 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-04-30 23:00:10 +0300 |
commit | dc83733f2bf2f26433bbf23d42fe92a2c7691df1 (patch) | |
tree | 32ae277156403cec7c44e3f958c12f31420ef1b6 /libavdevice/xcbgrab.c | |
parent | e2784a1d96608d5aa661483de9d8e80311deb80e (diff) | |
parent | 82a10225f817b2612fdd2b23af9d4f0a3408df3b (diff) |
Merge commit '82a10225f817b2612fdd2b23af9d4f0a3408df3b'
* commit '82a10225f817b2612fdd2b23af9d4f0a3408df3b':
xcbgrab: Do not assume the non shm image data is always available
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice/xcbgrab.c')
-rw-r--r-- | libavdevice/xcbgrab.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c index 777bd255fb..2878995412 100644 --- a/libavdevice/xcbgrab.c +++ b/libavdevice/xcbgrab.c @@ -150,13 +150,25 @@ static int xcbgrab_frame(AVFormatContext *s, AVPacket *pkt) xcb_get_image_cookie_t iq; xcb_get_image_reply_t *img; xcb_drawable_t drawable = c->screen->root; + xcb_generic_error_t *e = NULL; uint8_t *data; int length, ret; iq = xcb_get_image(c->conn, XCB_IMAGE_FORMAT_Z_PIXMAP, drawable, c->x, c->y, c->width, c->height, ~0); - img = xcb_get_image_reply(c->conn, iq, NULL); + img = xcb_get_image_reply(c->conn, iq, &e); + + if (e) { + av_log(s, AV_LOG_ERROR, + "Cannot get the image data " + "event_error: response_type:%u error_code:%u " + "sequence:%u resource_id:%u minor_code:%u major_code:%u.\n", + e->response_type, e->error_code, + e->sequence, e->resource_id, e->minor_code, e->major_code); + return AVERROR(EACCES); + } + if (!img) return AVERROR(EAGAIN); @@ -410,7 +422,7 @@ static int xcbgrab_read_packet(AVFormatContext *s, AVPacket *pkt) ret = xcbgrab_frame(s, pkt); #if CONFIG_LIBXCB_XFIXES - if (c->draw_mouse && p->same_screen) + if (ret >= 0 && c->draw_mouse && p->same_screen) xcbgrab_draw_mouse(s, pkt, p, geo); #endif |