Bug 1592915 - Fix three warnings in `VideoFrameConverter.h` and `TestVideoTrackEncoder.h`. r=pehrsons
☠☠ backed out by 30c2808c70d1 ☠ ☠
authorPaul Adenot <paul@paul.cx>
Thu, 31 Oct 2019 10:50:51 +0000
changeset 499961 75ed11ced6252acd0119752477d50682be546a73
parent 499960 188e5fcabf098202592d97da5e8f9366c8df5c62
child 499962 e42641548cb74ff4283343a970da30ee4b2d2e55
push id36750
push usercsabou@mozilla.com
push dateThu, 31 Oct 2019 16:25:50 +0000
treeherdermozilla-central@9a2e7d38cb07 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspehrsons
bugs1592915
milestone72.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 1592915 - Fix three warnings in `VideoFrameConverter.h` and `TestVideoTrackEncoder.h`. r=pehrsons This warns because an expression with a side effect is inside a `static_assert` or `sizeof`. Differential Revision: https://phabricator.services.mozilla.com/D51243
dom/media/VideoFrameConverter.h
dom/media/gtest/TestVideoTrackEncoder.cpp
--- a/dom/media/VideoFrameConverter.h
+++ b/dom/media/VideoFrameConverter.h
@@ -355,17 +355,20 @@ class VideoFrameConverter {
         VideoFrameConverted(i420_frame);
         return;
       }
     }
 
     rtc::scoped_refptr<webrtc::I420Buffer> buffer =
         mBufferPool.CreateBuffer(aFrame.mSize.width, aFrame.mSize.height);
     if (!buffer) {
-      MOZ_DIAGNOSTIC_ASSERT(++mFramesDropped <= 100, "Buffers must be leaking");
+#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
+      ++mFramesDropped;
+#endif
+      MOZ_DIAGNOSTIC_ASSERT(mFramesDropped <= 100, "Buffers must be leaking");
       MOZ_LOG(gVideoFrameConverterLog, LogLevel::Warning,
               ("Creating a buffer failed"));
       return;
     }
 
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
     mFramesDropped = 0;
 #endif
--- a/dom/media/gtest/TestVideoTrackEncoder.cpp
+++ b/dom/media/gtest/TestVideoTrackEncoder.cpp
@@ -326,17 +326,18 @@ TEST(VP8VideoTrackEncoder, TimestampFram
   // Verify total duration being 0.3s and individual frames being [0.05s, 0.15s,
   // 0.1s]
   uint64_t expectedDurations[] = {(PR_USEC_PER_SEC / 10) / 2,
                                   (PR_USEC_PER_SEC / 10) * 3 / 2,
                                   (PR_USEC_PER_SEC / 10)};
   uint64_t totalDuration = 0;
   size_t i = 0;
   for (auto& frame : frames) {
-    EXPECT_EQ(expectedDurations[i++], frame->mDuration);
+    i++;
+    EXPECT_EQ(expectedDurations[i], frame->mDuration);
     totalDuration += frame->mDuration;
   }
   const uint64_t pointThree = (PR_USEC_PER_SEC / 10) * 3;
   EXPECT_EQ(pointThree, totalDuration);
 }
 
 // Test that we're compensating for drift when encoding.
 TEST(VP8VideoTrackEncoder, DriftingFrameEncode)
@@ -375,17 +376,18 @@ TEST(VP8VideoTrackEncoder, DriftingFrame
   // Verify total duration being 0.6s and individual frames being [0.1s, 0.3s,
   // 0.2s]
   uint64_t expectedDurations[] = {(PR_USEC_PER_SEC / 10),
                                   (PR_USEC_PER_SEC / 10) * 3,
                                   (PR_USEC_PER_SEC / 10) * 2};
   uint64_t totalDuration = 0;
   size_t i = 0;
   for (auto& frame : frames) {
-    EXPECT_EQ(expectedDurations[i++], frame->mDuration);
+    i++;
+    EXPECT_EQ(expectedDurations[i], frame->mDuration);
     totalDuration += frame->mDuration;
   }
   const uint64_t pointSix = (PR_USEC_PER_SEC / 10) * 6;
   EXPECT_EQ(pointSix, totalDuration);
 }
 
 // Test that suspending an encoding works.
 TEST(VP8VideoTrackEncoder, Suspended)