Bug 1538113 - Fix static-analysis warning in dom/media/VideoFrameConverter.h. r=dminor
authorAndreas Pehrson <apehrson@mozilla.com>
Mon, 25 Mar 2019 14:25:11 +0000
changeset 465987 ad6e8a453d67fb690c8ad9aa4737e9440f7c9302
parent 465986 d56e561be43f7494a3f5362a427589947b4345f2
child 465988 b1d3a147fdc9e03786e64cc69122cbe253125be3
push id35758
push userrgurzau@mozilla.com
push dateTue, 26 Mar 2019 09:51:47 +0000
treeherdermozilla-central@4572f6055a6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdminor
bugs1538113, 142010
milestone68.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 1538113 - Fix static-analysis warning in dom/media/VideoFrameConverter.h. r=dminor Initially indicated by: https://phabricator.services.mozilla.com/D24233#inline-142010 Differential Revision: https://phabricator.services.mozilla.com/D24512
dom/media/VideoFrameConverter.h
--- a/dom/media/VideoFrameConverter.h
+++ b/dom/media/VideoFrameConverter.h
@@ -36,17 +36,17 @@ static mozilla::LazyLogModule gVideoFram
 
 class VideoConverterListener {
  public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VideoConverterListener)
 
   virtual void OnVideoFrameConverted(const webrtc::VideoFrame& aVideoFrame) = 0;
 
  protected:
-  virtual ~VideoConverterListener() {}
+  virtual ~VideoConverterListener() = default;
 };
 
 // An async video frame format converter.
 //
 // Input is typically a MediaStreamTrackListener driven by MediaStreamGraph.
 //
 // Output is passed through to all added VideoConverterListeners on a TaskQueue
 // thread whenever a frame is converted.
@@ -64,17 +64,17 @@ class VideoFrameConverter {
         mBufferPool(false, CONVERTER_BUFFER_POOL_SIZE),
         mLastFrameQueuedForProcessing(TimeStamp::Now()),
         mEnabled(true) {
     MOZ_COUNT_CTOR(VideoFrameConverter);
   }
 
   void QueueVideoChunk(const VideoChunk& aChunk, bool aForceBlack) {
     gfx::IntSize size = aChunk.mFrame.GetIntrinsicSize();
-    if (size.width == 0 || size.width == 0) {
+    if (size.width == 0 || size.height == 0) {
       return;
     }
 
     TimeStamp t = aChunk.mTimeStamp;
     MOZ_ASSERT(!t.IsNull());
 
     if (!mLastFrameQueuedForPacing.IsNull() && t < mLastFrameQueuedForPacing) {
       // With a direct listener we can have buffered up future frames in
@@ -90,18 +90,18 @@ class VideoFrameConverter {
       mPacingTimer->Cancel();
     }
 
     mLastFrameQueuedForPacing = t;
 
     mPacingTimer->WaitUntil(t, __func__)
         ->Then(mTaskQueue, __func__,
                [self = RefPtr<VideoFrameConverter>(this), this,
-                image = RefPtr<layers::Image>(aChunk.mFrame.GetImage()),
-                t = std::move(t), size = std::move(size), aForceBlack] {
+                image = RefPtr<layers::Image>(aChunk.mFrame.GetImage()), t,
+                size, aForceBlack]() mutable {
                  QueueForProcessing(std::move(image), t, size, aForceBlack);
                },
                [] {});
   }
 
   void SetTrackEnabled(bool aEnabled) {
     nsresult rv = mTaskQueue->Dispatch(NS_NewRunnableFunction(
         __func__, [self = RefPtr<VideoFrameConverter>(this), this, aEnabled] {
@@ -224,26 +224,26 @@ class VideoFrameConverter {
                (mLastFrameQueuedForProcessing - aTime).ToSeconds()));
       return;
     }
 
     mLastImage = serial;
     mLastFrameQueuedForProcessing = aTime;
 
     nsresult rv = mTaskQueue->Dispatch(
-        NewRunnableMethod<StoreCopyPassByRRef<RefPtr<layers::Image>>, TimeStamp,
+        NewRunnableMethod<StoreCopyPassByLRef<RefPtr<layers::Image>>, TimeStamp,
                           gfx::IntSize, bool>(
             "VideoFrameConverter::ProcessVideoFrame", this,
             &VideoFrameConverter::ProcessVideoFrame, std::move(aImage), aTime,
             aSize, aForceBlack || !mEnabled));
     MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
     Unused << rv;
   }
 
-  void ProcessVideoFrame(RefPtr<layers::Image> aImage, TimeStamp aTime,
+  void ProcessVideoFrame(const RefPtr<layers::Image>& aImage, TimeStamp aTime,
                          gfx::IntSize aSize, bool aForceBlack) {
     MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
 
     if (aTime < mLastFrameQueuedForProcessing) {
       MOZ_LOG(gVideoFrameConverterLog, LogLevel::Debug,
               ("Dropping a frame that is %.3f seconds behind latest",
                (mLastFrameQueuedForProcessing - aTime).ToSeconds()));
       return;