Bug 1332585 - Make VP8TrackEncoderTest's buffer generator more explicit. r=jesup
authorAndreas Pehrson <pehrsons@gmail.com>
Fri, 20 Jan 2017 11:48:59 +0100
changeset 377777 76f2c83d048c379d19dbb2170db9f9f200df0804
parent 377776 3be7e027a50bb9380e95b3726e8902ca08fcc3de
child 377778 60d77d6c0becd0eb74d6474e70782e4e92d61501
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1332585
milestone53.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 1332585 - Make VP8TrackEncoderTest's buffer generator more explicit. r=jesup MozReview-Commit-ID: DZbF6vRMug6
dom/media/gtest/TestVideoTrackEncoder.cpp
--- a/dom/media/gtest/TestVideoTrackEncoder.cpp
+++ b/dom/media/gtest/TestVideoTrackEncoder.cpp
@@ -41,21 +41,29 @@ public:
     memset(mSourceBuffer.Elements() + yPlaneLen, 0x80, cbcrPlaneLen);
   }
 
   mozilla::gfx::IntSize GetSize() const
   {
     return mImageSize;
   }
 
-  void Generate(nsTArray<RefPtr<Image> > &aImages)
+  already_AddRefed<Image> GenerateI420Image()
+  {
+    return do_AddRef(CreateI420Image());
+  }
+
+  already_AddRefed<Image> GenerateNV12Image()
   {
-    aImages.AppendElement(CreateI420Image());
-    aImages.AppendElement(CreateNV12Image());
-    aImages.AppendElement(CreateNV21Image());
+    return do_AddRef(CreateNV12Image());
+  }
+
+  already_AddRefed<Image> GenerateNV21Image()
+  {
+    return do_AddRef(CreateNV21Image());
   }
 
 private:
   Image *CreateI420Image()
   {
     PlanarYCbCrImage *image = new RecyclingPlanarYCbCrImage(new BufferRecycleBin());
     PlanarYCbCrData data;
     data.mPicSize = mImageSize;
@@ -255,17 +263,19 @@ TEST(VP8VideoTrackEncoder, FrameEncode)
   TestVP8TrackEncoder encoder;
   InitParam param = {true, 640, 480};
   encoder.TestInit(param);
 
   // Create YUV images as source.
   nsTArray<RefPtr<Image>> images;
   YUVBufferGenerator generator;
   generator.Init(mozilla::gfx::IntSize(640, 480));
-  generator.Generate(images);
+  images.AppendElement(generator.GenerateI420Image());
+  images.AppendElement(generator.GenerateNV12Image());
+  images.AppendElement(generator.GenerateNV21Image());
 
   // Put generated YUV frame into video segment.
   // Duration of each frame is 1 second.
   VideoSegment segment;
   TimeStamp now = TimeStamp::Now();
   for (nsTArray<RefPtr<Image>>::size_type i = 0; i < images.Length(); i++)
   {
     RefPtr<Image> image = images[i];