Bug 1460367 - move audio sample-related settings to moz.configure; r=ted.mielczarek,nalexander
authorNathan Froyd <froydnj@mozilla.com>
Wed, 09 May 2018 17:26:31 -0400
changeset 471896 758cb28b70144afa10405624044bec305f101dc2
parent 471895 ed0bdeaa6fd4284bf48d9b055148ec0fe308cfcc
child 471897 2dd51c7e5789d45631e1e56b59ee02ac81e55b35
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1460367
milestone62.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 1460367 - move audio sample-related settings to moz.configure; r=ted.mielczarek,nalexander With moz.configure, it's a little more obvious that MOZ_TREMOR and MOZ_VORBIS are mutually exclusive.
old-configure.in
toolkit/moz.configure
--- a/old-configure.in
+++ b/old-configure.in
@@ -1898,20 +1898,16 @@ ENABLE_SYSTEM_EXTENSION_DIRS=1
 MOZ_BRANDING_DIRECTORY=
 MOZ_OFFICIAL_BRANDING=
 MOZ_FEEDS=1
 MOZ_AUTH_EXTENSION=1
 if test "$MOZ_IOS"; then
    MOZ_AUTH_EXTENSION=
 fi
 MOZ_RAW=
-MOZ_VORBIS=
-MOZ_TREMOR=
-MOZ_SAMPLE_TYPE_FLOAT32=
-MOZ_SAMPLE_TYPE_S16=
 MOZ_SRTP=
 MOZ_WEBRTC_HARDWARE_AEC_NS=
 MOZ_SCTP=
 VPX_USE_YASM=
 VPX_ASFLAGS=
 VPX_AS_CONVERSION=
 VPX_X86_ASM=
 VPX_ARM_ASM=
@@ -2372,30 +2368,16 @@ if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"
     AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
 fi
 
 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
 AC_SUBST(MOZ_SCTP)
 AC_SUBST(MOZ_SRTP)
 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
 
-dnl Use integers over floats for audio on B2G and Android
-dnl (regarless of the CPU architecture, because audio
-dnl backends for those platforms don't support floats. We also
-dnl use integers on ARM with other OS, because it's more efficient.
-if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
-    MOZ_SAMPLE_TYPE_S16=1
-    AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
-    AC_SUBST(MOZ_SAMPLE_TYPE_S16)
-else
-    MOZ_SAMPLE_TYPE_FLOAT32=1
-    AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
-    AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
-fi
-
 dnl ========================================================
 dnl = Enable Raw Codecs
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(raw,
 [  --enable-raw           Enable support for RAW media],
     MOZ_RAW=1,
     MOZ_RAW=)
 
@@ -2455,22 +2437,16 @@ if test -n "$MOZ_SYSTEM_LIBVPX"; then
 fi
 CFLAGS=$_SAVE_CFLAGS
 LIBS=$_SAVE_LIBS
 
 AC_SUBST(MOZ_SYSTEM_LIBVPX)
 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
 
-if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
-    MOZ_VORBIS=1
-else
-    MOZ_TREMOR=1
-fi
-
 if test -z "$MOZ_SYSTEM_LIBVPX"; then
 
     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
     dnl We currently require gcc on all arm platforms.
 
     dnl See if we have assembly on this platform.
     case "$OS_ARCH:$CPU_ARCH" in
@@ -2557,28 +2533,16 @@ if test -z "$MOZ_SYSTEM_LIBVPX"; then
     dnl native libvpx no longer has vpx_mem_set_functions
     AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
 fi
 
 dnl ========================================================
 dnl = Handle dependent MEDIA defines
 dnl ========================================================
 
-if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
-    AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive!  The build system should not allow them both to be set, but they are.  Please file a bug at https://bugzilla.mozilla.org/])
-fi
-
-if test -n "$MOZ_VORBIS"; then
-    AC_DEFINE(MOZ_VORBIS)
-fi
-
-if test -n "$MOZ_TREMOR"; then
-    AC_DEFINE(MOZ_TREMOR)
-fi
-
 MOZ_WEBM_ENCODER=1
 AC_DEFINE(MOZ_WEBM_ENCODER)
 AC_SUBST(MOZ_WEBM_ENCODER)
 
 dnl ========================================================
 dnl NegotiateAuth
 dnl ========================================================
 
@@ -4496,18 +4460,16 @@ AC_SUBST_LIST(DSO_PIC_CFLAGS)
 AC_SUBST(DSO_LDOPTS)
 AC_SUBST(BIN_SUFFIX)
 AC_SUBST(USE_N32)
 AC_SUBST(CC_VERSION)
 AC_SUBST(NS_ENABLE_TSF)
 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
 
-AC_SUBST(MOZ_VORBIS)
-AC_SUBST(MOZ_TREMOR)
 AC_SUBST(MOZ_FFVPX)
 AC_SUBST(MOZ_FFVPX_FLACONLY)
 AC_SUBST_LIST(FFVPX_ASFLAGS)
 AC_SUBST(VPX_USE_YASM)
 AC_SUBST_LIST(VPX_ASFLAGS)
 AC_SUBST(VPX_AS_CONVERSION)
 AC_SUBST(VPX_X86_ASM)
 AC_SUBST(VPX_ARM_ASM)
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -414,16 +414,39 @@ def fmp4(value, target, wmf, applemedia)
         enabled = wmf or applemedia or target.os == 'Android'
     if enabled:
         return True
 
 set_config('MOZ_FMP4', fmp4)
 set_define('MOZ_FMP4', fmp4)
 add_old_configure_assignment('MOZ_FMP4', fmp4)
 
+@depends(target)
+def sample_type_is_s16(target):
+    # Use integers over floats for audio on Android regardless of the CPU
+    # architecture, because audio backends for Android don't support floats.
+    # We also use integers on ARM because it's more efficient.
+    if target.os == 'Android' or target.cpu == 'arm':
+        return True
+
+@depends(sample_type_is_s16)
+def sample_type_is_float(t):
+    if not t:
+        return True
+
+set_config('MOZ_SAMPLE_TYPE_S16', sample_type_is_s16)
+set_define('MOZ_SAMPLE_TYPE_S16', sample_type_is_s16)
+set_config('MOZ_SAMPLE_TYPE_FLOAT32', sample_type_is_float)
+set_define('MOZ_SAMPLE_TYPE_FLOAT32', sample_type_is_float)
+
+set_define('MOZ_VORBIS', sample_type_is_float)
+set_config('MOZ_VORBIS', sample_type_is_float)
+set_define('MOZ_TREMOR', sample_type_is_s16)
+set_config('MOZ_TREMOR', sample_type_is_s16)
+
 # OpenMAX IL Decoding Support
 # ==============================================================
 option('--enable-openmax',
        help='Enable OpenMAX IL for video/audio decoding')
 
 @depends('--enable-openmax')
 def openmax(value):
     enabled = bool(value)