Skip to content

Commit

Permalink
[ffmpeg] - backport fix for crashing when using vaapi (found on libav…
Browse files Browse the repository at this point in the history
… mailing list) - this was signed off by elupus
  • Loading branch information
Memphiz committed Jun 17, 2013
1 parent b746531 commit 2e8f569
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/ffmpeg/libavcodec/vaapi.c
Expand Up @@ -46,6 +46,9 @@ int ff_vaapi_render_picture(struct vaapi_context *vactx, VASurfaceID surface)
VABufferID va_buffers[3]; VABufferID va_buffers[3];
unsigned int n_va_buffers = 0; unsigned int n_va_buffers = 0;


if (!vactx->pic_param_buf_id)
return 0;

vaUnmapBuffer(vactx->display, vactx->pic_param_buf_id); vaUnmapBuffer(vactx->display, vactx->pic_param_buf_id);
va_buffers[n_va_buffers++] = vactx->pic_param_buf_id; va_buffers[n_va_buffers++] = vactx->pic_param_buf_id;


Expand Down
@@ -0,0 +1,22 @@
Subject: [libav-devel] [PATCH 1/2] vaapi: return early from ff_vaapi_render_picture() without picture
From: Janne Grunau janne-libav at jannau.net

Fixes an assertion when called on uninitialized frame. Spotted after
seeking in vlc. (backported from libav mailing list)

---

diff --git a/lib/ffmpeg/libavcodec/vaapi.c b/lib/ffmpeg/libavcodec/vaapi.c
index a220a9d..94959bf 100644
--- a/lib/ffmpeg/libavcodec/vaapi.c
+++ b/lib/ffmpeg/libavcodec/vaapi.c
@@ -46,6 +46,9 @@ int ff_vaapi_render_picture(struct vaapi_context *vactx, VASurfaceID surface)
VABufferID va_buffers[3];
unsigned int n_va_buffers = 0;

+ if (!vactx->pic_param_buf_id)
+ return 0;
+
vaUnmapBuffer(vactx->display, vactx->pic_param_buf_id);
va_buffers[n_va_buffers++] = vactx->pic_param_buf_id;

0 comments on commit 2e8f569

Please sign in to comment.