summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-07-12 15:46:40 +0000
committerMoonchild <moonchild@palemoon.org>2022-07-12 15:46:40 +0000
commit08c90e00b92c52216eb9a78f5d34fda72b92465e (patch)
tree19b89912902d4ce0a27f8bd9eb02e0107ba7b130
parent9ef50065928d5bfb3ff0ee80330615a1ebc4cc21 (diff)
parent61f1adc54dbf2a7720190887a28249804f52e924 (diff)
downloaduxp-08c90e00b92c52216eb9a78f5d34fda72b92465e.tar.gz
Merge remote-tracking branch 'athenian200/msvc2022-linker-fix'
-rw-r--r--dom/media/webrtc/MediaTrackConstraints.cpp10
-rw-r--r--dom/media/webrtc/MediaTrackConstraints.h52
2 files changed, 2 insertions, 60 deletions
diff --git a/dom/media/webrtc/MediaTrackConstraints.cpp b/dom/media/webrtc/MediaTrackConstraints.cpp
index 63dab1492f..ffa2e7e853 100644
--- a/dom/media/webrtc/MediaTrackConstraints.cpp
+++ b/dom/media/webrtc/MediaTrackConstraints.cpp
@@ -6,6 +6,7 @@
#include "MediaTrackConstraints.h"
#include "mozilla/dom/MediaStreamTrackBinding.h"
#include "mozilla/Unused.h"
+#include "mozilla/Types.h"
#include <limits>
#include <algorithm>
@@ -34,15 +35,9 @@ NormalizedConstraintSet::Range<ValueType>::SetFrom(const ConstrainRange& aOther)
}
}
-// FIXME(Issue #1956): 32-bit MSVC 2022 does not like these functions being
-// defined here. The 64-bit version accepts my workaround for the 32-bit
-// version as valid code, but every other compiler dislikes them being defined
-// elsewhere.
-
-#if _MSC_VER <= 1900 || !defined(_MSC_VER)
// The Range code works surprisingly well for bool, except when averaging ideals.
template<>
-bool
+bool MOZ_EXPORT
NormalizedConstraintSet::Range<bool>::Merge(const Range& aOther) {
if (!Intersects(aOther)) {
return false;
@@ -83,7 +78,6 @@ NormalizedConstraintSet::Range<bool>::FinalizeMerge()
mMergeDenominator = 0;
}
}
-#endif
NormalizedConstraintSet::LongRange::LongRange(
LongPtrType aMemberPtr,
diff --git a/dom/media/webrtc/MediaTrackConstraints.h b/dom/media/webrtc/MediaTrackConstraints.h
index 0746fc245f..842fea0d2d 100644
--- a/dom/media/webrtc/MediaTrackConstraints.h
+++ b/dom/media/webrtc/MediaTrackConstraints.h
@@ -261,60 +261,8 @@ public:
aOther.mMozAutoGainControl, advanced, aList) {}
};
-// FIXME (Issue #1956): 32-bit MSVC 2022 needed this code to be moved here,
-// and the 64-bit version seems fine with it as well. But other compilers
-// are not.
-
-#if _MSC_VER > 1900
-// The Range code works surprisingly well for bool, except when averaging ideals.
-template<>
-bool
-NormalizedConstraintSet::Range<bool>::Merge(const Range& aOther) {
- if (!Intersects(aOther)) {
- return false;
- }
- Intersect(aOther);
-
- // To avoid "unsafe use of type 'bool'", we keep counter in mMergeDenominator
- uint32_t counter = mMergeDenominator >> 16;
- uint32_t denominator = mMergeDenominator & 0xffff;
-
- if (aOther.mIdeal.isSome()) {
- if (mIdeal.isNothing()) {
- mIdeal.emplace(aOther.Get(false));
- counter = aOther.Get(false);
- denominator = 1;
- } else {
- if (!denominator) {
- counter = Get(false);
- denominator = 1;
- }
- counter += aOther.Get(false);
- denominator++;
- }
- }
- mMergeDenominator = ((counter & 0xffff) << 16) + (denominator & 0xffff);
- return true;
-}
-
-template<>
-void
-NormalizedConstraintSet::Range<bool>::FinalizeMerge()
-{
- if (mMergeDenominator) {
- uint32_t counter = mMergeDenominator >> 16;
- uint32_t denominator = mMergeDenominator & 0xffff;
-
- *mIdeal = !!(counter / denominator);
- mMergeDenominator = 0;
- }
-}
-#endif
-
-#if _MSC_VER <= 1900 || !defined(_MSC_VER)
template<> bool NormalizedConstraintSet::Range<bool>::Merge(const Range& aOther);
template<> void NormalizedConstraintSet::Range<bool>::FinalizeMerge();
-#endif
// Used instead of MediaTrackConstraints in lower-level code.
struct NormalizedConstraints : public NormalizedConstraintSet