Bug 1160689 - thumbnail image corruption on certain videos. r=sotaro
authorDiego Wilson <dwilson@quicinc.com>
Mon, 04 May 2015 15:14:34 -0700
changeset 273956 819c760b572fa8d2a00a3d50102a264232e35fb6
parent 273955 5b146d08b2c59b69bd7349b1a1e79355886b29a2
child 273957 5ae4aaad2fe960ad4cd97a00198e84c32b081cfb
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1160689
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1160689 - thumbnail image corruption on certain videos. r=sotaro
gfx/layers/GrallocImages.cpp
--- a/gfx/layers/GrallocImages.cpp
+++ b/gfx/layers/GrallocImages.cpp
@@ -293,16 +293,17 @@ ConvertOmxYUVFormatToRGB565(android::sp<
     return BAD_VALUE;
   }
 
   GraphicBufferAutoUnlock unlock(aBuffer);
 
   uint32_t format = aBuffer->getPixelFormat();
   uint32_t width = aSurface->GetSize().width;
   uint32_t height = aSurface->GetSize().height;
+  uint32_t stride = aBuffer->getStride();
 
   if (format == GrallocImage::HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO) {
     // The Adreno hardware decoder aligns image dimensions to a multiple of 32,
     // so we have to account for that here
     uint32_t alignedWidth = ALIGN(width, 32);
     uint32_t alignedHeight = ALIGN(height, 32);
     uint32_t uvOffset = ALIGN(alignedHeight * alignedWidth, 4096);
     uint32_t uvStride = 2 * ALIGN(width / 2, 32);
@@ -311,21 +312,21 @@ ConvertOmxYUVFormatToRGB565(android::sp<
                             buffer + uvOffset,
                             uvStride,
                             aMappedSurface->mData,
                             width, height);
     return OK;
   }
 
   if (format == HAL_PIXEL_FORMAT_YCrCb_420_SP) {
-    uint32_t uvOffset = height * width;
-    ConvertYVU420SPToRGB565(buffer, width,
+    uint32_t uvOffset = height * stride;
+    ConvertYVU420SPToRGB565(buffer, stride,
                             buffer + uvOffset + 1,
                             buffer + uvOffset,
-                            width,
+                            stride,
                             aMappedSurface->mData,
                             width, height);
     return OK;
   }
 
   if (format == HAL_PIXEL_FORMAT_YV12) {
     // Depend on platforms, it is possible for HW decoder to output YV12 format.
     // It means the mData won't be configured during the SetData API because the