From f321d6becd90057998d9b640b61b208fc62fe865 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Thu, 31 Oct 2019 12:12:19 +0000 Subject: [PATCH] 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 --HG-- extra : moz-landing-system : lando --- dom/media/VideoFrameConverter.h | 5 ++++- dom/media/gtest/TestVideoTrackEncoder.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dom/media/VideoFrameConverter.h b/dom/media/VideoFrameConverter.h index 858638ee8430..b1ca14d9c838 100644 --- a/dom/media/VideoFrameConverter.h +++ b/dom/media/VideoFrameConverter.h @@ -360,7 +360,10 @@ class VideoFrameConverter { rtc::scoped_refptr 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; diff --git a/dom/media/gtest/TestVideoTrackEncoder.cpp b/dom/media/gtest/TestVideoTrackEncoder.cpp index dac50e63c524..f6440117699e 100644 --- a/dom/media/gtest/TestVideoTrackEncoder.cpp +++ b/dom/media/gtest/TestVideoTrackEncoder.cpp @@ -331,7 +331,8 @@ TEST(VP8VideoTrackEncoder, TimestampFrameEncode) uint64_t totalDuration = 0; size_t i = 0; for (auto& frame : frames) { - EXPECT_EQ(expectedDurations[i++], frame->mDuration); + EXPECT_EQ(expectedDurations[i], frame->mDuration); + i++; totalDuration += frame->mDuration; } const uint64_t pointThree = (PR_USEC_PER_SEC / 10) * 3; @@ -380,7 +381,8 @@ TEST(VP8VideoTrackEncoder, DriftingFrameEncode) uint64_t totalDuration = 0; size_t i = 0; for (auto& frame : frames) { - EXPECT_EQ(expectedDurations[i++], frame->mDuration); + EXPECT_EQ(expectedDurations[i], frame->mDuration); + i++; totalDuration += frame->mDuration; } const uint64_t pointSix = (PR_USEC_PER_SEC / 10) * 6;