Build failure with GCC 12: MediaTime.h:167:71: error: call to non-'constexpr' function 'WTF::MediaTime& WTF::MediaTime::operator=(const WTF::MediaTime&)'
https://bugs.webkit.org/show_bug.cgi?id=235610

Patch by Michael Catanzaro <mcatanzaro@gnome.org> on 2022-01-26
Reviewed by Darin Adler.

The problem is the constexpr constructor calls the non-constexpr copy assignment operator.
This is easy to fix, at the expense of readability, by open-coding the desired values here.

* wtf/MediaTime.h:
(WTF::MediaTime::MediaTime):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@288660 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog
index 356f420..2b5ff387 100644
--- a/Source/WTF/ChangeLog
+++ b/Source/WTF/ChangeLog
@@ -1,3 +1,16 @@
+2022-01-26  Michael Catanzaro  <mcatanzaro@gnome.org>
+
+        Build failure with GCC 12: MediaTime.h:167:71: error: call to non-'constexpr' function 'WTF::MediaTime& WTF::MediaTime::operator=(const WTF::MediaTime&)'
+        https://bugs.webkit.org/show_bug.cgi?id=235610
+
+        Reviewed by Darin Adler.
+
+        The problem is the constexpr constructor calls the non-constexpr copy assignment operator.
+        This is easy to fix, at the expense of readability, by open-coding the desired values here.
+
+        * wtf/MediaTime.h:
+        (WTF::MediaTime::MediaTime):
+
 2022-01-25  Eric Carlson  <eric.carlson@apple.com>
 
         [macOS] Add new screen and window capture backend
diff --git a/Source/WTF/wtf/MediaTime.h b/Source/WTF/wtf/MediaTime.h
index 71acf32..b010bd0 100644
--- a/Source/WTF/wtf/MediaTime.h
+++ b/Source/WTF/wtf/MediaTime.h
@@ -164,7 +164,17 @@
     if (scale || !(flags & Valid))
         return;
 
-    *this = value < 0 ? negativeInfiniteTime() : positiveInfiniteTime();
+    if (value < 0) {
+        // Negative infinite time
+        m_timeValue = -1;
+        m_timeScale = 1;
+        m_timeFlags = NegativeInfinite | Valid;
+    } else {
+        // Positive infinite time
+        m_timeValue = 0;
+        m_timeScale = 1;
+        m_timeFlags = PositiveInfinite | Valid;
+    }
 }
 
 inline MediaTime operator*(int32_t lhs, const MediaTime& rhs) { return rhs.operator*(lhs); }