Bug 1264208 - Enable libav assertions. r=jya
authorChris Peterson <cpeterson@mozilla.com>
Sun, 10 Apr 2016 22:25:56 -0700
changeset 293358 e475e587c448
parent 293357 dc04a988f404
child 293359 8ed65e8e9c75
push id30180
push userkwierso@gmail.com
push date2016-04-15 21:31 +0000
treeherdermozilla-central@ded7cf683d5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1264208
milestone48.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 1264208 - Enable libav assertions. r=jya
media/ffvpx/cpu_perms.h
media/ffvpx/ffvpxcommon.mozbuild
media/ffvpx/libavutil_visibility.h
media/libav/moz.build
--- a/media/ffvpx/ffvpxcommon.mozbuild
+++ b/media/ffvpx/ffvpxcommon.mozbuild
@@ -45,18 +45,18 @@ if CONFIG['GNU_CC']:
         '-Wno-unused-function',
         '-Wno-deprecated-declarations',
     ]
     if CONFIG['CLANG_CXX']:
         CFLAGS += [
             '-Wno-incompatible-pointer-types-discards-qualifiers',
             '-Wno-logical-op-parentheses',
         ]
-    # Force visibility of cpu symbols
-    CFLAGS += ['-include', 'cpu_perms.h']
+    # Force visibility of cpu and av_log symbols.
+    CFLAGS += ['-include', 'libavutil_visibility.h']
 elif CONFIG['_MSC_VER']:
     CFLAGS += [
         '-wd4090', # 'return' : different 'const' qualifiers
         '-wd4018', # '>' : signed/unsigned mismatch
         '-wd4305', # 'initializing' : truncation from '__int64' to 'double'
         '-wd4554', # '>>' : check operator precedence for possible error
         '-wd4307', # '+' : integral constant overflow'
         '-wd4028', # formal parameter 1 different from declaration
@@ -80,8 +80,15 @@ elif CONFIG['_MSC_VER']:
     ]
     if CONFIG['_MSC_VER'] < '1900':
         DEFINES['MSVC_2013_OR_LOWER'] = True
         DEFINES['snprintf'] = "avpriv_snprintf"
         DEFINES['_snprintf'] = "avpriv_snprintf"
         DEFINES['vsnprintf'] = "avpriv_vsnprintf"
 
 DEFINES['HAVE_AV_CONFIG_H'] = True
+
+if CONFIG['MOZ_DEBUG']:
+    # Enable all assertions in debug builds.
+    DEFINES['ASSERT_LEVEL'] = 2
+elif not CONFIG['RELEASE_BUILD']:
+    # Enable fast assertions in opt builds of Nightly and Aurora.
+    DEFINES['ASSERT_LEVEL'] = 1
rename from media/ffvpx/cpu_perms.h
rename to media/ffvpx/libavutil_visibility.h
--- a/media/ffvpx/cpu_perms.h
+++ b/media/ffvpx/libavutil_visibility.h
@@ -1,16 +1,20 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Include file for fixing symbol visibility on Linux.
 
-#ifndef MOZILLA_AVCPU_PERMS_H
-#define MOZILLA_AVCPU_PERMS_H
+#ifndef MOZILLA_AVUTIL_VISIBILITY_H
+#define MOZILLA_AVUTIL_VISIBILITY_H
 
 #pragma GCC visibility push(default)
 #include "libavutil/cpu.h"
+
+// We need av_log() to be visible so we can enable assertions in libavcodec.
+#include "libavutil/log.h"
+
 #pragma GCC visibility pop
 
-#endif // MOZILLA_AVCPU_PERMS_H
+#endif // MOZILLA_AVUTIL_VISIBILITY_H
--- a/media/libav/moz.build
+++ b/media/libav/moz.build
@@ -61,9 +61,16 @@ if CONFIG['_MSC_VER']:
 #
 # TODO: Remove header and patch libav once OS X supports system headers
 if CONFIG['OS_ARCH'] != 'WINNT':
     SOURCES['libavcodec/avfft.c'].flags += ['-include', 'avfft_perms.h']
 
 # We allow warnings for third-party code that can be updated from upstream.
 ALLOW_COMPILER_WARNINGS = True
 
+if CONFIG['MOZ_DEBUG']:
+    # Enable all assertions in debug builds.
+    DEFINES['ASSERT_LEVEL'] = 2
+elif not CONFIG['RELEASE_BUILD']:
+    # Enable fast assertions in opt builds of Nightly and Aurora.
+    DEFINES['ASSERT_LEVEL'] = 1
+
 include("libavcommon.mozbuild")