Index: content/common/gpu/media/vaapi_wrapper.cc |
diff --git a/content/common/gpu/media/vaapi_wrapper.cc b/content/common/gpu/media/vaapi_wrapper.cc |
index 2b4b33349aa12a3d77ed7680c06f18ad6e1bd775..b66f5344adf52d7f938f9d5341034548e25e8a56 100644 |
--- a/content/common/gpu/media/vaapi_wrapper.cc |
+++ b/content/common/gpu/media/vaapi_wrapper.cc |
@@ -69,6 +69,7 @@ static const ProfileMap kProfileMap[] = { |
// TODO(posciak): See if we can/want support other variants of |
// media::H264PROFILE_HIGH*. |
{media::H264PROFILE_HIGH, VAProfileH264High}, |
+ {media::MJPEGPROFILE, VAProfileJPEGBaseline}, |
}; |
static std::vector<VAConfigAttrib> GetRequiredAttribs( |
@@ -619,6 +620,40 @@ bool VaapiWrapper::GetVaImageForTesting(VASurfaceID va_surface_id, |
return false; |
} |
+bool VaapiWrapper::GetVaImageWithFormat(VASurfaceID va_surface_id, |
wuchengli
2015/01/12 09:08:53
Is CreateVaImage better? This actually passes form
kcwu
2015/01/16 15:12:56
Done.
In order to emphasis its difference to GetVa
|
+ VAImageFormat* format, |
+ gfx::Size size, |
+ VAImage* image, |
+ void** mem) { |
+ base::AutoLock auto_lock(va_lock_); |
+ |
+ VAStatus va_res = vaSyncSurface(va_display_, va_surface_id); |
+ VA_SUCCESS_OR_RETURN(va_res, "Failed syncing surface", false); |
+ |
+ va_res = |
+ vaCreateImage(va_display_, format, size.width(), size.height(), image); |
+ VA_LOG_ON_ERROR(va_res, "vaCreateImage failed"); |
wuchengli
2015/01/12 09:08:53
VA_SUCCESS_OR_RETURN
kcwu
2015/01/16 15:12:56
Done.
|
+ if (va_res != VA_STATUS_SUCCESS) |
+ return false; |
+ |
+ va_res = vaGetImage(va_display_, va_surface_id, 0, 0, size.width(), |
+ size.height(), image->image_id); |
+ VA_LOG_ON_ERROR(va_res, "vaDeriveImage failed"); |
wuchengli
2015/01/12 09:08:53
s/vaDeriveImage/vaGetImage/ and VA_SUCCESS_OR_RETU
kcwu
2015/01/16 15:12:56
Done.
|
+ if (va_res != VA_STATUS_SUCCESS) |
Owen Lin
2015/01/13 06:17:59
free the resource of image (since it has been crea
kcwu
2015/01/16 15:12:56
Done.
|
+ return false; |
+ |
+ // Map the VAImage into memory |
+ va_res = vaMapBuffer(va_display_, image->buf, mem); |
+ VA_LOG_ON_ERROR(va_res, "vaMapBuffer failed"); |
+ if (va_res == VA_STATUS_SUCCESS) |
+ return true; |
+ |
+ va_res = vaDestroyImage(va_display_, image->image_id); |
+ VA_LOG_ON_ERROR(va_res, "vaDestroyImage failed"); |
+ |
+ return false; |
wuchengli
2015/01/12 09:08:53
It's easier to understand to return true at the en
Owen Lin
2015/01/13 06:17:59
+1
kcwu
2015/01/16 15:12:56
Since I need to call vaDestroyImage for failed cas
|
+} |
+ |
void VaapiWrapper::ReturnVaImageForTesting(VAImage* image) { |
base::AutoLock auto_lock(va_lock_); |