Bug 1382718 - Update video encoder gtest to use appropriate image objects. r?jesup draft
authorBryce Van Dyk <bvandyk@mozilla.com>
Tue, 25 Jul 2017 10:04:57 +1200
changeset 615009 65270d5c6daf79dc77e2c6b84feb8124d382e08e
parent 615008 e926e663cab063a9aca6121678ffb683ed0a846f
child 639044 892e9ddb49bb3a885e7c81d8f57552375c743dc0
push id70207
push userbvandyk@mozilla.com
push dateTue, 25 Jul 2017 09:03:30 +0000
reviewersjesup
bugs1382718
milestone56.0a1
Bug 1382718 - Update video encoder gtest to use appropriate image objects. r?jesup The image objects used in the TestVideoTrackEncoder.cpp for NV12 and NV21 were not suitable for storage of these formats. As such the new format detection code introduced in previous changesets was not correctly be exercised. MozReview-Commit-ID: 9Tn7Ub4GfeG
dom/media/gtest/TestVideoTrackEncoder.cpp
--- a/dom/media/gtest/TestVideoTrackEncoder.cpp
+++ b/dom/media/gtest/TestVideoTrackEncoder.cpp
@@ -98,17 +98,17 @@ private:
     data.mCbCrSize.height = halfHeight;
 
     image->CopyData(data);
     return image;
   }
 
   Image *CreateNV12Image()
   {
-    PlanarYCbCrImage *image = new RecyclingPlanarYCbCrImage(new BufferRecycleBin());
+    NVImage* image = new NVImage();
     PlanarYCbCrData data;
     data.mPicSize = mImageSize;
 
     const uint32_t yPlaneSize = mImageSize.width * mImageSize.height;
     const uint32_t halfWidth = (mImageSize.width + 1) / 2;
     const uint32_t halfHeight = (mImageSize.height + 1) / 2;
 
     // Y plane.
@@ -129,23 +129,23 @@ private:
     data.mCbChannel = cb;
     data.mCbSkip = 1;
 
     // 4:2:0.
     data.mCbCrStride = mImageSize.width;
     data.mCbCrSize.width = halfWidth;
     data.mCbCrSize.height = halfHeight;
 
-    image->CopyData(data);
+    image->SetData(data);
     return image;
   }
 
   Image *CreateNV21Image()
   {
-    PlanarYCbCrImage *image = new RecyclingPlanarYCbCrImage(new BufferRecycleBin());
+    NVImage* image = new NVImage();
     PlanarYCbCrData data;
     data.mPicSize = mImageSize;
 
     const uint32_t yPlaneSize = mImageSize.width * mImageSize.height;
     const uint32_t halfWidth = (mImageSize.width + 1) / 2;
     const uint32_t halfHeight = (mImageSize.height + 1) / 2;
 
     // Y plane.
@@ -166,17 +166,17 @@ private:
     data.mCbChannel = cb;
     data.mCbSkip = 1;
 
     // 4:2:0.
     data.mCbCrStride = mImageSize.width;
     data.mCbCrSize.width = halfWidth;
     data.mCbCrSize.height = halfHeight;
 
-    image->CopyData(data);
+    image->SetData(data);
     return image;
   }
 
 private:
   mozilla::gfx::IntSize mImageSize;
   nsTArray<uint8_t> mSourceBuffer;
 };