When calling gst_video_frame_map() with GST_MAP_WRITE flag, it doesn't call
ensure_image_is_current(), which means it doesn't guarentee VAImage is valid
in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=766978
if (!ensure_image (mem))
goto error_ensure_image;
- // Load VA image from surface
- if ((flags & GST_MAP_READ) && !ensure_image_is_current (mem))
+ /* Load VA image from surface only on read OR write, not both.
+ * Refer to bugs #704078 and #704083 */
+ if (((flags & GST_MAP_READWRITE) != GST_MAP_READWRITE)
+ && !ensure_image_is_current (mem))
goto error_no_current_image;
if (!gst_vaapi_image_map (mem->image))