merge mozilla-central to mozilla-inbound. r=merge a=merge on a CLOSED TREE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 07 Nov 2017 13:05:55 +0200
changeset 443772 a4b1ea416a97eafad7f4ac235fc1ca45d9fc770f
parent 443771 e13804265867ec492d8b775035698b1bcd8b96f8 (current diff)
parent 443759 923836aebbc328d1a971f6ce32a99d9aa4d1345a (diff)
child 443773 fb5b3dbdaf6799c8ba321f3993ed19049430676e
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge, merge
milestone58.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
merge mozilla-central to mozilla-inbound. r=merge a=merge on a CLOSED TREE
dom/interfaces/html/nsIDOMHTMLSourceElement.idl
gfx/vr/gfxVRGVR.cpp
gfx/vr/gfxVRGVR.h
gfx/vr/gfxVRGVRAPI.h
gfx/vr/jni/gfxGVRJNI.cpp
mobile/android/base/java/org/mozilla/gecko/PresentationView.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoVRManager.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoViewHandler.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoViewSettings.java
testing/mozharness/configs/hazards/build_browser.py
testing/mozharness/configs/hazards/build_shell.py
testing/mozharness/configs/hazards/common.py
testing/mozharness/configs/users/sfink/spidermonkey.py
testing/mozharness/docs/spidermonkey_build.rst
testing/mozharness/mozharness/mozilla/building/hazards.py
testing/mozharness/scripts/spidermonkey/build.browser
testing/mozharness/scripts/spidermonkey/build.shell
testing/mozharness/scripts/spidermonkey_build.py
widget/android/GeckoVRManager.h
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -353,20 +353,27 @@ const CustomizableWidgets = [
       deck.setAttribute("selectedIndex", index);
     },
 
     _showTabsPromise: Promise.resolve(),
     // Update the tab list after any existing in-flight updates are complete.
     _showTabs(paginationInfo) {
       this._showTabsPromise = this._showTabsPromise.then(() => {
         return this.__showTabs(paginationInfo);
+      }, e => {
+        Cu.reportError(e);
       });
     },
     // Return a new promise to update the tab list.
     __showTabs(paginationInfo) {
+      if (!this._tabsList) {
+        // Closed between the previous `this._showTabsPromise`
+        // resolving and now.
+        return undefined;
+      }
       let doc = this._tabsList.ownerDocument;
       return SyncedTabs.getTabClients().then(clients => {
         // The view may have been hidden while the promise was resolving.
         if (!this._tabsList) {
           return;
         }
         if (clients.length === 0 && !SyncedTabs.hasSyncedThisSession) {
           // the "fetching tabs" deck is being shown - let's leave it there.
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -463,20 +463,18 @@ nsBrowserContentHandler.prototype = {
               "  --new-window <url> Open <url> in a new window.\n" +
               "  --new-tab <url>    Open <url> in a new tab.\n" +
               "  --private-window <url> Open <url> in a new private window.\n";
     if (AppConstants.platform == "win") {
       info += "  --preferences      Open Options dialog.\n";
     } else {
       info += "  --preferences      Open Preferences dialog.\n";
     }
-    if (AppConstants.platform == "win" || AppConstants.MOZ_WIDGET_GTK) {
-      info += "  --screenshot [<path>] Save screenshot to <path> or in working directory.\n";
-      info += "  --window-size width[,height] Width and optionally height of screenshot.\n";
-    }
+    info += "  --screenshot [<path>] Save screenshot to <path> or in working directory.\n";
+    info += "  --window-size width[,height] Width and optionally height of screenshot.\n";
     info += "  --search <term>    Search <term> with your default search engine.\n";
     return info;
   },
 
   /* nsIBrowserHandler */
 
   get defaultArgs() {
     var prefb = Services.prefs;
--- a/browser/extensions/activity-stream/lib/SectionsManager.jsm
+++ b/browser/extensions/activity-stream/lib/SectionsManager.jsm
@@ -29,17 +29,21 @@ const BUILT_IN_SECTIONS = {
       }] : []
     },
     shouldHidePref: options.hidden,
     eventSource: "TOP_STORIES",
     icon: options.provider_icon,
     title: {id: "header_recommended_by", values: {provider: options.provider_name}},
     disclaimer: {
       text: {id: options.disclaimer_text || "section_disclaimer_topstories"},
-      link: {href: options.disclaimer_link, id: options.disclaimer_linktext || "section_disclaimer_topstories_linktext"},
+      link: {
+        // The href fallback is temporary so users in existing Shield studies get this configuration as well
+        href: options.disclaimer_link || "https://getpocket.cdn.mozilla.net/firefox/new_tab_learn_more",
+        id: options.disclaimer_linktext || "section_disclaimer_topstories_linktext"
+      },
       button: {id: options.disclaimer_buttontext || "section_disclaimer_topstories_buttontext"}
     },
     maxRows: 1,
     availableContextMenuOptions: ["CheckBookmark", "SaveToPocket", "Separator", "OpenInNewWindow", "OpenInPrivateWindow", "Separator", "BlockUrl"],
     infoOption: {
       header: {id: options.provider_header || "pocket_feedback_header"},
       body: {id: options.provider_description || "pocket_feedback_body"},
       link: {href: options.info_link, id: "section_info_privacy_notice"}
--- a/browser/extensions/formautofill/ProfileStorage.jsm
+++ b/browser/extensions/formautofill/ProfileStorage.jsm
@@ -1519,51 +1519,116 @@ class CreditCards extends AutofillRecord
   _stripComputedFields(creditCard) {
     if (creditCard["cc-number-encrypted"]) {
       creditCard["cc-number"] = MasterPassword.decryptSync(creditCard["cc-number-encrypted"]);
     }
     super._stripComputedFields(creditCard);
   }
 
   _normalizeFields(creditCard) {
-    // Normalize name
+    this._normalizeCCName(creditCard);
+    this._normalizeCCExpirationDate(creditCard);
+  }
+
+  _normalizeCCName(creditCard) {
     if (creditCard["cc-given-name"] || creditCard["cc-additional-name"] || creditCard["cc-family-name"]) {
       if (!creditCard["cc-name"]) {
         creditCard["cc-name"] = FormAutofillNameUtils.joinNameParts({
           given: creditCard["cc-given-name"],
           middle: creditCard["cc-additional-name"],
           family: creditCard["cc-family-name"],
         });
       }
 
       delete creditCard["cc-given-name"];
       delete creditCard["cc-additional-name"];
       delete creditCard["cc-family-name"];
     }
+  }
 
-    // Validate expiry date
+  _normalizeCCExpirationDate(creditCard) {
     if (creditCard["cc-exp-month"]) {
       let expMonth = parseInt(creditCard["cc-exp-month"], 10);
       if (isNaN(expMonth) || expMonth < 1 || expMonth > 12) {
         delete creditCard["cc-exp-month"];
       } else {
         creditCard["cc-exp-month"] = expMonth;
       }
     }
+
     if (creditCard["cc-exp-year"]) {
       let expYear = parseInt(creditCard["cc-exp-year"], 10);
       if (isNaN(expYear) || expYear < 0) {
         delete creditCard["cc-exp-year"];
       } else if (expYear < 100) {
         // Enforce 4 digits years.
         creditCard["cc-exp-year"] = expYear + 2000;
       } else {
         creditCard["cc-exp-year"] = expYear;
       }
     }
+
+    if (creditCard["cc-exp"] && (!creditCard["cc-exp-month"] || !creditCard["cc-exp-year"])) {
+      let rules = [
+        {
+          regex: "(\\d{4})[-/](\\d{1,2})",
+          yearIndex: 1,
+          monthIndex: 2,
+        },
+        {
+          regex: "(\\d{1,2})[-/](\\d{4})",
+          yearIndex: 2,
+          monthIndex: 1,
+        },
+        {
+          regex: "(\\d{1,2})[-/](\\d{1,2})",
+        },
+        {
+          regex: "(\\d{2})(\\d{2})",
+        },
+      ];
+
+      for (let rule of rules) {
+        let result = new RegExp(`(?:^|\\D)${rule.regex}(?!\\d)`).exec(creditCard["cc-exp"]);
+        if (!result) {
+          continue;
+        }
+
+        let expYear, expMonth;
+
+        if (!rule.yearIndex || !rule.monthIndex) {
+          expMonth = parseInt(result[1], 10);
+          if (expMonth > 12) {
+            expYear = parseInt(result[1], 10);
+            expMonth = parseInt(result[2], 10);
+          } else {
+            expYear = parseInt(result[2], 10);
+          }
+        } else {
+          expYear = parseInt(result[rule.yearIndex], 10);
+          expMonth = parseInt(result[rule.monthIndex], 10);
+        }
+
+        if (expMonth < 1 || expMonth > 12) {
+          continue;
+        }
+
+        if (expYear < 100) {
+          expYear += 2000;
+        } else if (expYear < 2000) {
+          continue;
+        }
+
+        creditCard["cc-exp-month"] = expMonth;
+        creditCard["cc-exp-year"] = expYear;
+        break;
+      }
+    }
+
+    delete creditCard["cc-exp"];
   }
 }
 
 function ProfileStorage(path) {
   this._path = path;
   this._initializePromise = null;
   this.INTERNAL_FIELDS = INTERNAL_FIELDS;
 }
--- a/browser/extensions/formautofill/test/unit/test_transformFields.js
+++ b/browser/extensions/formautofill/test/unit/test_transformFields.js
@@ -522,46 +522,241 @@ const CREDIT_CARD_COMPUTE_TESTCASES = [
   },
 ];
 
 const CREDIT_CARD_NORMALIZE_TESTCASES = [
   // Empty
   {
     description: "No normalizable field",
     creditCard: {
-      "cc-number": "1234123412341234", // cc-number won't be verified
     },
     expectedResult: {
     },
   },
 
   // Name
   {
     description: "Has both \"cc-name\" and the split name fields",
     creditCard: {
       "cc-name": "Timothy John Berners-Lee",
       "cc-given-name": "John",
       "cc-family-name": "Doe",
-      "cc-number": "1234123412341234", // cc-number won't be verified
     },
     expectedResult: {
       "cc-name": "Timothy John Berners-Lee",
     },
   },
   {
     description: "Has only the split name fields",
     creditCard: {
       "cc-given-name": "John",
       "cc-family-name": "Doe",
-      "cc-number": "1234123412341234", // cc-number won't be verified
     },
     expectedResult: {
       "cc-name": "John Doe",
     },
   },
+
+  // Expiration Date
+  {
+    description: "Has \"cc-exp\" formatted \"yyyy-mm\"",
+    creditCard: {
+      "cc-exp": "2022-12",
+    },
+    expectedResult: {
+      "cc-exp-month": 12,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" formatted \"yyyy/mm\"",
+    creditCard: {
+      "cc-exp": "2022/12",
+    },
+    expectedResult: {
+      "cc-exp-month": 12,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" formatted \"yyyy-m\"",
+    creditCard: {
+      "cc-exp": "2022-3",
+    },
+    expectedResult: {
+      "cc-exp-month": 3,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" formatted \"yyyy/m\"",
+    creditCard: {
+      "cc-exp": "2022/3",
+    },
+    expectedResult: {
+      "cc-exp-month": 3,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" formatted \"mm-yyyy\"",
+    creditCard: {
+      "cc-exp": "12-2022",
+    },
+    expectedResult: {
+      "cc-exp-month": 12,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" formatted \"mm/yyyy\"",
+    creditCard: {
+      "cc-exp": "12/2022",
+    },
+    expectedResult: {
+      "cc-exp-month": 12,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" formatted \"m-yyyy\"",
+    creditCard: {
+      "cc-exp": "3-2022",
+    },
+    expectedResult: {
+      "cc-exp-month": 3,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" formatted \"m/yyyy\"",
+    creditCard: {
+      "cc-exp": "3/2022",
+    },
+    expectedResult: {
+      "cc-exp-month": 3,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" formatted \"mm-yy\"",
+    creditCard: {
+      "cc-exp": "12-22",
+    },
+    expectedResult: {
+      "cc-exp-month": 12,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" formatted \"mm/yy\"",
+    creditCard: {
+      "cc-exp": "12/22",
+    },
+    expectedResult: {
+      "cc-exp-month": 12,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" formatted \"yy-mm\"",
+    creditCard: {
+      "cc-exp": "22-12",
+    },
+    expectedResult: {
+      "cc-exp-month": 12,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" formatted \"yy/mm\"",
+    creditCard: {
+      "cc-exp": "22/12",
+    },
+    expectedResult: {
+      "cc-exp-month": 12,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" formatted \"mmyy\"",
+    creditCard: {
+      "cc-exp": "1222",
+    },
+    expectedResult: {
+      "cc-exp-month": 12,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" formatted \"yymm\"",
+    creditCard: {
+      "cc-exp": "2212",
+    },
+    expectedResult: {
+      "cc-exp-month": 12,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has \"cc-exp\" with spaces",
+    creditCard: {
+      "cc-exp": "  2033-11  ",
+    },
+    expectedResult: {
+      "cc-exp-month": 11,
+      "cc-exp-year": 2033,
+    },
+  },
+  {
+    description: "Has invalid \"cc-exp\"",
+    creditCard: {
+      "cc-exp": "99-9999",
+    },
+    expectedResult: {
+      "cc-exp-month": undefined,
+      "cc-exp-year": undefined,
+    },
+  },
+  {
+    description: "Has both \"cc-exp-*\" and \"cc-exp\"",
+    creditCard: {
+      "cc-exp": "2022-12",
+      "cc-exp-month": 3,
+      "cc-exp-year": 2030,
+    },
+    expectedResult: {
+      "cc-exp-month": 3,
+      "cc-exp-year": 2030,
+    },
+  },
+  {
+    description: "Has only \"cc-exp-year\" and \"cc-exp\"",
+    creditCard: {
+      "cc-exp": "2022-12",
+      "cc-exp-year": 2030,
+    },
+    expectedResult: {
+      "cc-exp-month": 12,
+      "cc-exp-year": 2022,
+    },
+  },
+  {
+    description: "Has only \"cc-exp-month\" and \"cc-exp\"",
+    creditCard: {
+      "cc-exp": "2022-12",
+      "cc-exp-month": 3,
+    },
+    expectedResult: {
+      "cc-exp-month": 12,
+      "cc-exp-year": 2022,
+    },
+  },
+
+  // Card Number
   {
     description: "Number should be encrypted and masked",
     creditCard: {
       "cc-number": "1234123412341234",
     },
     expectedResult: {
       "cc-number": "************1234",
     },
--- a/build/build-clang/build-clang.py
+++ b/build/build-clang/build-clang.py
@@ -318,19 +318,19 @@ def prune_final_dir_for_clang_tidy(final
     for f in glob.glob("%s/share/clang/*" % final_dir):
         if re_clang_tidy.search(os.path.basename(f)) is None:
             delete(f)
 
 
 if __name__ == "__main__":
     # The directories end up in the debug info, so the easy way of getting
     # a reproducible build is to run it in a know absolute directory.
-    # We use a directory in /builds/slave because the mozilla infrastructure
-    # cleans it up automatically.
-    base_dir = "/builds/slave/moz-toolchain"
+    # We use a directory that is registered as a volume in the Docker image.
+    base_dir = "/builds/worker/workspace/moz-toolchain"
+
     if is_windows():
         # TODO: Because Windows taskcluster builds are run with distinct
         # user IDs for each job, we can't store things in some globally
         # accessible directory: one job will run, checkout LLVM to that
         # directory, and then if another job runs, the new user won't be
         # able to access the previously-checked out code--or be able to
         # delete it.  So on Windows, we build in the task-specific home
         # directory; we will eventually add -fdebug-prefix-map options
--- a/build/moz.configure/android-ndk.configure
+++ b/build/moz.configure/android-ndk.configure
@@ -6,19 +6,16 @@
 
 
 js_option('--with-android-ndk', nargs=1,
           help='location where the Android NDK can be found')
 
 js_option('--with-android-toolchain', nargs=1,
           help='location of the Android toolchain')
 
-option('--with-android-googlevr-sdk', nargs=1,
-       help='location of the Android GoogleVR SDK')
-
 
 @depends(target)
 def min_android_version(target):
     if target.cpu in ['aarch64', 'x86_64', 'mips64']:
         # 64-bit support was added in API 21.
         return '21'
     return '9'
 
@@ -298,50 +295,8 @@ def android_clang_compiler(host, ndk):
     if not isdir(llvm_path):
         die("Couldn't find path to LLVM toolchain at %s" % llvm_path)
 
     clang = '%s/clang' % llvm_path
     if not exists(clang):
         die("Couln't find clang in LLVM toolchain at %s" % clang)
 
     return clang
-
-
-@depends('--with-android-googlevr-sdk', target)
-@checking('for GoogleVR SDK', lambda x: x.result)
-@imports(_from='os.path', _import='exists')
-@imports(_from='os.path', _import='abspath')
-def googlevr_sdk(value, target):
-    if not value:
-        return namespace(
-            result='Not specified'
-        )
-    path = abspath(value[0])
-    if not exists(path):
-        die('Could not find GoogleVR SDK %s', path)
-    include = '%s/libraries/headers/' % path
-    if 'arm' == target.cpu:
-        arch = 'armeabi-v7a'
-    elif 'aarch64' == target.cpu:
-        arch = 'arm64-v8a'
-    elif 'x86' == target.cpu:
-        arch = 'x86'
-    else:
-        die('Unsupported GoogleVR cpu architecture %s' % target.cpu)
-
-    libs = '{0}/libraries/jni/{1}/'.format(path, arch)
-
-    if not exists(libs):
-        die('Could not find GoogleVR NDK at %s. Did you try running '
-            '\'./gradlew :extractNdk\' in %s?', libs, path)
-
-    return namespace(
-        result=path,
-        include=include,
-        libs=libs,
-        enabled=True,
-    )
-
-
-set_define('MOZ_ANDROID_GOOGLE_VR', googlevr_sdk.enabled)
-set_config('MOZ_ANDROID_GOOGLE_VR', googlevr_sdk.enabled)
-set_config('MOZ_ANDROID_GOOGLE_VR_INCLUDE', googlevr_sdk.include)
-set_config('MOZ_ANDROID_GOOGLE_VR_LIBS', googlevr_sdk.libs)
--- a/config/system-headers
+++ b/config/system-headers
@@ -1183,20 +1183,16 @@ UTextEdit.h
 UTextTraits.h
 utime.h
 UWindows.h
 values.h
 varargs.h
 vcclr.h
 View.h
 Volume.h
-#ifdef ANDROID
-vr/gvr/capi/include/gvr.h
-vr/gvr/capi/include/gvr_controller.h
-#endif
 wab.h
 wait.h
 wchar.h
 wctype.h
 winbase.h
 win/compobj.h
 windef.h
 Window.h
--- a/devtools/client/responsive.html/test/browser/browser.ini
+++ b/devtools/client/responsive.html/test/browser/browser.ini
@@ -28,20 +28,22 @@ support-files =
 [browser_dpr_change.js]
 [browser_exit_button.js]
 [browser_frame_script_active.js]
 [browser_hide_container.js]
 [browser_menu_item_01.js]
 [browser_menu_item_02.js]
 [browser_mouse_resize.js]
 [browser_navigation.js]
+skip-if = true # Bug 1413765
 [browser_network_throttling.js]
 [browser_page_state.js]
 [browser_permission_doorhanger.js]
 tags = geolocation
+skip-if = true # Bug 1413765
 [browser_resize_cmd.js]
 [browser_screenshot_button.js]
 [browser_tab_close.js]
 [browser_tab_remoteness_change.js]
 [browser_target_blank.js]
 [browser_toolbox_computed_view.js]
 [browser_toolbox_rule_view.js]
 [browser_toolbox_swap_browsers.js]
--- a/dom/animation/test/chrome/test_animation_performance_warning.html
+++ b/dom/animation/test/chrome/test_animation_performance_warning.html
@@ -173,20 +173,20 @@ function testBasicOperation() {
         },
         {
           property: 'opacity',
           runningOnCompositor: true
         }
       ]
     },
   ].forEach(subtest => {
-    promise_test(function(t) {
+    promise_test(t => {
       var animation = addDivAndAnimate(t, { class: 'compositable' },
                                        subtest.frames, 100 * MS_PER_SEC);
-      return animation.ready.then(function() {
+      return waitForPaints().then(() => {
         assert_animation_property_state_equals(
           animation.effect.getProperties(),
           subtest.expected);
       });
     }, subtest.desc);
   });
 }
 
@@ -248,49 +248,49 @@ function testKeyframesWithGeometricPrope
             property: 'transform',
             runningOnCompositor: false,
             warning: 'CompositorAnimationWarningTransformWithGeometricProperties'
           }
         ]
       }
     },
   ].forEach(subtest => {
-    promise_test(function(t) {
+    promise_test(t => {
       var animation = addDivAndAnimate(t, { class: 'compositable' },
                                        subtest.frames, 100 * MS_PER_SEC);
-      return animation.ready.then(function() {
+      return waitForPaints().then(() => {
         // First, a transform animation is running on compositor.
         assert_animation_property_state_equals(
           animation.effect.getProperties(),
           subtest.expected.withoutGeometric);
-      }).then(function() {
+      }).then(() => {
         // Add a 'width' property.
         var keyframes = animation.effect.getKeyframes();
 
         keyframes[0].width = '100px';
         keyframes[1].width = '200px';
 
         animation.effect.setKeyframes(keyframes);
         return waitForFrame();
-      }).then(function() {
+      }).then(() => {
         // Now the transform animation is not running on compositor because of
         // the 'width' property.
         assert_animation_property_state_equals(
           animation.effect.getProperties(),
           subtest.expected.withGeometric);
-      }).then(function() {
+      }).then(() => {
         // Remove the 'width' property.
         var keyframes = animation.effect.getKeyframes();
 
         delete keyframes[0].width;
         delete keyframes[1].width;
 
         animation.effect.setKeyframes(keyframes);
         return waitForFrame();
-      }).then(function() {
+      }).then(() => {
         // Finally, the transform animation is running on compositor.
         assert_animation_property_state_equals(
           animation.effect.getProperties(),
           subtest.expected.withoutGeometric);
       });
     }, 'An animation has: ' + subtest.desc);
   });
 }
@@ -301,25 +301,25 @@ function testSetOfGeometricProperties() 
   const geometricProperties = [
     'width', 'height',
     'top', 'right', 'bottom', 'left',
     'margin-top', 'margin-right', 'margin-bottom', 'margin-left',
     'padding-top', 'padding-right', 'padding-bottom', 'padding-left'
   ];
 
   geometricProperties.forEach(property => {
-    promise_test(function(t) {
+    promise_test(t => {
       const keyframes = {
         [propertyToIDL(property)]: [ '100px', '200px' ],
         transform: [ 'translate(0px)', 'translate(100px)' ]
       };
       var animation = addDivAndAnimate(t, { class: 'compositable' },
                                        keyframes, 100 * MS_PER_SEC);
 
-      return animation.ready.then(function() {
+      return waitForPaints().then(() => {
         assert_animation_property_state_equals(
           animation.effect.getProperties(),
           [
             {
               property,
               runningOnCompositor: false
             },
             {
@@ -398,32 +398,32 @@ function testStyleChanges() {
         {
           property: 'transform',
           runningOnCompositor: false,
           warning: 'CompositorAnimationWarningTransformBackfaceVisibilityHidden'
         }
       ]
     },
   ].forEach(subtest => {
-    promise_test(function(t) {
+    promise_test(t => {
       var animation = addDivAndAnimate(t, { class: 'compositable' },
                                        subtest.frames, 100 * MS_PER_SEC);
-      return animation.ready.then(function() {
+      return waitForPaints().then(() => {
         assert_all_properties_running_on_compositor(
           animation.effect.getProperties(),
           subtest.expected);
         animation.effect.target.style = subtest.style;
         return waitForFrame();
-      }).then(function() {
+      }).then(() => {
         assert_animation_property_state_equals(
           animation.effect.getProperties(),
           subtest.expected);
         animation.effect.target.style = '';
         return waitForFrame();
-      }).then(function() {
+      }).then(() => {
         assert_all_properties_running_on_compositor(
           animation.effect.getProperties(),
           subtest.expected);
       });
     }, subtest.desc);
   });
 }
 
@@ -441,36 +441,36 @@ function testIdChanges() {
         {
           property: 'transform',
           runningOnCompositor: false,
           warning: 'CompositorAnimationWarningHasRenderingObserver'
         }
       ]
     },
   ].forEach(subtest => {
-    promise_test(function(t) {
+    promise_test(t => {
       if (subtest.createelement) {
         addDiv(t, { style: subtest.createelement });
       }
 
       var animation = addDivAndAnimate(t, { class: 'compositable' },
                                        subtest.frames, 100 * MS_PER_SEC);
-      return animation.ready.then(function() {
+      return waitForPaints().then(() => {
         assert_all_properties_running_on_compositor(
           animation.effect.getProperties(),
           subtest.expected);
         animation.effect.target.id = subtest.id;
         return waitForFrame();
-      }).then(function() {
+      }).then(() => {
         assert_animation_property_state_equals(
           animation.effect.getProperties(),
           subtest.expected);
         animation.effect.target.id = '';
         return waitForFrame();
-      }).then(function() {
+      }).then(() => {
         assert_all_properties_running_on_compositor(
           animation.effect.getProperties(),
           subtest.expected);
       });
     }, subtest.desc);
   });
 }
 
@@ -530,42 +530,42 @@ function testMultipleAnimations() {
               property: 'opacity',
               runningOnCompositor: true,
             }
           ]
         }
       ],
     },
   ].forEach(subtest => {
-    promise_test(function(t) {
+    promise_test(t => {
       var div = addDiv(t, { class: 'compositable' });
-      var animations = subtest.animations.map(function(anim) {
+      var animations = subtest.animations.map(anim => {
         var animation = div.animate(anim.frames, 100 * MS_PER_SEC);
 
         // Bind expected values to animation object.
         animation.expected = anim.expected;
         return animation;
       });
-      return waitForAllAnimations(animations).then(function() {
+      return waitForPaints().then(() => {
         animations.forEach(anim => {
           assert_all_properties_running_on_compositor(
             anim.effect.getProperties(),
             anim.expected);
         });
         div.style = subtest.style;
         return waitForFrame();
-      }).then(function() {
+      }).then(() => {
         animations.forEach(anim => {
           assert_animation_property_state_equals(
             anim.effect.getProperties(),
             anim.expected);
         });
         div.style = '';
         return waitForFrame();
-      }).then(function() {
+      }).then(() => {
         animations.forEach(anim => {
           assert_all_properties_running_on_compositor(
             anim.effect.getProperties(),
             anim.expected);
         });
       });
     }, 'Multiple animations: ' + subtest.desc);
   });
@@ -668,59 +668,59 @@ function testMultipleAnimationsWithGeome
                 warning: 'CompositorAnimationWarningTransformWithGeometricProperties'
               }
             ]
           }
         }
       ]
     },
   ].forEach(subtest => {
-    promise_test(function(t) {
+    promise_test(t => {
       var div = addDiv(t, { class: 'compositable' });
-      var animations = subtest.animations.map(function(anim) {
+      var animations = subtest.animations.map(anim => {
         var animation = div.animate(anim.frames, 100 * MS_PER_SEC);
 
         // Bind expected values to animation object.
         animation.expected = anim.expected;
         return animation;
       });
-      return waitForAllAnimations(animations).then(function() {
+      return waitForPaints().then(() => {
         // First, all animations are running on compositor.
         animations.forEach(anim => {
           assert_animation_property_state_equals(
             anim.effect.getProperties(),
             anim.expected.withoutGeometric);
         });
-      }).then(function() {
+      }).then(() => {
         // Add a 'width' property to animations[1].
         var keyframes = animations[1].effect.getKeyframes();
 
         keyframes[0].width = '100px';
         keyframes[1].width = '200px';
 
         animations[1].effect.setKeyframes(keyframes);
         return waitForFrame();
-      }).then(function() {
+      }).then(() => {
         // Now the transform animation is not running on compositor because of
         // the 'width' property.
         animations.forEach(anim => {
           assert_animation_property_state_equals(
             anim.effect.getProperties(),
             anim.expected.withGeometric);
         });
-      }).then(function() {
+      }).then(() => {
         // Remove the 'width' property from animations[1].
         var keyframes = animations[1].effect.getKeyframes();
 
         delete keyframes[0].width;
         delete keyframes[1].width;
 
         animations[1].effect.setKeyframes(keyframes);
         return waitForFrame();
-      }).then(function() {
+      }).then(() => {
         // Finally, all animations are running on compositor.
         animations.forEach(anim => {
           assert_animation_property_state_equals(
             anim.effect.getProperties(),
             anim.expected.withoutGeometric);
         });
       });
     }, 'Multiple animations with geometric property: ' + subtest.desc);
@@ -788,51 +788,51 @@ function testMultipleAnimationsWithGeome
               property: 'opacity',
               runningOnCompositor: true,
             }
           ]
         }
       ],
     },
   ].forEach(subtest => {
-    promise_test(function(t) {
+    promise_test(t => {
       var div = addDiv(t, { class: 'compositable' });
-      var animations = subtest.animations.map(function(anim) {
+      var animations = subtest.animations.map(anim => {
         var animation = div.animate(anim.frames, 100 * MS_PER_SEC);
 
         // Bind expected values to animation object.
         animation.expected = anim.expected;
         return animation;
       });
 
       var widthAnimation;
 
-      return waitForAllAnimations(animations).then(function() {
+      return waitForPaints().then(() => {
         animations.forEach(anim => {
           assert_all_properties_running_on_compositor(
             anim.effect.getProperties(),
             anim.expected);
         });
-      }).then(function() {
+      }).then(() => {
         // Append 'width' animation on the same element.
         widthAnimation = div.animate({ width: ['100px', '200px'] },
                                      100 * MS_PER_SEC);
         return waitForFrame();
-      }).then(function() {
+      }).then(() => {
         // Now transform animations are not running on compositor because of
         // the 'width' animation.
         animations.forEach(anim => {
           assert_animation_property_state_equals(
             anim.effect.getProperties(),
             anim.expected);
         });
         // Remove the 'width' animation.
         widthAnimation.cancel();
         return waitForFrame();
-      }).then(function() {
+      }).then(() => {
         // Now all animations are running on compositor.
         animations.forEach(anim => {
           assert_all_properties_running_on_compositor(
             anim.effect.getProperties(),
             anim.expected);
         });
       });
     }, 'Multiple async animations and geometric animation: ' + subtest.desc);
@@ -870,74 +870,74 @@ function testSmallElements() {
       expected: [
         {
           property: 'transform',
           runningOnCompositor: true
         }
       ]
     },
   ].forEach(subtest => {
-    promise_test(function(t) {
+    promise_test(t => {
     var div = addDiv(t, subtest.style);
     var animation = div.animate(subtest.frames, 100 * MS_PER_SEC);
-      return animation.ready.then(function() {
+      return waitForPaints().then(() => {
         assert_animation_property_state_equals(
           animation.effect.getProperties(),
           subtest.expected);
       });
     }, subtest.desc);
   });
 }
 
 function testSynchronizedAnimations() {
-  promise_test(function(t) {
+  promise_test(t => {
     const elemA = addDiv(t, { class: 'compositable' });
     const elemB = addDiv(t, { class: 'compositable' });
 
     const animA = elemA.animate({ transform: [ 'translate(0px)',
                                                'translate(100px)' ] },
                                 100 * MS_PER_SEC);
     const animB = elemB.animate({ marginLeft: [ '0px', '100px' ] },
                                 100 * MS_PER_SEC);
 
-    return Promise.all([animA.ready, animB.ready])
+    return waitForPaints()
       .then(() => {
         assert_animation_property_state_equals(
           animA.effect.getProperties(),
           [ { property: 'transform',
               runningOnCompositor: false,
               warning: 'CompositorAnimationWarningTransformWithSyncGeometricAnimations'
           } ]);
       });
   }, 'Animations created within the same tick are synchronized'
      + ' (compositor animation created first)');
 
-  promise_test(function(t) {
+  promise_test(t => {
     const elemA = addDiv(t, { class: 'compositable' });
     const elemB = addDiv(t, { class: 'compositable' });
 
     const animA = elemA.animate({ marginLeft: [ '0px', '100px' ] },
                                 100 * MS_PER_SEC);
     const animB = elemB.animate({ transform: [ 'translate(0px)',
                                                'translate(100px)' ] },
                                 100 * MS_PER_SEC);
 
-    return Promise.all([animA.ready, animB.ready])
+    return waitForPaints()
       .then(() => {
         assert_animation_property_state_equals(
           animB.effect.getProperties(),
           [ { property: 'transform',
               runningOnCompositor: false,
               warning: 'CompositorAnimationWarningTransformWithSyncGeometricAnimations'
           } ]);
       });
   }, 'Animations created within the same tick are synchronized'
      + ' (compositor animation created second)');
 
-  promise_test(function(t) {
+  promise_test(t => {
     const attrs = { class: 'compositable',
                     style: 'transition: all 100s' };
     const elemA = addDiv(t, attrs);
     const elemB = addDiv(t, attrs);
     elemA.style.transform = 'translate(0px)';
     elemB.style.marginLeft = '0px';
     getComputedStyle(elemA).transform;
     getComputedStyle(elemB).marginLeft;
@@ -975,146 +975,146 @@ function testSynchronizedAnimations() {
           transitionA.effect.getProperties(),
           [ { property: 'transform',
               runningOnCompositor: false,
               warning: 'CompositorAnimationWarningTransformWithSyncGeometricAnimations'
           } ]);
       });
   }, 'Transitions created before and after a tick are synchronized');
 
-  promise_test(function(t) {
+  promise_test(t => {
     const elemA = addDiv(t, { class: 'compositable' });
     const elemB = addDiv(t, { class: 'compositable' });
 
     const animA = elemA.animate({ transform: [ 'translate(0px)',
                                                'translate(100px)' ],
                                   opacity: [ 0, 1 ] },
                                 100 * MS_PER_SEC);
     const animB = elemB.animate({ marginLeft: [ '0px', '100px' ] },
                                 100 * MS_PER_SEC);
 
-    return Promise.all([animA.ready, animB.ready])
+    return waitForPaints()
       .then(() => {
         assert_animation_property_state_equals(
           animA.effect.getProperties(),
           [ { property: 'transform',
               runningOnCompositor: false,
               warning: 'CompositorAnimationWarningTransformWithSyncGeometricAnimations'
             },
             { property: 'opacity',
               runningOnCompositor: true
             } ]);
       });
   }, 'Opacity animations on the same element continue running on the'
      + ' compositor when transform animations are synchronized with geometric'
      + ' animations');
 
-  promise_test(function(t) {
+  promise_test(t => {
     const elemA = addDiv(t, { class: 'compositable' });
     const elemB = addDiv(t, { class: 'compositable' });
 
     const animA = elemA.animate({ marginLeft: [ '0px', '100px' ] },
                                 100 * MS_PER_SEC);
     let animB;
 
-    return waitForFrame()
+    return waitForPaints()
       .then(() => {
         animB = elemB.animate({ transform: [ 'translate(0px)',
                                              'translate(100px)' ] },
                                 100 * MS_PER_SEC);
         return animB.ready;
       }).then(() => {
         assert_animation_property_state_equals(
           animB.effect.getProperties(),
           [ { property: 'transform',
               runningOnCompositor: true } ]);
       });
   }, 'Transform animations are NOT synchronized with geometric animations'
      + ' started in the previous frame');
 
-  promise_test(function(t) {
+  promise_test(t => {
     const elemA = addDiv(t, { class: 'compositable' });
     const elemB = addDiv(t, { class: 'compositable' });
 
     const animA = elemA.animate({ transform: [ 'translate(0px)',
                                                'translate(100px)' ] },
                                 100 * MS_PER_SEC);
     let animB;
 
-    return waitForFrame()
+    return waitForPaints()
       .then(() => {
         animB = elemB.animate({ marginLeft: [ '0px', '100px' ] },
                               100 * MS_PER_SEC);
         return animB.ready;
       }).then(() => {
         assert_animation_property_state_equals(
           animA.effect.getProperties(),
           [ { property: 'transform',
               runningOnCompositor: true } ]);
       });
   }, 'Transform animations are NOT synchronized with geometric animations'
      + ' started in the next frame');
 
-  promise_test(function(t) {
+  promise_test(t => {
     const elemA = addDiv(t, { class: 'compositable' });
     const elemB = addDiv(t, { class: 'compositable' });
 
     const animA = elemA.animate({ transform: [ 'translate(0px)',
                                                'translate(100px)' ] },
                                 100 * MS_PER_SEC);
     const animB = elemB.animate({ marginLeft: [ '0px', '100px' ] },
                                 100 * MS_PER_SEC);
     animB.pause();
 
-    return Promise.all([animA.ready, animB.ready])
+    return waitForPaints()
       .then(() => {
         assert_animation_property_state_equals(
           animA.effect.getProperties(),
           [ { property: 'transform', runningOnCompositor: true } ]);
       });
   }, 'Paused animations are not synchronized');
 
-  promise_test(function(t) {
+  promise_test(t => {
     const elemA = addDiv(t, { class: 'compositable' });
     const elemB = addDiv(t, { class: 'compositable' });
 
     const animA = elemA.animate({ transform: [ 'translate(0px)',
                                                'translate(100px)' ] },
                                 100 * MS_PER_SEC);
     const animB = elemB.animate({ marginLeft: [ '0px', '100px' ] },
                                 100 * MS_PER_SEC);
 
     // Seek one of the animations so that their start times will differ
     animA.currentTime = 5000;
 
-    return Promise.all([animA.ready, animB.ready])
+    return waitForPaints()
       .then(() => {
         assert_not_equals(animA.startTime, animB.startTime,
                           'Animations should have different start times');
         assert_animation_property_state_equals(
           animA.effect.getProperties(),
           [ { property: 'transform',
               runningOnCompositor: false,
               warning: 'CompositorAnimationWarningTransformWithSyncGeometricAnimations'
           } ]);
       });
   }, 'Animations are synchronized based on when they are started'
      + ' and NOT their start time');
 
-  promise_test(function(t) {
+  promise_test(t => {
     const elemA = addDiv(t, { class: 'compositable' });
     const elemB = addDiv(t, { class: 'compositable' });
 
     const animA = elemA.animate({ transform: [ 'translate(0px)',
                                                'translate(100px)' ] },
                                 100 * MS_PER_SEC);
     const animB = elemB.animate({ marginLeft: [ '0px', '100px' ] },
                                 100 * MS_PER_SEC);
 
-    return Promise.all([animA.ready, animB.ready])
+    return waitForPaints()
       .then(() => {
         assert_animation_property_state_equals(
           animA.effect.getProperties(),
           [ { property: 'transform',
               runningOnCompositor: false } ]);
         // Restart animation
         animA.pause();
         animA.play();
@@ -1122,30 +1122,30 @@ function testSynchronizedAnimations() {
       }).then(() => {
         assert_animation_property_state_equals(
           animA.effect.getProperties(),
           [ { property: 'transform',
               runningOnCompositor: true } ]);
       });
   }, 'An initially synchronized animation may be unsynchronized if restarted');
 
-  promise_test(function(t) {
+  promise_test(t => {
     const elemA = addDiv(t, { class: 'compositable' });
     const elemB = addDiv(t, { class: 'compositable' });
 
     const animA = elemA.animate({ transform: [ 'translate(0px)',
                                                'translate(100px)' ] },
                                 100 * MS_PER_SEC);
     const animB = elemB.animate({ marginLeft: [ '0px', '100px' ] },
                                 100 * MS_PER_SEC);
 
     // Clear target effect
     animB.effect.target = null;
 
-    return Promise.all([animA.ready, animB.ready])
+    return waitForPaints()
       .then(() => {
         assert_animation_property_state_equals(
           animA.effect.getProperties(),
           [ { property: 'transform',
               runningOnCompositor: true } ]);
       });
   }, 'A geometric animation with no target element is not synchronized');
 }
@@ -1162,132 +1162,132 @@ function start() {
   testStyleChanges();
   testIdChanges();
   testMultipleAnimations();
   testMultipleAnimationsWithGeometricKeyframes();
   testMultipleAnimationsWithGeometricAnimations();
   testSmallElements();
   testSynchronizedAnimations();
 
-  promise_test(function(t) {
+  promise_test(t => {
     var animation = addDivAndAnimate(t,
                                      { class: 'compositable' },
                                      { transform: [ 'translate(0px)',
                                                     'translate(100px)'] },
                                      100 * MS_PER_SEC);
-    return animation.ready.then(function() {
+    return waitForPaints().then(() => {
       assert_animation_property_state_equals(
         animation.effect.getProperties(),
         [ { property: 'transform', runningOnCompositor: true } ]);
       animation.effect.target.style = 'width: 5200px; height: 5200px';
       return waitForFrame();
-    }).then(function() {
+    }).then(() => {
       // viewport depends on test environment.
       var expectedWarning = new RegExp(
         "Animation cannot be run on the compositor because the area of the frame " +
         "\\(\\d+\\) is too large relative to the viewport " +
         "\\(larger than \\d+\\)");
       assert_animation_property_state_equals(
         animation.effect.getProperties(),
         [ {
           property: 'transform',
           runningOnCompositor: false,
           warning: expectedWarning
         } ]);
       animation.effect.target.style = 'width: 100px; height: 100px';
       return waitForFrame();
-    }).then(function() {
+    }).then(() => {
       // FIXME: Bug 1253164: the animation should get back on compositor.
       assert_animation_property_state_equals(
         animation.effect.getProperties(),
         [ { property: 'transform', runningOnCompositor: false } ]);
     });
   }, 'transform on too big element - area');
 
-  promise_test(function(t) {
+  promise_test(t => {
     var animation = addDivAndAnimate(t,
                                      { class: 'compositable' },
                                      { transform: [ 'translate(0px)',
                                                     'translate(100px)'] },
                                      100 * MS_PER_SEC);
-    return animation.ready.then(function() {
+    return waitForPaints().then(() => {
       assert_animation_property_state_equals(
         animation.effect.getProperties(),
         [ { property: 'transform', runningOnCompositor: true } ]);
       animation.effect.target.style = 'width: 5200px; height: 1px';
       return waitForFrame();
-    }).then(function() {
+    }).then(() => {
       // viewport depends on test environment.
       var expectedWarning = new RegExp(
         "Animation cannot be run on the compositor because the frame size " +
         "\\(5200, 1\\) is too large relative to the viewport " +
         "\\(larger than \\(\\d+, \\d+\\)\\) or larger than the " +
         "maximum allowed value \\(\\d+, \\d+\\)");
       assert_animation_property_state_equals(
         animation.effect.getProperties(),
         [ {
           property: 'transform',
           runningOnCompositor: false,
           warning: expectedWarning
         } ]);
       animation.effect.target.style = 'width: 100px; height: 100px';
       return waitForFrame();
-    }).then(function() {
+    }).then(() => {
       // FIXME: Bug 1253164: the animation should get back on compositor.
       assert_animation_property_state_equals(
         animation.effect.getProperties(),
         [ { property: 'transform', runningOnCompositor: false } ]);
     });
   }, 'transform on too big element - dimensions');
 
-  promise_test(function(t) {
+  promise_test(t => {
     var svg  = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
     svg.setAttribute('width', '100');
     svg.setAttribute('height', '100');
     var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
     rect.setAttribute('width', '100');
     rect.setAttribute('height', '100');
     rect.setAttribute('fill', 'red');
     svg.appendChild(rect);
     document.body.appendChild(svg);
-    t.add_cleanup(function() {
+    t.add_cleanup(() => {
       svg.remove();
     });
 
     var animation = svg.animate(
       { transform: ['translate(0px)', 'translate(100px)'] }, 100 * MS_PER_SEC);
-    return animation.ready.then(function() {
+    return waitForPaints().then(() => {
       assert_animation_property_state_equals(
         animation.effect.getProperties(),
         [ { property: 'transform', runningOnCompositor: true } ]);
       svg.setAttribute('transform', 'translate(10, 20)');
       return waitForFrame();
-    }).then(function() {
+    }).then(() => {
       assert_animation_property_state_equals(
         animation.effect.getProperties(),
         [ {
           property: 'transform',
           runningOnCompositor: false,
           warning: 'CompositorAnimationWarningTransformSVG'
         } ]);
       svg.removeAttribute('transform');
       return waitForFrame();
-    }).then(function() {
+    }).then(() => {
       assert_animation_property_state_equals(
         animation.effect.getProperties(),
         [ { property: 'transform', runningOnCompositor: true } ]);
     });
   }, 'transform of nsIFrame with SVG transform');
 
-  promise_test(function(t) {
+  promise_test(t => {
     var div = addDiv(t, { class: 'compositable',
                           style: 'animation: fade 100s' });
     var cssAnimation = div.getAnimations()[0];
     var scriptAnimation = div.animate({ opacity: [ 1, 0 ] }, 100 * MS_PER_SEC);
-    return scriptAnimation.ready.then(function() {
+    return waitForPaints().then(() => {
       assert_animation_property_state_equals(
         cssAnimation.effect.getProperties(),
         [ { property: 'opacity', runningOnCompositor: true } ]);
       assert_animation_property_state_equals(
         scriptAnimation.effect.getProperties(),
         [ { property: 'opacity', runningOnCompositor: true } ]);
     });
   }, 'overridden animation');
--- a/dom/animation/test/chrome/test_running_on_compositor.html
+++ b/dom/animation/test/chrome/test_running_on_compositor.html
@@ -57,201 +57,201 @@ function assert_animation_is_running_on_
                 desc + ' at ' + animation.currentTime + 'ms');
 }
 
 function assert_animation_is_not_running_on_compositor(animation, desc) {
   assert_equals(animation.isRunningOnCompositor, false,
                 desc + ' at ' + animation.currentTime + 'ms');
 }
 
-promise_test(function(t) {
+promise_test(t => {
   // FIXME: When we implement Element.animate, use that here instead of CSS
   // so that we remove any dependency on the CSS mapping.
   var div = addDiv(t, { style: 'animation: anim 100s' });
   var animation = div.getAnimations()[0];
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
        'Animation reports that it is running on the compositor'
        + ' during playback');
 
     div.style.animationPlayState = 'paused';
 
     return animation.ready;
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_not_running_on_compositor(animation,
        'Animation reports that it is NOT running on the compositor'
        + ' when paused');
   });
 }, '');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'animation: background 100s' });
   var animation = div.getAnimations()[0];
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_not_running_on_compositor(animation,
        'Animation reports that it is NOT running on the compositor'
        + ' for animation of "background"');
   });
 }, 'isRunningOnCompositor is false for animation of "background"');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'animation: background_and_translate 100s' });
   var animation = div.getAnimations()[0];
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
        'Animation reports that it is running on the compositor'
         + ' when the animation has two properties, where one can run'
         + ' on the compositor, the other cannot');
   });
 }, 'isRunningOnCompositor is true if the animation has at least one ' +
    'property can run on compositor');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'animation: anim 100s' });
   var animation = div.getAnimations()[0];
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     animation.pause();
     return animation.ready;
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_not_running_on_compositor(animation,
        'Animation reports that it is NOT running on the compositor'
        + ' when animation.pause() is called');
   });
 }, 'isRunningOnCompositor is false when the animation.pause() is called');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'animation: anim 100s' });
   var animation = div.getAnimations()[0];
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     animation.finish();
     assert_animation_is_not_running_on_compositor(animation,
        'Animation reports that it is NOT running on the compositor'
        + ' immediately after animation.finish() is called');
     // Check that we don't set the flag back again on the next tick.
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_not_running_on_compositor(animation,
        'Animation reports that it is NOT running on the compositor'
        + ' on the next tick after animation.finish() is called');
   });
 }, 'isRunningOnCompositor is false when the animation.finish() is called');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'animation: anim 100s' });
   var animation = div.getAnimations()[0];
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     animation.currentTime = 100 * MS_PER_SEC;
     assert_animation_is_not_running_on_compositor(animation,
        'Animation reports that it is NOT running on the compositor'
        + ' immediately after manually seeking the animation to the end');
     // Check that we don't set the flag back again on the next tick.
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_not_running_on_compositor(animation,
        'Animation reports that it is NOT running on the compositor'
        + ' on the next tick after manually seeking the animation to the end');
   });
 }, 'isRunningOnCompositor is false when manually seeking the animation to ' +
    'the end');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'animation: anim 100s' });
   var animation = div.getAnimations()[0];
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     animation.cancel();
     assert_animation_is_not_running_on_compositor(animation,
        'Animation reports that it is NOT running on the compositor'
        + ' immediately after animation.cancel() is called');
     // Check that we don't set the flag back again on the next tick.
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_not_running_on_compositor(animation,
        'Animation reports that it is NOT running on the compositor'
        + ' on the next tick after animation.cancel() is called');
   });
 }, 'isRunningOnCompositor is false when animation.cancel() is called');
 
 // This is to test that we don't simply clobber the flag when ticking
 // animations and then set it again during painting.
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'animation: anim 100s' });
   var animation = div.getAnimations()[0];
 
-  return animation.ready.then(function() {
-    return new Promise(function(resolve) {
-      window.requestAnimationFrame(function() {
-        t.step(function() {
+  return waitForPaints().then(() => {
+    return new Promise(resolve => {
+      window.requestAnimationFrame(() => {
+        t.step(() => {
           assert_animation_is_running_on_compositor(animation,
             'Animation reports that it is running on the compositor'
              + ' in requestAnimationFrame callback');
         });
 
         resolve();
       });
     });
   });
 }, 'isRunningOnCompositor is true in requestAnimationFrame callback');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'animation: anim 100s' });
   var animation = div.getAnimations()[0];
 
-  return animation.ready.then(function() {
-    return new Promise(function(resolve) {
-      var observer = new MutationObserver(function(records) {
+  return waitForPaints().then(() => {
+    return new Promise(resolve => {
+      var observer = new MutationObserver(records => {
         var changedAnimation;
 
-        records.forEach(function(record) {
+        records.forEach(record => {
           changedAnimation =
-            record.changedAnimations.find(function(changedAnim) {
+            record.changedAnimations.find(changedAnim => {
               return changedAnim == animation;
             });
         });
 
-        t.step(function() {
+        t.step(() => {
           assert_true(!!changedAnimation, 'The animation should be recorded '
             + 'as one of the changedAnimations');
 
           assert_animation_is_running_on_compositor(animation,
             'Animation reports that it is running on the compositor'
              + ' in MutationObserver callback');
         });
 
         resolve();
       });
       observer.observe(div, { animations: true, subtree: false });
-      t.add_cleanup(function() {
+      t.add_cleanup(() => {
         observer.disconnect();
       });
       div.style.animationDuration = "200s";
     });
   });
 }, 'isRunningOnCompositor is true in MutationObserver callback');
 
 // This is to test that we don't temporarily clear the flag when forcing
 // an unthrottled sample.
-promise_test(function(t) {
+promise_test(t => {
   // Needs scrollbars to cause overflow.
   return SpecialPowers.pushPrefEnv({ set: [["ui.showHideScrollbars", 1]] })
-  .then(function() {
+  .then(() => {
     var div = addDiv(t, { style: 'animation: rotate 100s' });
     var animation = div.getAnimations()[0];
 
-    return animation.ready.then(function() {
-      return new Promise(function(resolve) {
+    return waitForPaints().then(() => {
+      return new Promise(resolve => {
         var timeAtStart = window.performance.now();
         function handleFrame() {
-          t.step(function() {
+          t.step(() => {
             assert_animation_is_running_on_compositor(animation,
               'Animation reports that it is running on the compositor'
                + ' in requestAnimationFrame callback');
           });
 
           // we have to wait at least 200ms because this animation is
           // unthrottled on every 200ms.
           // See https://hg.mozilla.org/mozilla-central/file/cafb1c90f794/layout/style/AnimationCommon.cpp#l863
@@ -263,698 +263,698 @@ promise_test(function(t) {
         }
         window.requestAnimationFrame(handleFrame);
       });
     });
   });
 }, 'isRunningOnCompositor remains true in requestAnimationFrameCallback for ' +
    'overflow animation');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'transition: opacity 100s; opacity: 1' });
 
   getComputedStyle(div).opacity;
 
   div.style.opacity = 0;
   var animation = div.getAnimations()[0];
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
        'Transition reports that it is running on the compositor'
        + ' during playback for opacity transition');
   });
 }, 'isRunningOnCompositor for transitions');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'animation: rotate-and-opacity 100s; ' +
                                'backface-visibility: hidden; ' +
                                'transform: none !important;' });
   var animation = div.getAnimations()[0];
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
        'If an animation has a property that can run on the compositor and a '
        + 'property that cannot (due to Gecko limitations) but where the latter'
        + 'property is overridden in the CSS cascade, the animation should '
        + 'still report that it is running on the compositor');
   });
 }, 'isRunningOnCompositor is true when a property that would otherwise block ' +
    'running on the compositor is overridden in the CSS cascade');
 
-promise_test(function(t) {
+promise_test(t => {
   var animation = addDivAndAnimate(t,
                                    {},
                                    { opacity: [ 0, 1 ] }, 200 * MS_PER_SEC);
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
       'Animation reports that it is running on the compositor');
 
     animation.currentTime = 150 * MS_PER_SEC;
     animation.effect.timing.duration = 100 * MS_PER_SEC;
 
     assert_animation_is_not_running_on_compositor(animation,
        'Animation reports that it is NOT running on the compositor'
        + ' when the animation is set a shorter duration than current time');
   });
 }, 'animation is immediately removed from compositor' +
    'when timing.duration is made shorter than the current time');
 
-promise_test(function(t) {
+promise_test(t => {
   var animation = addDivAndAnimate(t,
                                    {},
                                    { opacity: [ 0, 1 ] }, 100 * MS_PER_SEC);
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
       'Animation reports that it is running on the compositor');
 
     animation.currentTime = 500 * MS_PER_SEC;
 
     assert_animation_is_not_running_on_compositor(animation,
       'Animation reports that it is NOT running on the compositor'
       + ' when finished');
 
     animation.effect.timing.duration = 1000 * MS_PER_SEC;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_running_on_compositor(animation,
       'Animation reports that it is running on the compositor'
       + ' when restarted');
   });
 }, 'animation is added to compositor' +
    ' when timing.duration is made longer than the current time');
 
-promise_test(function(t) {
+promise_test(t => {
   var animation = addDivAndAnimate(t,
                                    {},
                                    { opacity: [ 0, 1 ] }, 100 * MS_PER_SEC);
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
       'Animation reports that it is running on the compositor');
 
     animation.effect.timing.endDelay = 100 * MS_PER_SEC;
 
     assert_animation_is_running_on_compositor(animation,
       'Animation reports that it is running on the compositor'
       + ' when endDelay is changed');
 
     animation.currentTime = 110 * MS_PER_SEC;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_not_running_on_compositor(animation,
       'Animation reports that it is NOT running on the compositor'
       + ' when currentTime is during endDelay');
   });
 }, 'animation is removed from compositor' +
    ' when current time is made longer than the duration even during endDelay');
 
-promise_test(function(t) {
+promise_test(t => {
   var animation = addDivAndAnimate(t,
                                    {},
                                    { opacity: [ 0, 1 ] }, 100 * MS_PER_SEC);
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
       'Animation reports that it is running on the compositor');
 
     animation.effect.timing.endDelay = -200 * MS_PER_SEC;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_not_running_on_compositor(animation,
       'Animation reports that it is NOT running on the compositor'
       + ' when endTime is negative value');
   });
 }, 'animation is removed from compositor' +
    ' when endTime is negative value');
 
-promise_test(function(t) {
+promise_test(t => {
   var animation = addDivAndAnimate(t,
                                    {},
                                    { opacity: [ 0, 1 ] }, 200 * MS_PER_SEC);
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
       'Animation reports that it is running on the compositor');
 
     animation.effect.timing.endDelay = -100 * MS_PER_SEC;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_running_on_compositor(animation,
       'Animation reports that it is running on the compositor'
       + ' when endTime is positive and endDelay is negative');
     animation.currentTime = 110 * MS_PER_SEC;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_not_running_on_compositor(animation,
       'Animation reports that it is NOT running on the compositor'
       + ' when currentTime is after endTime');
   });
 }, 'animation is NOT running on compositor' +
    ' when endTime is positive and endDelay is negative');
 
-promise_test(function(t) {
+promise_test(t => {
   var effect = new KeyframeEffect(null,
                                   { opacity: [ 0, 1 ] },
                                   100 * MS_PER_SEC);
   var animation = new Animation(effect, document.timeline);
   animation.play();
 
   var div = addDiv(t);
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_not_running_on_compositor(animation,
                   'Animation with null target reports that it is not running ' +
                   'on the compositor');
 
     animation.effect.target = div;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_running_on_compositor(animation,
                   'Animation reports that it is running on the compositor ' +
                   'after setting a valid target');
   });
 }, 'animation is added to the compositor when setting a valid target');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t);
   var animation = div.animate({ opacity: [ 0, 1 ] }, 100 * MS_PER_SEC);
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
                   'Animation reports that it is running on the compositor');
 
     animation.effect.target = null;
     assert_animation_is_not_running_on_compositor(animation,
                   'Animation reports that it is NOT running on the ' +
                   'compositor after setting null target');
   });
 }, 'animation is removed from the compositor when setting null target');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t);
   var animation = div.animate({ opacity: [ 0, 1 ] },
                               { duration: 100 * MS_PER_SEC,
                                 delay: 100 * MS_PER_SEC,
                                 fill: 'backwards' });
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
                   'Animation with fill:backwards in delay phase reports ' +
                   'that it is running on the compositor');
 
     animation.currentTime = 100 * MS_PER_SEC;
     return waitForFrame();
- }).then(function() {
+ }).then(() => {
     assert_animation_is_running_on_compositor(animation,
                   'Animation with fill:backwards in delay phase reports ' +
                   'that it is running on the compositor after delay phase');
   });
 }, 'animation with fill:backwards in delay phase is running on the ' +
    ' main-thread while it is in delay phase');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t);
   var animation = div.animate([{ opacity: 1, offset: 0 },
                                { opacity: 1, offset: 0.99 },
                                { opacity: 0, offset: 1 }], 100 * MS_PER_SEC);
 
   var another = addDiv(t);
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
                   'Opacity animation on a 100% opacity keyframe reports ' +
                   'that it is running on the compositor from the begining');
 
     animation.effect.target = another;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_running_on_compositor(animation,
                   'Opacity animation on a 100% opacity keyframe keeps ' +
                   'running on the compositor after changing the target ' +
                   'element');
   });
 }, '100% opacity animations with keeps running on the ' +
    'compositor after changing the target element');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t);
   var animation = div.animate({ color: ['red', 'black'] }, 100 * MS_PER_SEC);
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_not_running_on_compositor(animation,
                   'Color animation reports that it is not running on the ' +
                   'compositor');
 
     animation.effect.setKeyframes([{ opacity: 1, offset: 0 },
                                    { opacity: 1, offset: 0.99 },
                                    { opacity: 0, offset: 1 }]);
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_running_on_compositor(animation,
                   '100% opacity animation set by using setKeyframes reports ' +
                   'that it is running on the compositor');
   });
 }, '100% opacity animation set up by converting an existing animation with ' +
    'cannot be run on the compositor, is running on the compositor');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t);
   var animation = div.animate({ color: ['red', 'black'] }, 100 * MS_PER_SEC);
   var effect = new KeyframeEffect(div,
                                   [{ opacity: 1, offset: 0 },
                                    { opacity: 1, offset: 0.99 },
                                    { opacity: 0, offset: 1 }],
                                   100 * MS_PER_SEC);
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_not_running_on_compositor(animation,
                   'Color animation reports that it is not running on the ' +
                   'compositor');
 
     animation.effect = effect;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_running_on_compositor(animation,
                   '100% opacity animation set up by changing effects reports ' +
                   'that it is running on the compositor');
   });
 }, '100% opacity animation set up by changing the effects on an existing ' +
    'animation which cannot be run on the compositor, is running on the ' +
    'compositor');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: "opacity: 1 ! important" });
 
   var animation = div.animate({ opacity: [0, 1] }, 100 * MS_PER_SEC);
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_not_running_on_compositor(animation,
       'Opacity animation on an element which has 100% opacity style with ' +
       '!important flag reports that it is not running on the compositor');
     // Clear important flag from the opacity style on the target element.
     div.style.setProperty("opacity", "1", "");
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_running_on_compositor(animation,
       'Opacity animation reports that it is running on the compositor after '
       + 'clearing the !important flag');
   });
 }, 'Clearing *important* opacity style on the target element sends the ' +
    'animation to the compositor');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t);
   var lowerAnimation = div.animate({ opacity: [1, 0] }, 100 * MS_PER_SEC);
   var higherAnimation = div.animate({ opacity: [0, 1] }, 100 * MS_PER_SEC);
 
-  return Promise.all([lowerAnimation.ready, higherAnimation.ready]).then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(higherAnimation,
                   'A higher-priority opacity animation on an element ' +
                   'reports that it is running on the compositor');
     assert_animation_is_running_on_compositor(lowerAnimation,
                   'A lower-priority opacity animation on the same ' +
                   'element also reports that it is running on the compositor');
   });
 }, 'Opacity animations on the same element run on the compositor');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'transition: opacity 100s; opacity: 1' });
 
   getComputedStyle(div).opacity;
 
   div.style.opacity = 0;
   getComputedStyle(div).opacity;
 
   var transition = div.getAnimations()[0];
   var animation = div.animate({ opacity: [0, 1] }, 100 * MS_PER_SEC);
 
-  return Promise.all([transition.ready, animation.ready]).then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
                   'An opacity animation on an element reports that' +
                   'that it is running on the compositor');
     assert_animation_is_running_on_compositor(transition,
                   'An opacity transition on the same element reports that ' +
                   'it is running on the compositor');
   });
 }, 'Both of transition and script animation on the same element run on the ' +
    'compositor');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t);
   var importantOpacityElement = addDiv(t, { style: "opacity: 1 ! important" });
 
   var animation = div.animate({ opacity: [1, 0] }, 100 * MS_PER_SEC);
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
                   'Opacity animation on an element reports ' +
                   'that it is running on the compositor');
 
     animation.effect.target = null;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_not_running_on_compositor(animation,
                   'Animation is no longer running on the compositor after ' +
                   'removing from the element');
     animation.effect.target = importantOpacityElement;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_not_running_on_compositor(animation,
                   'Animation is NOT running on the compositor even after ' +
                   'being applied to a different element which has an ' +
                   '!important opacity declaration');
   });
 }, 'Animation continues not running on the compositor after being ' +
    'applied to an element which has an important declaration and ' +
    'having previously been temporarily associated with no target element');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t);
   var another = addDiv(t);
 
   var lowerAnimation = div.animate({ opacity: [1, 0] }, 100 * MS_PER_SEC);
   var higherAnimation = another.animate({ opacity: [0, 1] }, 100 * MS_PER_SEC);
 
-  return Promise.all([lowerAnimation.ready, higherAnimation.ready]).then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(lowerAnimation,
                   'An opacity animation on an element reports that ' +
                   'it is running on the compositor');
     assert_animation_is_running_on_compositor(higherAnimation,
                   'Opacity animation on a different element reports ' +
                   'that it is running on the compositor');
 
     lowerAnimation.effect.target = null;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_not_running_on_compositor(lowerAnimation,
                   'Animation is no longer running on the compositor after ' +
                   'being removed from the element');
     lowerAnimation.effect.target = another;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_running_on_compositor(lowerAnimation,
                   'A lower-priority animation begins running ' +
                   'on the compositor after being applied to an element ' +
                   'which has a higher-priority animation');
     assert_animation_is_running_on_compositor(higherAnimation,
                   'A higher-priority animation continues to run on the ' +
                   'compositor even after a lower-priority animation is ' +
                   'applied to the same element');
   });
 }, 'Animation begins running on the compositor after being applied ' +
    'to an element which has a higher-priority animation and after ' +
    'being temporarily associated with no target element');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t);
   var another = addDiv(t);
 
   var lowerAnimation = div.animate({ opacity: [1, 0] }, 100 * MS_PER_SEC);
   var higherAnimation = another.animate({ opacity: [0, 1] }, 100 * MS_PER_SEC);
 
-  return Promise.all([lowerAnimation.ready, higherAnimation.ready]).then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(lowerAnimation,
                   'An opacity animation on an element reports that ' +
                   'it is running on the compositor');
     assert_animation_is_running_on_compositor(higherAnimation,
                   'Opacity animation on a different element reports ' +
                   'that it is running on the compositor');
 
     higherAnimation.effect.target = null;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_not_running_on_compositor(higherAnimation,
                   'Animation is no longer running on the compositor after ' +
                   'being removed from the element');
     higherAnimation.effect.target = div;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_running_on_compositor(lowerAnimation,
                   'Animation continues running on the compositor after ' +
                   'a higher-priority animation applied to the same element');
     assert_animation_is_running_on_compositor(higherAnimation,
                   'A higher-priority animation begins to running on the ' +
                   'compositor after being applied to an element which has ' +
                   'a lower-priority-animation');
   });
 }, 'Animation begins running on the compositor after being applied ' +
    'to an element which has a lower-priority animation once after ' +
    'disassociating with an element');
 
 var delayPhaseTests = [
   {
     desc: 'script animation of opacity',
-    setupAnimation: function(t) {
+    setupAnimation: t => {
       return addDiv(t).animate(
         { opacity: [0, 1] },
         { delay: 100 * MS_PER_SEC, duration: 100 * MS_PER_SEC });
     },
   },
   {
     desc: 'script animation of transform',
-    setupAnimation: function(t) {
+    setupAnimation: t => {
       return addDiv(t).animate(
         { transform: ['translateX(0px)', 'translateX(100px)'] },
         { delay: 100 * MS_PER_SEC, duration: 100 * MS_PER_SEC });
     },
   },
   {
     desc: 'CSS animation of opacity',
-    setupAnimation: function(t) {
+    setupAnimation: t => {
       return addDiv(t, { style: 'animation: opacity 100s 100s' })
         .getAnimations()[0];
     },
   },
   {
     desc: 'CSS animation of transform',
-    setupAnimation: function(t) {
+    setupAnimation: t => {
       return addDiv(t, { style: 'animation: anim 100s 100s' })
         .getAnimations()[0];
     },
   },
   {
     desc: 'CSS transition of opacity',
-    setupAnimation: function(t) {
+    setupAnimation: t => {
       var div = addDiv(t, { style: 'transition: opacity 100s 100s' });
       getComputedStyle(div).opacity;
 
       div.style.opacity = 0;
       return div.getAnimations()[0];
     },
   },
   {
     desc: 'CSS transition of transform',
-    setupAnimation: function(t) {
+    setupAnimation: t => {
       var div = addDiv(t, { style: 'transition: transform 100s 100s' });
       getComputedStyle(div).transform;
 
       div.style.transform = 'translateX(100px)';
       return div.getAnimations()[0];
     },
   },
 ];
 
-delayPhaseTests.forEach(function(test) {
-  promise_test(function(t) {
+delayPhaseTests.forEach(test => {
+  promise_test(t => {
     var animation = test.setupAnimation(t);
 
-    return animation.ready.then(function() {
+    return waitForPaints().then(() => {
       assert_animation_is_running_on_compositor(animation,
          test.desc + ' reports that it is running on the '
          + 'compositor even though it is in the delay phase');
     });
   }, 'isRunningOnCompositor for ' + test.desc + ' is true even though ' +
      'it is in the delay phase');
 });
 
 // The purpose of thie test cases is to check that
 // NS_FRAME_MAY_BE_TRANSFORMED flag on the associated nsIFrame persists
 // after transform style on the frame is removed.
 var delayPhaseWithTransformStyleTests = [
   {
     desc: 'script animation of transform with transform style',
-    setupAnimation: function(t) {
+    setupAnimation: t => {
       return addDiv(t, { style: 'transform: translateX(10px)' }).animate(
         { transform: ['translateX(0px)', 'translateX(100px)'] },
         { delay: 100 * MS_PER_SEC, duration: 100 * MS_PER_SEC });
     },
   },
   {
     desc: 'CSS animation of transform with transform style',
-    setupAnimation: function(t) {
+    setupAnimation: t => {
       return addDiv(t, { style: 'animation: anim 100s 100s;' +
                                 'transform: translateX(10px)' })
         .getAnimations()[0];
     },
   },
   {
     desc: 'CSS transition of transform with transform style',
-    setupAnimation: function(t) {
+    setupAnimation: t => {
       var div = addDiv(t, { style: 'transition: transform 100s 100s;' +
                                    'transform: translateX(10px)'});
       getComputedStyle(div).transform;
 
       div.style.transform = 'translateX(100px)';
       return div.getAnimations()[0];
     },
   },
 ];
 
-delayPhaseWithTransformStyleTests.forEach(function(test) {
-  promise_test(function(t) {
+delayPhaseWithTransformStyleTests.forEach(test => {
+  promise_test(t => {
     var animation = test.setupAnimation(t);
 
-    return animation.ready.then(function() {
+    return waitForPaints().then(() => {
       assert_animation_is_running_on_compositor(animation,
          test.desc + ' reports that it is running on the '
          + 'compositor even though it is in the delay phase');
-    }).then(function() {
+    }).then(() => {
       // Remove the initial transform style during delay phase.
       animation.effect.target.style.transform = 'none';
       return animation.ready;
-    }).then(function() {
+    }).then(() => {
       assert_animation_is_running_on_compositor(animation,
          test.desc + ' reports that it keeps running on the '
          + 'compositor after removing the initial transform style');
     });
   }, 'isRunningOnCompositor for ' + test.desc + ' is true after removing ' +
      'the initial transform style during the delay phase');
 });
 
 var startsWithNoneTests = [
   {
     desc: 'script animation of transform starts with transform:none segment',
-    setupAnimation: function(t) {
+    setupAnimation: t => {
       return addDiv(t).animate(
         { transform: ['none', 'none', 'translateX(100px)'] }, 100 * MS_PER_SEC);
     },
   },
   {
     desc: 'CSS animation of transform starts with transform:none segment',
-    setupAnimation: function(t) {
+    setupAnimation: t => {
       return addDiv(t,
         { style: 'animation: transform-starts-with-none 100s 100s' })
           .getAnimations()[0];
     },
   },
 ];
 
-startsWithNoneTests.forEach(function(test) {
-  promise_test(function(t) {
+startsWithNoneTests.forEach(test => {
+  promise_test(t => {
     var animation = test.setupAnimation(t);
 
-    return animation.ready.then(function() {
+    return waitForPaints().then(() => {
       assert_animation_is_running_on_compositor(animation,
          test.desc + ' reports that it is running on the '
          + 'compositor even though it is in transform:none segment');
     });
   }, 'isRunningOnCompositor for ' + test.desc + ' is true even though ' +
      'it is in transform:none segment');
 });
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'opacity: 1 ! important' });
 
   var animation = div.animate(
     { opacity: [0, 1] },
     { delay: 100 * MS_PER_SEC, duration: 100 * MS_PER_SEC });
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_not_running_on_compositor(animation,
       'Opacity animation on an element which has opacity:1 important style'
       + 'reports that it is not running on the compositor');
     // Clear the opacity style on the target element.
     div.style.setProperty("opacity", "1", "");
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_running_on_compositor(animation,
       'Opacity animations reports that it is running on the compositor after '
       + 'clearing the opacity style on the element');
   });
 }, 'Clearing *important* opacity style on the target element sends the ' +
    'animation to the compositor even if the animation is in the delay phase');
 
-promise_test(function(t) {
+promise_test(t => {
   var opaqueDiv = addDiv(t, { style: 'opacity: 1 ! important' });
   var anotherDiv = addDiv(t);
 
   var animation = opaqueDiv.animate(
     { opacity: [0, 1] },
     { delay: 100 * MS_PER_SEC, duration: 100 * MS_PER_SEC });
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_not_running_on_compositor(animation,
       'Opacity animation on an element which has opacity:1 important style'
       + 'reports that it is not running on the compositor');
     // Changing target element to another element which has no opacity style.
     animation.effect.target = anotherDiv;
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_running_on_compositor(animation,
       'Opacity animations reports that it is running on the compositor after '
       + 'changing the target element to another elemenent having no '
       + 'opacity style');
   });
 }, 'Changing target element of opacity animation sends the animation to the ' +
    'the compositor even if the animation is in the delay phase');
 
-promise_test(function(t) {
+promise_test(t => {
   var animation =
     addDivAndAnimate(t,
                      {},
                      { width: ['100px', '200px'] },
                      { duration: 100 * MS_PER_SEC, delay: 100 * MS_PER_SEC });
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_not_running_on_compositor(animation,
       'Width animation reports that it is not running on the compositor '
       + 'in the delay phase');
     // Changing to property runnable on the compositor.
     animation.effect.setKeyframes({ opacity: [0, 1] });
     return waitForFrame();
-  }).then(function() {
+  }).then(() => {
     assert_animation_is_running_on_compositor(animation,
       'Opacity animation reports that it is running on the compositor '
       + 'after changing the property from width property in the delay phase');
   });
 }, 'Dynamic change to a property runnable on the compositor ' +
    'in the delay phase');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'transition: opacity 100s; ' +
                                'opacity: 0 !important' });
   getComputedStyle(div).opacity;
 
   div.style.setProperty('opacity', '1', 'important');
   getComputedStyle(div).opacity;
 
   var animation = div.getAnimations()[0];
 
-  return animation.ready.then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_running_on_compositor(animation,
        'Transition reports that it is running on the compositor even if the ' +
        'property is overridden by an !important rule');
   });
 }, 'Transitions override important rules');
 
-promise_test(function(t) {
+promise_test(t => {
   var div = addDiv(t, { style: 'transition: opacity 100s; ' +
                                'opacity: 0 !important' });
   getComputedStyle(div).opacity;
 
   div.animate({ opacity: [ 0, 1 ] }, 100 * MS_PER_SEC);
 
   div.style.setProperty('opacity', '1', 'important');
   getComputedStyle(div).opacity;
 
   var [transition, animation] = div.getAnimations();
 
-  return Promise.all([transition.ready, animation.ready]).then(function() {
+  return waitForPaints().then(() => {
     assert_animation_is_not_running_on_compositor(transition,
        'Transition suppressed by an animation which is overridden by an ' +
        '!important rule reports that it is NOT running on the compositor');
     assert_animation_is_not_running_on_compositor(animation,
        'Animation overridden by an !important rule reports that it is ' +
        'NOT running on the compositor');
   });
 }, 'Neither transition nor animation does run on the compositor if the ' +
--- a/dom/animation/test/css-animations/file_event-order.html
+++ b/dom/animation/test/css-animations/file_event-order.html
@@ -33,125 +33,126 @@ events (${expectedEvents.map(event => ev
                   'Event target should match');
     assert_equals(expectedEvents[i][2], actualEvent.elapsedTime,
                   'Event\'s elapsed time should match');
   });
 }
 
 function setupAnimation(t, animationStyle, receiveEvents) {
   const div = addDiv(t, { style: "animation: " + animationStyle });
-  const watcher = new EventWatcher(t, div, [ 'animationstart',
-                                             'animationiteration',
-                                             'animationend' ]);
 
   ['start', 'iteration', 'end'].forEach(name => {
     div['onanimation' + name] = evt => {
     receiveEvents.push({ type:        evt.type,
                          target:      evt.target,
                          elapsedTime: evt.elapsedTime });
     };
   });
 
+  const watcher = new EventWatcher(t, div, [ 'animationstart',
+                                             'animationiteration',
+                                             'animationend' ]);
+
   const animation = div.getAnimations()[0];
 
   return [animation, watcher, div];
 }
 
-promise_test(function(t) {
+promise_test(t => {
   let events = [];
   const [animation1, watcher1, div1] =
     setupAnimation(t, 'anim 100s 2 paused', events);
   const [animation2, watcher2, div2] =
     setupAnimation(t, 'anim 100s 2 paused', events);
 
   return Promise.all([ watcher1.wait_for('animationstart'),
-                       watcher2.wait_for('animationstart') ]).then(function() {
+                       watcher2.wait_for('animationstart') ]).then(() => {
     checkEvents(events, ['animationstart', div1, 0],
                         ['animationstart', div2, 0]);
 
     events.length = 0;  // Clear received event array
 
     animation1.currentTime = 100 * MS_PER_SEC;
     animation2.currentTime = 100 * MS_PER_SEC;
     return Promise.all([ watcher1.wait_for('animationiteration'),
                          watcher2.wait_for('animationiteration') ]);
-  }).then(function() {
+  }).then(() => {
     checkEvents(events, ['animationiteration', div1, 100],
                         ['animationiteration', div2, 100]);
 
     events.length = 0;  // Clear received event array
 
     animation1.finish();
     animation2.finish();
 
     return Promise.all([ watcher1.wait_for('animationend'),
                          watcher2.wait_for('animationend') ]);
-  }).then(function() {
+  }).then(() => {
     checkEvents(events, ['animationend', div1, 200],
                         ['animationend', div2, 200]);
   });
 }, 'Test same events are ordered by elements.');
 
-promise_test(function(t) {
+promise_test(t => {
   let events = [];
   const [animation1, watcher1, div1] =
     setupAnimation(t, 'anim 200s 400s', events);
   const [animation2, watcher2, div2] =
     setupAnimation(t, 'anim 300s 2', events);
 
-  return watcher2.wait_for('animationstart').then(function(evt) {
+  return watcher2.wait_for('animationstart').then(evt => {
     animation1.currentTime = 400 * MS_PER_SEC;
     animation2.currentTime = 400 * MS_PER_SEC;
 
     events.length = 0;  // Clear received event array
 
     return Promise.all([ watcher1.wait_for('animationstart'),
                          watcher2.wait_for('animationiteration') ]);
-  }).then(function() {
+  }).then(() => {
     checkEvents(events, ['animationiteration', div2, 300],
                         ['animationstart',     div1, 0]);
   });
 }, 'Test start and iteration events are ordered by time.');
 
-promise_test(function(t) {
+promise_test(t => {
   let events = [];
   const [animation1, watcher1, div1] =
     setupAnimation(t, 'anim 150s', events);
   const [animation2, watcher2, div2] =
     setupAnimation(t, 'anim 100s 2', events);
 
   return Promise.all([ watcher1.wait_for('animationstart'),
-                       watcher2.wait_for('animationstart') ]).then(function() {
+                       watcher2.wait_for('animationstart') ]).then(() => {
     animation1.currentTime = 150 * MS_PER_SEC;
     animation2.currentTime = 150 * MS_PER_SEC;
 
     events.length = 0;  // Clear received event array
 
     return Promise.all([ watcher1.wait_for('animationend'),
                          watcher2.wait_for('animationiteration') ]);
-  }).then(function() {
+  }).then(() => {
     checkEvents(events, ['animationiteration', div2, 100],
                         ['animationend',       div1, 150]);
   });
 }, 'Test iteration and end events are ordered by time.');
 
-promise_test(function(t) {
+promise_test(t => {
   let events = [];
   const [animation1, watcher1, div1] =
     setupAnimation(t, 'anim 100s 100s', events);
   const [animation2, watcher2, div2] =
     setupAnimation(t, 'anim 100s 2', events);
 
   animation1.finish();
   animation2.finish();
 
   return Promise.all([ watcher1.wait_for([ 'animationstart',
                                            'animationend' ]),
                        watcher2.wait_for([ 'animationstart',
-                                           'animationend' ]) ]).then(function() {
+                                           'animationend' ]) ]).then(() => {
     checkEvents(events, ['animationstart', div2, 0],
                         ['animationstart', div1, 0],
                         ['animationend',   div1, 100],
                         ['animationend',   div2, 200]);
   });
 }, 'Test start and end events are sorted correctly when fired simultaneously');
 
 done();
--- a/dom/animation/test/testcommon.js
+++ b/dom/animation/test/testcommon.js
@@ -362,8 +362,18 @@ function addSVGElement(target, tag, attr
  */
 function getDistance(target, prop, v1, v2) {
   if (!target) {
     return 0.0;
   }
   return SpecialPowers.DOMWindowUtils
            .computeAnimationDistance(target, prop, v1, v2);
 }
+
+/*
+ * A promise wrapper for waiting MozAfterPaint.
+ */
+function waitForPaints() {
+  // FIXME: Bug 1415065. Instead waiting for two requestAnimationFrames, we
+  // should wait for MozAfterPaint once after MozAfterPaint is fired properly
+  // (bug 1341294).
+  return waitForAnimationFrames(2);
+}
--- a/dom/base/RangeBoundary.h
+++ b/dom/base/RangeBoundary.h
@@ -6,16 +6,18 @@
 
 #ifndef mozilla_RangeBoundary_h
 #define mozilla_RangeBoundary_h
 
 #include "nsCOMPtr.h"
 #include "nsIContent.h"
 #include "mozilla/Maybe.h"
 
+class nsRange;
+
 namespace mozilla {
 
 // This class will maintain a reference to the child immediately
 // before the boundary's offset. We try to avoid computing the
 // offset as much as possible and just ensure mRef points to the
 // correct child.
 //
 // mParent
@@ -38,16 +40,20 @@ typedef RangeBoundaryBase<nsINode*, nsIC
 // pointers and one using raw pointers. This helps us avoid unnecessary
 // AddRef/Release calls.
 template<typename ParentType, typename RefType>
 class RangeBoundaryBase
 {
   template<typename T, typename U>
   friend class RangeBoundaryBase;
 
+  // nsRange needs to use InvalidOffset() which requires mRef initialized
+  // before it's called.
+  friend class ::nsRange;
+
   friend void ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback&,
                                           RangeBoundary&, const char*,
                                           uint32_t);
   friend void ImplCycleCollectionUnlink(RangeBoundary&);
 
 public:
   RangeBoundaryBase(nsINode* aContainer, nsIContent* aRef)
     : mParent(aContainer)
@@ -62,32 +68,38 @@ public:
     }
   }
 
   RangeBoundaryBase(nsINode* aContainer, int32_t aOffset)
     : mParent(aContainer)
     , mRef(nullptr)
     , mOffset(mozilla::Some(aOffset))
   {
-    if (mParent && mParent->IsContainerNode()) {
-      // Find a reference node
-      if (aOffset == static_cast<int32_t>(aContainer->GetChildCount())) {
-        mRef = aContainer->GetLastChild();
-      } else if (aOffset != 0) {
-        mRef = mParent->GetChildAt(aOffset - 1);
-      }
-
-      NS_WARNING_ASSERTION(mRef || aOffset == 0,
-                           "Constructing RangeBoundary with invalid value");
+    if (!mParent) {
+      mOffset.reset();
     }
-
-    NS_WARNING_ASSERTION(!mRef || mRef->GetParentNode() == mParent,
-                         "Constructing RangeBoundary with invalid value");
   }
 
+protected:
+  RangeBoundaryBase(nsINode* aContainer, nsIContent* aRef, int32_t aOffset)
+    : mParent(aContainer)
+    , mRef(aRef)
+    , mOffset(mozilla::Some(aOffset))
+  {
+    MOZ_RELEASE_ASSERT(aContainer,
+      "This constructor shouldn't be used when pointing nowhere");
+    if (!mRef) {
+      MOZ_ASSERT(mOffset.value() == 0);
+      return;
+    }
+    MOZ_ASSERT(mOffset.value() > 0);
+    MOZ_ASSERT(mParent->GetChildAt(mOffset.value() - 1) == mRef);
+  }
+
+public:
   RangeBoundaryBase()
     : mParent(nullptr)
     , mRef(nullptr)
   {
   }
 
   // Needed for initializing RawRangeBoundary from an existing RangeBoundary.
   template<typename PT, typename RT>
@@ -96,96 +108,196 @@ public:
     , mRef(aOther.mRef)
     , mOffset(aOther.mOffset)
   {
   }
 
   nsIContent*
   Ref() const
   {
+    EnsureRef();
     return mRef;
   }
 
   nsINode*
   Container() const
   {
     return mParent;
   }
 
   nsIContent*
   GetChildAtOffset() const
   {
     if (!mParent || !mParent->IsContainerNode()) {
       return nullptr;
     }
+    EnsureRef();
     if (!mRef) {
       MOZ_ASSERT(Offset() == 0, "invalid RangeBoundary");
       return mParent->GetFirstChild();
     }
     MOZ_ASSERT(mParent->GetChildAt(Offset()) == mRef->GetNextSibling());
     return mRef->GetNextSibling();
   }
 
+  /**
+   * GetNextSiblingOfChildOffset() returns next sibling of a child at offset.
+   * If this refers after the last child or the container cannot have children,
+   * this returns nullptr with warning.
+   */
+  nsIContent*
+  GetNextSiblingOfChildAtOffset() const
+  {
+    if (NS_WARN_IF(!mParent) || NS_WARN_IF(!mParent->IsContainerNode())) {
+      return nullptr;
+    }
+    EnsureRef();
+    if (NS_WARN_IF(!mRef->GetNextSibling())) {
+      // Already referring the end of the container.
+      return nullptr;
+    }
+    return mRef->GetNextSibling()->GetNextSibling();
+  }
+
+  /**
+   * GetPreviousSiblingOfChildAtOffset() returns previous sibling of a child
+   * at offset.  If this refers the first child or the container cannot have
+   * children, this returns nullptr with warning.
+   */
+  nsIContent*
+  GetPreviousSiblingOfChildAtOffset() const
+  {
+    if (NS_WARN_IF(!mParent) || NS_WARN_IF(!mParent->IsContainerNode())) {
+      return nullptr;
+    }
+    EnsureRef();
+    if (NS_WARN_IF(!mRef)) {
+      // Already referring the start of the container.
+      return nullptr;
+    }
+    return mRef;
+  }
+
   uint32_t
   Offset() const
   {
     if (mOffset.isSome()) {
       return mOffset.value();
     }
-
     if (!mParent) {
+      MOZ_ASSERT(!mRef);
       return 0;
     }
-
+    MOZ_ASSERT(mParent->IsContainerNode(),
+      "If the container cannot have children, mOffset.isSome() should be true");
     MOZ_ASSERT(mRef);
     MOZ_ASSERT(mRef->GetParentNode() == mParent);
+    if (!mRef->GetPreviousSibling()) {
+      mOffset = mozilla::Some(1);
+      return mOffset.value();
+    }
+    if (!mRef->GetNextSibling()) {
+      mOffset = mozilla::Some(mParent->GetChildCount());
+      return mOffset.value();
+    }
+    // Use nsINode::IndexOf() as the last resort due to being expensive.
     mOffset = mozilla::Some(mParent->IndexOf(mRef) + 1);
-
     return mOffset.value();
   }
 
   void
-  InvalidateOffset()
-  {
-    MOZ_ASSERT(mParent);
-    MOZ_ASSERT(mParent->IsContainerNode(), "Range is positioned on a text node!");
-
-    if (!mRef) {
-      MOZ_ASSERT(mOffset.isSome() && mOffset.value() == 0,
-                 "Invalidating offset of invalid RangeBoundary?");
-      return;
-    }
-    mOffset.reset();
-  }
-
-  void
   Set(nsINode* aContainer, int32_t aOffset)
   {
     mParent = aContainer;
-    if (mParent && mParent->IsContainerNode()) {
-      // Find a reference node
-      if (aOffset == static_cast<int32_t>(aContainer->GetChildCount())) {
-        mRef = aContainer->GetLastChild();
-      } else if (aOffset == 0) {
-        mRef = nullptr;
+    mRef = nullptr;
+    mOffset = mozilla::Some(aOffset);
+  }
+
+  /**
+   * AdvanceOffset() tries to reference next sibling of mRef if its container
+   * can have children or increments offset if the container is a text node or
+   * something.
+   * If the container can have children and there is no next sibling, this
+   * outputs warning and does nothing.  So, callers need to check if there is
+   * next sibling which you need to refer.
+   */
+  void
+  AdvanceOffset()
+  {
+    if (NS_WARN_IF(!mParent)) {
+      return;
+    }
+    EnsureRef();
+    if (!mRef) {
+      if (!mParent->IsContainerNode()) {
+        // In text node or something, just increment the offset.
+        MOZ_ASSERT(mOffset.isSome());
+        if (NS_WARN_IF(mOffset.value() == mParent->Length())) {
+          // Already referring the end of the node.
+          return;
+        }
+        mOffset = mozilla::Some(mOffset.value() + 1);
+        return;
+      }
+      mRef = mParent->GetFirstChild();
+      if (NS_WARN_IF(!mRef)) {
+        // No children in the container.
+        mOffset = mozilla::Some(0);
       } else {
-        mRef = mParent->GetChildAt(aOffset - 1);
-        MOZ_ASSERT(mRef);
+        mOffset = mozilla::Some(1);
       }
-
-      NS_WARNING_ASSERTION(mRef || aOffset == 0,
-                           "Setting RangeBoundary to invalid value");
-    } else {
-      mRef = nullptr;
+      return;
     }
 
-    mOffset = mozilla::Some(aOffset);
+    nsIContent* nextSibling = mRef->GetNextSibling();
+    if (NS_WARN_IF(!nextSibling)) {
+      // Already referring the end of the container.
+      return;
+    }
+    mRef = nextSibling;
+    if (mOffset.isSome()) {
+      mOffset = mozilla::Some(mOffset.value() + 1);
+    }
+  }
 
-    NS_WARNING_ASSERTION(!mRef || mRef->GetParentNode() == mParent,
-                         "Setting RangeBoundary to invalid value");
+  /**
+   * RewindOffset() tries to reference next sibling of mRef if its container
+   * can have children or decrements offset if the container is a text node or
+   * something.
+   * If the container can have children and there is no next previous, this
+   * outputs warning and does nothing.  So, callers need to check if there is
+   * previous sibling which you need to refer.
+   */
+  void
+  RewindOffset()
+  {
+    if (NS_WARN_IF(!mParent)) {
+      return;
+    }
+    EnsureRef();
+    if (!mRef) {
+      if (NS_WARN_IF(mParent->IsContainerNode())) {
+        // Already referring the start of the container
+        mOffset = mozilla::Some(0);
+        return;
+      }
+      // In text node or something, just decrement the offset.
+      MOZ_ASSERT(mOffset.isSome());
+      if (NS_WARN_IF(mOffset.value() == 0)) {
+        // Already referring the start of the node.
+        return;
+      }
+      mOffset = mozilla::Some(mOffset.value() - 1);
+      return;
+    }
+
+    mRef = mRef->GetPreviousSibling();
+    if (mOffset.isSome()) {
+      mOffset = mozilla::Some(mOffset.value() - 1);
+    }
   }
 
   void
   SetAfterRef(nsINode* aParent, nsIContent* aRef)
   {
     mParent = aParent;
     mRef = aRef;
     if (!mRef) {
@@ -203,20 +315,23 @@ public:
 
   bool
   IsSetAndValid() const
   {
     if (!IsSet()) {
       return false;
     }
 
-    if (Ref()) {
-      return Ref()->GetParentNode() == Container();
+    if (mRef && mRef->GetParentNode() != mParent) {
+      return false;
     }
-    return Offset() <= Container()->Length();
+    if (mOffset.isSome() && mOffset.value() > mParent->Length()) {
+      return false;
+    }
+    return true;
   }
 
   bool
   IsStartOfContainer() const
   {
     // We're at the first point in the container if we don't have a reference,
     // and our offset is 0. If we don't have a Ref, we should already have an
     // offset, so we can just directly fetch it.
@@ -260,19 +375,60 @@ public:
   }
 
   template<typename A, typename B>
   bool operator!=(const RangeBoundaryBase<A, B>& aOther) const
   {
     return !(*this == aOther);
   }
 
+protected:
+  /**
+   * InvalidOffset() is error prone method, unfortunately.  If somebody
+   * needs to call this method, it needs to call EnsureRef() before changing
+   * the position of the referencing point.
+   */
+  void
+  InvalidateOffset()
+  {
+    MOZ_ASSERT(mParent);
+    MOZ_ASSERT(mParent->IsContainerNode(),
+               "Range is positioned on a text node!");
+    MOZ_ASSERT(mRef || (mOffset.isSome() && mOffset.value() == 0),
+               "mRef should be computed before a call of InvalidateOffset()");
+
+    if (!mRef) {
+      return;
+    }
+    mOffset.reset();
+  }
+
+  void
+  EnsureRef() const
+  {
+    if (mRef) {
+      return;
+    }
+    if (!mParent) {
+      MOZ_ASSERT(!mOffset.isSome());
+      return;
+    }
+    MOZ_ASSERT(mOffset.isSome());
+    MOZ_ASSERT(mOffset.value() <= mParent->Length());
+    if (!mParent->IsContainerNode() ||
+        mOffset.value() == 0) {
+      return;
+    }
+    mRef = mParent->GetChildAt(mOffset.value() - 1);
+    MOZ_ASSERT(mRef);
+  }
+
 private:
   ParentType mParent;
-  RefType mRef;
+  mutable RefType mRef;
 
   mutable mozilla::Maybe<uint32_t> mOffset;
 };
 
 inline void
 ImplCycleCollectionUnlink(RangeBoundary& aField)
 {
   ImplCycleCollectionUnlink(aField.mParent);
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -10636,23 +10636,31 @@ void nsGlobalWindow::SetIsBackground(boo
 
   if (inner && changed) {
     inner->mTimeoutManager->UpdateBackgroundState();
   }
 
   if (aIsBackground) {
     // Notify gamepadManager we are at the background window,
     // we need to stop vibrate.
-    if (inner) {
+    // Stop the vr telemery time spent when it switches to
+    // the background window.
+    if (inner && changed) {
       inner->StopGamepadHaptics();
+      // true is for asking to set the delta time to
+      // the telemetry.
+      inner->ResetVRTelemetry(true);
     }
     return;
   }
 
   if (inner) {
+    // When switching to be as a top tab, restart the telemetry.
+    // false is for only resetting the timestamp.
+    inner->ResetVRTelemetry(false);
     inner->SyncGamepadState();
   }
 }
 
 void
 nsGlobalWindow::SetIsBackgroundInternal(bool aIsBackground)
 {
   if (mIsBackground != aIsBackground) {
@@ -10719,16 +10727,24 @@ nsGlobalWindow::DisableVRUpdates()
   MOZ_ASSERT(IsInnerWindow());
   if (mVREventObserver) {
     mVREventObserver->DisconnectFromOwner();
     mVREventObserver = nullptr;
   }
 }
 
 void
+nsGlobalWindow::ResetVRTelemetry(bool aUpdate)
+{
+  if (mVREventObserver) {
+    mVREventObserver->UpdateSpentTimeIn2DTelemetry(aUpdate);
+  }
+}
+
+void
 nsGlobalWindow::SetChromeEventHandler(EventTarget* aChromeEventHandler)
 {
   MOZ_ASSERT(IsOuterWindow());
 
   SetChromeEventHandlerInternal(aChromeEventHandler);
   // update the chrome event handler on all our inner windows
   for (nsGlobalWindow *inner = (nsGlobalWindow *)PR_LIST_HEAD(this);
        inner != this;
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -768,16 +768,20 @@ public:
   // Enable/disable updates for gamepad input.
   void EnableGamepadUpdates();
   void DisableGamepadUpdates();
 
   // Inner windows only.
   // Enable/disable updates for VR
   void EnableVRUpdates();
   void DisableVRUpdates();
+  // Reset telemetry data when switching windows.
+  // aUpdate, true for accumulating the result to the histogram.
+  // false for only resetting the timestamp.
+  void ResetVRTelemetry(bool aUpdate);
 
   // Update the VR displays for this window
   bool UpdateVRDisplays(nsTArray<RefPtr<mozilla::dom::VRDisplay>>& aDisplays);
 
   // Inner windows only.
   // Called to inform that the set of active VR displays has changed.
   void NotifyActiveVRDisplaysChanged();
 
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -1015,16 +1015,24 @@ nsRange::DoSetRange(const RawRangeBounda
     (mStart.Container() != aStart.Container() || mEnd.Container() != aEnd.Container()) &&
     IsInSelection() && !aNotInsertedYet;
 
   // GetCommonAncestor is unreliable while we're unlinking (could
   // return null if our start/end have already been unlinked), so make
   // sure to not use it here to determine our "old" current ancestor.
   mStart = aStart;
   mEnd = aEnd;
+
+  // If RangeBoundary is initialized with a container node and offset in it,
+  // its mRef may not have been initialized yet.  However, nsRange will need to
+  // adjust the offset when the node position is changed.  In such case,
+  // RangeBoundary::mRef needs to be initialized for recomputing offset later.
+  mStart.EnsureRef();
+  mEnd.EnsureRef();
+
   mIsPositioned = !!mStart.Container();
   if (checkCommonAncestor) {
     nsINode* oldCommonAncestor = mRegisteredCommonAncestor;
     nsINode* newCommonAncestor = GetCommonAncestor();
     if (newCommonAncestor != oldCommonAncestor) {
       if (oldCommonAncestor) {
         UnregisterCommonAncestor(oldCommonAncestor, false);
       }
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -13,17 +13,16 @@
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/dom/MediaEncryptedEvent.h"
 #include "mozilla/EMEUtils.h"
 #include "mozilla/Sprintf.h"
 
 #include "base/basictypes.h"
 #include "nsIDOMHTMLMediaElement.h"
-#include "nsIDOMHTMLSourceElement.h"
 #include "TimeRanges.h"
 #include "nsGenericHTMLElement.h"
 #include "nsAttrValueInlines.h"
 #include "nsDocShellLoadTypes.h"
 #include "nsPresContext.h"
 #include "nsIClassOfService.h"
 #include "nsIPresShell.h"
 #include "nsGkAtoms.h"
--- a/dom/html/HTMLSourceElement.cpp
+++ b/dom/html/HTMLSourceElement.cpp
@@ -30,31 +30,20 @@ HTMLSourceElement::HTMLSourceElement(alr
 
 HTMLSourceElement::~HTMLSourceElement()
 {
 }
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLSourceElement, nsGenericHTMLElement,
                                    mSrcMediaSource)
 
-NS_IMPL_ADDREF_INHERITED(HTMLSourceElement, nsGenericHTMLElement)
-NS_IMPL_RELEASE_INHERITED(HTMLSourceElement, nsGenericHTMLElement)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(HTMLSourceElement)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLSourceElement)
-NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
+NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(HTMLSourceElement, nsGenericHTMLElement)
 
 NS_IMPL_ELEMENT_CLONE(HTMLSourceElement)
 
-NS_IMPL_URI_ATTR(HTMLSourceElement, Src, src)
-NS_IMPL_STRING_ATTR(HTMLSourceElement, Type, type)
-NS_IMPL_STRING_ATTR(HTMLSourceElement, Srcset, srcset)
-NS_IMPL_STRING_ATTR(HTMLSourceElement, Sizes, sizes)
-NS_IMPL_STRING_ATTR(HTMLSourceElement, Media, media)
-
 bool
 HTMLSourceElement::MatchesCurrentMedia()
 {
   if (mMediaList) {
     nsIPresShell* presShell = OwnerDoc()->GetShell();
     nsPresContext* pctx = presShell ? presShell->GetPresContext() : nullptr;
     return pctx && mMediaList->Matches(pctx);
   }
--- a/dom/html/HTMLSourceElement.h
+++ b/dom/html/HTMLSourceElement.h
@@ -3,43 +3,38 @@
 /* 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/. */
 
 #ifndef mozilla_dom_HTMLSourceElement_h
 #define mozilla_dom_HTMLSourceElement_h
 
 #include "mozilla/Attributes.h"
-#include "nsIDOMHTMLSourceElement.h"
 #include "nsGenericHTMLElement.h"
 #include "mozilla/dom/HTMLMediaElement.h"
 
 class nsAttrValue;
 
 namespace mozilla {
 namespace dom {
 
 class MediaList;
 
-class HTMLSourceElement final : public nsGenericHTMLElement,
-                                public nsIDOMHTMLSourceElement
+class HTMLSourceElement final : public nsGenericHTMLElement
 {
 public:
   explicit HTMLSourceElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLSourceElement,
                                            nsGenericHTMLElement)
 
   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLSourceElement, source)
 
-  // nsIDOMHTMLSourceElement
-  NS_DECL_NSIDOMHTMLSOURCEELEMENT
-
   virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
                          bool aPreallocateChildren) const override;
 
   // Override BindToTree() so that we can trigger a load when we add a
   // child source element.
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               bool aCompileEventHandlers) override;
--- a/dom/html/HTMLVideoElement.cpp
+++ b/dom/html/HTMLVideoElement.cpp
@@ -1,15 +1,14 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsIDOMHTMLSourceElement.h"
 #include "mozilla/dom/HTMLVideoElement.h"
 #include "mozilla/dom/HTMLVideoElementBinding.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsSize.h"
 #include "nsError.h"
 #include "nsNodeInfoManager.h"
 #include "plbase64.h"
--- a/dom/interfaces/html/moz.build
+++ b/dom/interfaces/html/moz.build
@@ -15,17 +15,16 @@ XPIDL_SOURCES += [
     'nsIDOMHTMLFormElement.idl',
     'nsIDOMHTMLHtmlElement.idl',
     'nsIDOMHTMLInputElement.idl',
     'nsIDOMHTMLMediaElement.idl',
     'nsIDOMHTMLOptionElement.idl',
     'nsIDOMHTMLOptionsCollection.idl',
     'nsIDOMHTMLScriptElement.idl',
     'nsIDOMHTMLSelectElement.idl',
-    'nsIDOMHTMLSourceElement.idl',
     'nsIDOMMozBrowserFrame.idl',
     'nsIDOMTimeRanges.idl',
     'nsIDOMValidityState.idl',
     'nsIMozBrowserFrame.idl',
 ]
 
 XPIDL_MODULE = 'dom_html'
 
deleted file mode 100644
--- a/dom/interfaces/html/nsIDOMHTMLSourceElement.idl
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- 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 "nsIDOMHTMLElement.idl"
-
-/**
- * The nsIDOMHTMLSourceElement interface is the interface to a HTML
- * <source> element.
- *
- * For more information on this interface, please see
- * http://www.whatwg.org/specs/web-apps/current-work/#source
- *
- * @status UNDER_DEVELOPMENT
- */
-
-[uuid(1deb68f8-2ed6-4a41-b8c8-e0f86510f799)]
-interface nsIDOMHTMLSourceElement : nsISupports
-{
-           attribute DOMString src;
-           attribute DOMString type;
-           attribute DOMString srcset;
-           attribute DOMString sizes;
-           attribute DOMString media;
-};
--- a/dom/media/Benchmark.cpp
+++ b/dom/media/Benchmark.cpp
@@ -27,17 +27,17 @@
 #endif
 
 using namespace mozilla::gfx;
 
 namespace mozilla {
 
 // Update this version number to force re-running the benchmark. Such as when
 // an improvement to FFVP9 or LIBVPX is deemed worthwhile.
-const uint32_t VP9Benchmark::sBenchmarkVersionID = 2;
+const uint32_t VP9Benchmark::sBenchmarkVersionID = 3;
 
 const char* VP9Benchmark::sBenchmarkFpsPref = "media.benchmark.vp9.fps";
 const char* VP9Benchmark::sBenchmarkFpsVersionCheck = "media.benchmark.vp9.versioncheck";
 bool VP9Benchmark::sHasRunTest = false;
 
 // static
 bool
 VP9Benchmark::IsVP9DecodeFast()
--- a/dom/media/MediaShutdownManager.cpp
+++ b/dom/media/MediaShutdownManager.cpp
@@ -1,17 +1,17 @@
 /* -*- 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 "mozilla/Logging.h"
 #include "mozilla/StaticPtr.h"
-#include "nsContentUtils.h"
+#include "mozilla/Services.h"
 
 #include "MediaDecoder.h"
 #include "MediaShutdownManager.h"
 
 namespace mozilla {
 
 #undef LOGW
 
--- a/dom/media/fmp4/MP4Demuxer.cpp
+++ b/dom/media/fmp4/MP4Demuxer.cpp
@@ -405,20 +405,31 @@ RefPtr<MP4TrackDemuxer::SeekPromise>
 MP4TrackDemuxer::Seek(const media::TimeUnit& aTime)
 {
   auto seekTime = aTime;
   mQueuedSample = nullptr;
 
   mIterator->Seek(seekTime.ToMicroseconds());
 
   // Check what time we actually seeked to.
-  mQueuedSample = GetNextSample();
-  if (mQueuedSample) {
-    seekTime = mQueuedSample->mTime;
-  }
+  do {
+    RefPtr<MediaRawData> sample = GetNextSample();
+    if (!sample) {
+      return SeekPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_END_OF_STREAM,
+                                          __func__);
+    }
+    if (!sample->Size()) {
+      // This sample can't be decoded, continue searching.
+      continue;
+    }
+    if (sample->mKeyframe) {
+      mQueuedSample = sample;
+      seekTime = mQueuedSample->mTime;
+    }
+  } while (!mQueuedSample);
 
   SetNextKeyFrameTime();
 
   return SeekPromise::CreateAndResolve(seekTime, __func__);
 }
 
 already_AddRefed<MediaRawData>
 MP4TrackDemuxer::GetNextSample()
--- a/dom/media/mediasink/AudioSinkWrapper.cpp
+++ b/dom/media/mediasink/AudioSinkWrapper.cpp
@@ -1,16 +1,18 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "AudioSink.h"
 #include "AudioSinkWrapper.h"
+#include "nsPrintfCString.h"
+#include "VideoUtils.h"
 
 namespace mozilla {
 namespace media {
 
 AudioSinkWrapper::~AudioSinkWrapper()
 {
 }
 
--- a/dom/vr/VRDisplay.cpp
+++ b/dom/vr/VRDisplay.cpp
@@ -653,21 +653,16 @@ VRDisplay::GetLayers(nsTArray<VRLayer>& 
   }
 }
 
 void
 VRDisplay::SubmitFrame()
 {
   AUTO_PROFILER_TRACING("VR", "SubmitFrameAtVRDisplay");
 
-  if (mClient && !mClient->IsPresentationGenerationCurrent()) {
-    mPresentation = nullptr;
-    mClient->MakePresentationGenerationCurrent();
-  }
-
   if (mPresentation) {
     mPresentation->SubmitFrame();
   }
   mFrameInfo.Clear();
 }
 
 int32_t
 VRDisplay::RequestAnimationFrame(FrameRequestCallback& aCallback,
--- a/dom/vr/VREventObserver.cpp
+++ b/dom/vr/VREventObserver.cpp
@@ -20,20 +20,21 @@ using namespace gfx;
 /**
  * This class is used by nsGlobalWindow to implement window.onvrdisplayactivate,
  * window.onvrdisplaydeactivate, window.onvrdisplayconnected,
  * window.onvrdisplaydisconnected, and window.onvrdisplaypresentchange.
  */
 VREventObserver::VREventObserver(nsGlobalWindow* aGlobalWindow)
   : mWindow(aGlobalWindow)
   , mIs2DView(true)
+  , mHasReset(false)
 {
   MOZ_ASSERT(aGlobalWindow && aGlobalWindow->IsInnerWindow());
 
-  mSpendTimeIn2DView = TimeStamp::Now();
+  UpdateSpentTimeIn2DTelemetry(false);
   VRManagerChild* vmc = VRManagerChild::Get();
   if (vmc) {
     vmc->AddListener(this);
   }
 }
 
 VREventObserver::~VREventObserver()
 {
@@ -41,33 +42,47 @@ VREventObserver::~VREventObserver()
 }
 
 void
 VREventObserver::DisconnectFromOwner()
 {
   // In the event that nsGlobalWindow is deallocated, VREventObserver may
   // still be AddRef'ed elsewhere.  Ensure that we don't UAF by
   // dereferencing mWindow.
-  if (mWindow && mIs2DView) {
-    // The WebVR content is closed, and we will collect the telemetry info
-    // for the users who view it in 2D view only.
-    Telemetry::Accumulate(Telemetry::WEBVR_USERS_VIEW_IN, 0);
-    Telemetry::AccumulateTimeDelta(Telemetry::WEBVR_TIME_SPENT_VIEWING_IN_2D,
-                                   mSpendTimeIn2DView);
-  }
+  UpdateSpentTimeIn2DTelemetry(true);
   mWindow = nullptr;
 
   // Unregister from VRManagerChild
   if (VRManagerChild::IsCreated()) {
     VRManagerChild* vmc = VRManagerChild::Get();
     vmc->RemoveListener(this);
   }
 }
 
 void
+VREventObserver::UpdateSpentTimeIn2DTelemetry(bool aUpdate)
+{
+  // mHasReset for avoiding setting the telemetry continuously
+  // for the telemetry is already been set when it is at the background.
+  // then, it would be set again when the process is exit and calling
+  // VREventObserver::DisconnectFromOwner().
+  if (mWindow && mIs2DView && aUpdate && mHasReset) {
+    // The WebVR content is closed, and we will collect the telemetry info
+    // for the users who view it in 2D view only.
+    Telemetry::Accumulate(Telemetry::WEBVR_USERS_VIEW_IN, 0);
+    Telemetry::AccumulateTimeDelta(Telemetry::WEBVR_TIME_SPENT_VIEWING_IN_2D,
+                                   mSpendTimeIn2DView);
+    mHasReset = false;
+  } else if (!aUpdate) {
+    mSpendTimeIn2DView = TimeStamp::Now();
+    mHasReset = true;
+  }
+}
+
+void
 VREventObserver::NotifyVRDisplayMounted(uint32_t aDisplayID)
 {
   if (mWindow && mWindow->AsInner()->IsCurrentInnerWindow()) {
     MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
     mWindow->DispatchVRDisplayActivate(aDisplayID,
                                        VRDisplayEventReason::Mounted);
   }
 }
--- a/dom/vr/VREventObserver.h
+++ b/dom/vr/VREventObserver.h
@@ -25,23 +25,25 @@ public:
   void NotifyVRDisplayUnmounted(uint32_t aDisplayID);
   void NotifyVRDisplayNavigation(uint32_t aDisplayID);
   void NotifyVRDisplayRequested(uint32_t aDisplayID);
   void NotifyVRDisplayConnect(uint32_t aDisplayID);
   void NotifyVRDisplayDisconnect(uint32_t aDisplayID);
   void NotifyVRDisplayPresentChange(uint32_t aDisplayID);
 
   void DisconnectFromOwner();
+  void UpdateSpentTimeIn2DTelemetry(bool aUpdate);
 
 private:
   ~VREventObserver();
 
   RefPtr<nsGlobalWindow> mWindow;
   // For WebVR telemetry for tracking users who view content
   // in the 2D view.
   TimeStamp mSpendTimeIn2DView;
   bool mIs2DView;
+  bool mHasReset;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_VREventObserver_h
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -26,17 +26,16 @@
 #include "nsIDOMDocument.h"
 #include "nsIDOMHTMLBaseElement.h"
 #include "nsIDOMHTMLCollection.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMHTMLMediaElement.h"
 #include "nsIDOMHTMLOptionElement.h"
 #include "nsIDOMHTMLScriptElement.h"
-#include "nsIDOMHTMLSourceElement.h"
 #include "nsIDOMMozNamedAttrMap.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeFilter.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMProcessingInstruction.h"
 #include "nsIDOMTreeWalker.h"
 #include "nsIDOMWindowUtils.h"
 #include "nsIDocShell.h"
@@ -489,18 +488,18 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode
     if (content->IsSVGElement(nsGkAtoms::img)) {
         return OnWalkAttribute(aNode, "href", "http://www.w3.org/1999/xlink");
     }
 
     nsCOMPtr<nsIDOMHTMLMediaElement> nodeAsMedia = do_QueryInterface(aNode);
     if (nodeAsMedia) {
         return OnWalkAttribute(aNode, "src");
     }
-    nsCOMPtr<nsIDOMHTMLSourceElement> nodeAsSource = do_QueryInterface(aNode);
-    if (nodeAsSource) {
+
+    if (content->IsHTMLElement(nsGkAtoms::source)) {
         return OnWalkAttribute(aNode, "src");
     }
 
     if (content->IsHTMLElement(nsGkAtoms::body)) {
         return OnWalkAttribute(aNode, "background");
     }
 
     if (content->IsHTMLElement(nsGkAtoms::table)) {
@@ -1004,18 +1003,17 @@ PersistNodeFixup::FixupNode(nsIDOMNode *
     if (nodeAsMedia) {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut) {
             FixupAttribute(*aNodeOut, "src");
         }
         return rv;
     }
 
-    nsCOMPtr<nsIDOMHTMLSourceElement> nodeAsSource = do_QueryInterface(aNodeIn);
-    if (nodeAsSource) {
+    if (content->IsHTMLElement(nsGkAtoms::source)) {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut) {
             FixupAttribute(*aNodeOut, "src");
         }
         return rv;
     }
 
     if (content->IsSVGElement(nsGkAtoms::img)) {
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -23,21 +23,23 @@
 #include "InsertTextTransaction.h"      // for InsertTextTransaction
 #include "JoinNodeTransaction.h"        // for JoinNodeTransaction
 #include "PlaceholderTransaction.h"     // for PlaceholderTransaction
 #include "SplitNodeTransaction.h"       // for SplitNodeTransaction
 #include "StyleSheetTransactions.h"     // for AddStyleSheetTransaction, etc.
 #include "TextEditUtils.h"              // for TextEditUtils
 #include "mozInlineSpellChecker.h"      // for mozInlineSpellChecker
 #include "mozilla/CheckedInt.h"         // for CheckedInt
+#include "mozilla/EditorDOMPoint.h"     // for EditorDOMPoint
 #include "mozilla/EditorUtils.h"        // for AutoRules, etc.
 #include "mozilla/EditTransactionBase.h" // for EditTransactionBase
 #include "mozilla/FlushType.h"          // for FlushType::Frames
 #include "mozilla/IMEStateManager.h"    // for IMEStateManager
 #include "mozilla/Preferences.h"        // for Preferences
+#include "mozilla/RangeBoundary.h"      // for RawRangeBoundary, RangeBoundary
 #include "mozilla/dom/Selection.h"      // for Selection, etc.
 #include "mozilla/Services.h"           // for GetObserverService
 #include "mozilla/TextComposition.h"    // for TextComposition
 #include "mozilla/TextEvents.h"
 #include "mozilla/dom/Element.h"        // for Element, nsINode::AsElement
 #include "mozilla/dom/HTMLBodyElement.h"
 #include "mozilla/dom/Text.h"
 #include "mozilla/dom/Event.h"
@@ -3759,32 +3761,27 @@ EditorBase::IsTextNode(nsIDOMNode* aNode
     return false;
   }
 
   uint16_t nodeType;
   aNode->GetNodeType(&nodeType);
   return (nodeType == nsIDOMNode::TEXT_NODE);
 }
 
-/**
- * GetNodeAtRangeOffsetPoint() returns the node at this position in a range,
- * assuming that aParentOrNode is the node itself if it's a text node, or
- * the node's parent otherwise.
- */
+// static
 nsIContent*
-EditorBase::GetNodeAtRangeOffsetPoint(nsINode* aParentOrNode,
-                                      int32_t aOffset)
-{
-  if (NS_WARN_IF(!aParentOrNode)) {
+EditorBase::GetNodeAtRangeOffsetPoint(const RawRangeBoundary& aPoint)
+{
+  if (NS_WARN_IF(!aPoint.IsSet())) {
     return nullptr;
   }
-  if (aParentOrNode->GetAsText()) {
-    return aParentOrNode->AsContent();
-  }
-  return aParentOrNode->GetChildAt(aOffset);
+  if (aPoint.Container()->GetAsText()) {
+    return aPoint.Container()->AsContent();
+  }
+  return aPoint.GetChildAtOffset();
 }
 
 /**
  * GetStartNodeAndOffset() returns whatever the start parent & offset is of
  * the first range in the selection.
  */
 nsresult
 EditorBase::GetStartNodeAndOffset(Selection* aSelection,
@@ -4042,27 +4039,27 @@ EditorBase::JoinNodeDeep(nsIContent& aLe
   // the leftmost children and their descendants of the right node, join them
   // up.
 
   nsCOMPtr<nsIContent> leftNodeToJoin = &aLeftNode;
   nsCOMPtr<nsIContent> rightNodeToJoin = &aRightNode;
   nsCOMPtr<nsINode> parentNode = aRightNode.GetParentNode();
 
   EditorDOMPoint ret;
-
   while (leftNodeToJoin && rightNodeToJoin && parentNode &&
          AreNodesSameType(leftNodeToJoin, rightNodeToJoin)) {
     uint32_t length = leftNodeToJoin->Length();
 
-    ret.node = rightNodeToJoin;
-    ret.offset = length;
+    ret.Set(rightNodeToJoin, length);
 
     // Do the join
     nsresult rv = JoinNodes(*leftNodeToJoin, *rightNodeToJoin);
-    NS_ENSURE_SUCCESS(rv, EditorDOMPoint());
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return EditorDOMPoint();
+    }
 
     if (parentNode->GetAsText()) {
       // We've joined all the way down to text nodes, we're done!
       return ret;
     }
 
     // Get new left and right nodes, and begin anew
     parentNode = rightNodeToJoin;
@@ -4084,16 +4081,20 @@ EditorBase::JoinNodeDeep(nsIContent& aLe
     while (rightNodeToJoin && !IsEditable(rightNodeToJoin)) {
       rightNodeToJoin = rightNodeToJoin->GetNextSibling();
     }
     if (!rightNodeToJoin) {
       return ret;
     }
   }
 
+  if (NS_WARN_IF(!ret.IsSet())) {
+    return EditorDOMPoint();
+  }
+
   return ret;
 }
 
 void
 EditorBase::BeginUpdateViewBatch()
 {
   NS_PRECONDITION(mUpdateCount >= 0, "bad state");
 
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -2,19 +2,21 @@
 /* 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/. */
 
 #ifndef mozilla_EditorBase_h
 #define mozilla_EditorBase_h
 
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc.
+#include "mozilla/EditorDOMPoint.h"     // for EditorDOMPoint
 #include "mozilla/Maybe.h"              // for Maybe
 #include "mozilla/OwningNonNull.h"      // for OwningNonNull
 #include "mozilla/PresShell.h"          // for PresShell
+#include "mozilla/RangeBoundary.h"      // for RawRangeBoundary, RangeBoundary
 #include "mozilla/SelectionState.h"     // for RangeUpdater, etc.
 #include "mozilla/StyleSheet.h"         // for StyleSheet
 #include "mozilla/WeakPtr.h"            // for WeakPtr
 #include "mozilla/dom/Selection.h"
 #include "mozilla/dom/Text.h"
 #include "nsCOMPtr.h"                   // for already_AddRefed, nsCOMPtr
 #include "nsCycleCollectionParticipant.h"
 #include "nsGkAtoms.h"
@@ -118,17 +120,16 @@ class HTMLEditor;
 class InsertNodeTransaction;
 class InsertTextTransaction;
 class JoinNodeTransaction;
 class PlaceholderTransaction;
 class RemoveStyleSheetTransaction;
 class SplitNodeTransaction;
 class TextComposition;
 class TextEditor;
-struct EditorDOMPoint;
 
 namespace dom {
 class DataTransfer;
 class Element;
 class EventTarget;
 class Text;
 } // namespace dom
 
@@ -881,18 +882,27 @@ public:
   virtual bool AreNodesSameType(nsIContent* aNode1, nsIContent* aNode2);
 
   static bool IsTextNode(nsIDOMNode* aNode);
   static bool IsTextNode(nsINode* aNode)
   {
     return aNode->NodeType() == nsIDOMNode::TEXT_NODE;
   }
 
-  static nsIContent* GetNodeAtRangeOffsetPoint(nsINode* aParentOrNode,
-                                               int32_t aOffset);
+  /**
+   * GetNodeAtRangeOffsetPoint() returns the node at this position in a range,
+   * assuming that the container is the node itself if it's a text node, or
+   * the node's parent otherwise.
+   */
+  static nsIContent* GetNodeAtRangeOffsetPoint(nsINode* aContainer,
+                                               int32_t aOffset)
+  {
+    return GetNodeAtRangeOffsetPoint(RawRangeBoundary(aContainer, aOffset));
+  }
+  static nsIContent* GetNodeAtRangeOffsetPoint(const RawRangeBoundary& aPoint);
 
   static nsresult GetStartNodeAndOffset(Selection* aSelection,
                                         nsIDOMNode** outStartNode,
                                         int32_t* outStartOffset);
   static nsresult GetStartNodeAndOffset(Selection* aSelection,
                                         nsINode** aStartContainer,
                                         int32_t* aStartOffset);
   static nsresult GetEndNodeAndOffset(Selection* aSelection,
copy from editor/libeditor/EditorUtils.h
copy to editor/libeditor/EditorDOMPoint.h
--- a/editor/libeditor/EditorUtils.h
+++ b/editor/libeditor/EditorDOMPoint.h
@@ -1,438 +1,94 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 
-#ifndef mozilla_EditorUtils_h
-#define mozilla_EditorUtils_h
+#ifndef mozilla_EditorDOMPoint_h
+#define mozilla_EditorDOMPoint_h
 
-#include "mozilla/dom/Selection.h"
-#include "mozilla/EditorBase.h"
-#include "mozilla/GuardObjects.h"
+#include "mozilla/Assertions.h"
+#include "mozilla/Attributes.h"
+#include "mozilla/RangeBoundary.h"
 #include "nsCOMPtr.h"
-#include "nsDebug.h"
-#include "nsIDOMNode.h"
-#include "nsIEditor.h"
-#include "nscore.h"
-
-class nsAtom;
-class nsIContentIterator;
-class nsIDOMDocument;
-class nsIDOMEvent;
-class nsISimpleEnumerator;
-class nsITransferable;
-class nsRange;
+#include "nsIContent.h"
+#include "nsINode.h"
 
 namespace mozilla {
-template <class T> class OwningNonNull;
+
+template<typename ParentType, typename RefType>
+class EditorDOMPointBase;
 
-/***************************************************************************
- * EditActionResult is useful to return multiple results of an editor
- * action handler without out params.
- * Note that when you return an anonymous instance from a method, you should
- * use EditActionIgnored(), EditActionHandled() or EditActionCanceled() for
- * easier to read.  In other words, EditActionResult should be used when
- * declaring return type of a method, being an argument or defined as a local
- * variable.
- */
-class MOZ_STACK_CLASS EditActionResult final
+typedef EditorDOMPointBase<nsCOMPtr<nsINode>,
+                           nsCOMPtr<nsIContent>> EditorDOMPoint;
+typedef EditorDOMPointBase<nsINode*, nsIContent*> EditorRawDOMPoint;
+
+template<typename ParentType, typename RefType>
+class MOZ_STACK_CLASS EditorDOMPointBase final
+                        : public RangeBoundaryBase<ParentType, RefType>
 {
 public:
-  bool Succeeded() const { return NS_SUCCEEDED(mRv); }
-  bool Failed() const { return NS_FAILED(mRv); }
-  nsresult Rv() const { return mRv; }
-  bool Canceled() const { return mCanceled; }
-  bool Handled() const { return mHandled; }
-
-  EditActionResult SetResult(nsresult aRv)
+  EditorDOMPointBase()
+    : RangeBoundaryBase<ParentType, RefType>()
   {
-    mRv = aRv;
-    return *this;
-  }
-  EditActionResult MarkAsCanceled()
-  {
-    mCanceled = true;
-    return *this;
-  }
-  EditActionResult MarkAsHandled()
-  {
-    mHandled = true;
-    return *this;
   }
 
-  explicit EditActionResult(nsresult aRv)
-    : mRv(aRv)
-    , mCanceled(false)
-    , mHandled(false)
+  EditorDOMPointBase(nsINode* aConatiner,
+                     int32_t aOffset)
+    : RangeBoundaryBase<ParentType, RefType>(aConatiner,
+                                             aOffset)
   {
   }
 
-  EditActionResult& operator|=(const EditActionResult& aOther)
+  EditorDOMPointBase(nsIDOMNode* aDOMContainer,
+                     int32_t aOffset)
+    : RangeBoundaryBase<ParentType, RefType>()
   {
-    mCanceled |= aOther.mCanceled;
-    mHandled |= aOther.mHandled;
-    // When both result are same, keep the result.
-    if (mRv == aOther.mRv) {
-      return *this;
-    }
-    // If one of the results is error, use NS_ERROR_FAILURE.
-    if (Failed() || aOther.Failed()) {
-      mRv = NS_ERROR_FAILURE;
-    } else {
-      // Otherwise, use generic success code, NS_OK.
-      mRv = NS_OK;
-    }
-    return *this;
+    nsCOMPtr<nsINode> container = do_QueryInterface(aDOMContainer);
+    this->Set(container, aOffset);
   }
 
-private:
-  nsresult mRv;
-  bool mCanceled;
-  bool mHandled;
-
-  EditActionResult(nsresult aRv, bool aCanceled, bool aHandled)
-    : mRv(aRv)
-    , mCanceled(aCanceled)
-    , mHandled(aHandled)
-  {
-  }
-
-  EditActionResult()
-    : mRv(NS_ERROR_NOT_INITIALIZED)
-    , mCanceled(false)
-    , mHandled(false)
+  /**
+   * Different from RangeBoundary, aReferenceChild should be a child node
+   * which you want to refer.  So, set non-nullptr if offset is
+   * 0 - Length() - 1.  Otherwise, set nullptr, i.e., if offset is same as
+   * Length().
+   */
+  EditorDOMPointBase(nsINode* aContainer,
+                     nsIContent* aPointedNode)
+    : RangeBoundaryBase<ParentType, RefType>(aContainer,
+                                             GetRef(aPointedNode))
   {
   }
 
-  friend EditActionResult EditActionIgnored(nsresult aRv);
-  friend EditActionResult EditActionHandled(nsresult aRv);
-  friend EditActionResult EditActionCanceled(nsresult aRv);
-};
-
-/***************************************************************************
- * When an edit action handler (or its helper) does nothing,
- * EditActionIgnored should be returned.
- */
-inline EditActionResult
-EditActionIgnored(nsresult aRv = NS_OK)
-{
-  return EditActionResult(aRv, false, false);
-}
-
-/***************************************************************************
- * When an edit action handler (or its helper) handled and not canceled,
- * EditActionHandled should be returned.
- */
-inline EditActionResult
-EditActionHandled(nsresult aRv = NS_OK)
-{
-  return EditActionResult(aRv, false, true);
-}
+  EditorDOMPointBase(nsINode* aConatiner,
+                     nsIContent* aPointedNode,
+                     int32_t aOffset)
+    : RangeBoundaryBase<ParentType, RefType>(aConatiner,
+                                             GetRef(aPointedNode),
+                                             aOffset)
+  {
+  }
 
-/***************************************************************************
- * When an edit action handler (or its helper) handled and canceled,
- * EditActionHandled should be returned.
- */
-inline EditActionResult
-EditActionCanceled(nsresult aRv = NS_OK)
-{
-  return EditActionResult(aRv, true, true);
-}
-
-/***************************************************************************
- * stack based helper class for batching a collection of transactions inside a
- * placeholder transaction.
- */
-class MOZ_RAII AutoPlaceholderBatch final
-{
-private:
-  RefPtr<EditorBase> mEditorBase;
-  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+  template<typename PT, typename RT>
+  explicit EditorDOMPointBase(const RangeBoundaryBase<PT, RT>& aOther)
+    : RangeBoundaryBase<ParentType, RefType>(aOther)
+  {
+  }
 
-public:
-  explicit AutoPlaceholderBatch(EditorBase* aEditorBase
-                                MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-    : mEditorBase(aEditorBase)
+  explicit EditorDOMPointBase(const RawRangeBoundary& aRawRangeBoundary)
+    : RangeBoundaryBase<ParentType, RefType>(aRawRangeBoundary)
   {
-    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    BeginPlaceholderTransaction(nullptr);
-  }
-  AutoPlaceholderBatch(EditorBase* aEditorBase,
-                       nsAtom* aTransactionName
-                       MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-    : mEditorBase(aEditorBase)
-  {
-    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    BeginPlaceholderTransaction(aTransactionName);
-  }
-  ~AutoPlaceholderBatch()
-  {
-    if (mEditorBase) {
-      mEditorBase->EndPlaceholderTransaction();
-    }
   }
 
 private:
-  void BeginPlaceholderTransaction(nsAtom* aTransactionName)
-  {
-    if (mEditorBase) {
-      mEditorBase->BeginPlaceholderTransaction(aTransactionName);
-    }
-  }
-};
-
-/***************************************************************************
- * stack based helper class for saving/restoring selection.  Note that this
- * assumes that the nodes involved are still around afterwards!
- */
-class MOZ_RAII AutoSelectionRestorer final
-{
-private:
-  // Ref-counted reference to the selection that we are supposed to restore.
-  RefPtr<dom::Selection> mSelection;
-  EditorBase* mEditorBase;  // Non-owning ref to EditorBase.
-  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-
-public:
-  /**
-   * Constructor responsible for remembering all state needed to restore
-   * aSelection.
-   */
-  AutoSelectionRestorer(dom::Selection* aSelection,
-                        EditorBase* aEditorBase
-                        MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
-
-  /**
-   * Destructor restores mSelection to its former state
-   */
-  ~AutoSelectionRestorer();
-
-  /**
-   * Abort() cancels to restore the selection.
-   */
-  void Abort();
-};
-
-/***************************************************************************
- * stack based helper class for StartOperation()/EndOperation() sandwich
- */
-class MOZ_RAII AutoRules final
-{
-public:
-  AutoRules(EditorBase* aEditorBase, EditAction aAction,
-            nsIEditor::EDirection aDirection
-            MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-    : mEditorBase(aEditorBase)
-    , mDoNothing(false)
-  {
-    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    // mAction will already be set if this is nested call
-    if (mEditorBase && !mEditorBase->mAction) {
-      mEditorBase->StartOperation(aAction, aDirection);
-    } else {
-      mDoNothing = true; // nested calls will end up here
-    }
-  }
-
-  ~AutoRules()
-  {
-    if (mEditorBase && !mDoNothing) {
-      mEditorBase->EndOperation();
-    }
-  }
-
-protected:
-  EditorBase* mEditorBase;
-  bool mDoNothing;
-  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
-
-/***************************************************************************
- * stack based helper class for turning off active selection adjustment
- * by low level transactions
- */
-class MOZ_RAII AutoTransactionsConserveSelection final
-{
-public:
-  explicit AutoTransactionsConserveSelection(EditorBase* aEditorBase
-                                             MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-    : mEditorBase(aEditorBase)
-    , mOldState(true)
-  {
-    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    if (mEditorBase) {
-      mOldState = mEditorBase->GetShouldTxnSetSelection();
-      mEditorBase->SetShouldTxnSetSelection(false);
-    }
-  }
-
-  ~AutoTransactionsConserveSelection()
-  {
-    if (mEditorBase) {
-      mEditorBase->SetShouldTxnSetSelection(mOldState);
-    }
-  }
-
-protected:
-  EditorBase* mEditorBase;
-  bool mOldState;
-  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
-
-/***************************************************************************
- * stack based helper class for batching reflow and paint requests.
- */
-class MOZ_RAII AutoUpdateViewBatch final
-{
-public:
-  explicit AutoUpdateViewBatch(EditorBase* aEditorBase
-                               MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-    : mEditorBase(aEditorBase)
-  {
-    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    NS_ASSERTION(mEditorBase, "null mEditorBase pointer!");
-
-    if (mEditorBase) {
-      mEditorBase->BeginUpdateViewBatch();
-    }
-  }
-
-  ~AutoUpdateViewBatch()
+  static nsIContent* GetRef(nsIContent* aPointedNode)
   {
-    if (mEditorBase) {
-      mEditorBase->EndUpdateViewBatch();
-    }
-  }
-
-protected:
-  EditorBase* mEditorBase;
-  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
-
-class MOZ_STACK_CLASS AutoRangeArray final
-{
-public:
-  explicit AutoRangeArray(dom::Selection* aSelection)
-  {
-    if (!aSelection) {
-      return;
-    }
-    uint32_t rangeCount = aSelection->RangeCount();
-    for (uint32_t i = 0; i < rangeCount; i++) {
-      mRanges.AppendElement(*aSelection->GetRangeAt(i));
-    }
+    MOZ_ASSERT(aPointedNode);
+    return aPointedNode ? aPointedNode->GetPreviousSibling() : nullptr;
   }
-
-  AutoTArray<mozilla::OwningNonNull<nsRange>, 8> mRanges;
-};
-
-/******************************************************************************
- * some helper classes for iterating the dom tree
- *****************************************************************************/
-
-class BoolDomIterFunctor
-{
-public:
-  virtual bool operator()(nsINode* aNode) const = 0;
-};
-
-class MOZ_RAII DOMIterator
-{
-public:
-  explicit DOMIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
-
-  explicit DOMIterator(nsINode& aNode MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
-  virtual ~DOMIterator();
-
-  nsresult Init(nsRange& aRange);
-
-  void AppendList(
-         const BoolDomIterFunctor& functor,
-         nsTArray<mozilla::OwningNonNull<nsINode>>& arrayOfNodes) const;
-
-protected:
-  nsCOMPtr<nsIContentIterator> mIter;
-  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
-
-class MOZ_RAII DOMSubtreeIterator final : public DOMIterator
-{
-public:
-  explicit DOMSubtreeIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
-  virtual ~DOMSubtreeIterator();
-
-  nsresult Init(nsRange& aRange);
-};
-
-class TrivialFunctor final : public BoolDomIterFunctor
-{
-public:
-  // Used to build list of all nodes iterator covers
-  virtual bool operator()(nsINode* aNode) const
-  {
-    return true;
-  }
-};
-
-/******************************************************************************
- * general dom point utility struct
- *****************************************************************************/
-struct MOZ_STACK_CLASS EditorDOMPoint final
-{
-  nsCOMPtr<nsINode> node;
-  int32_t offset;
-
-  EditorDOMPoint()
-    : node(nullptr)
-    , offset(-1)
-  {}
-  EditorDOMPoint(nsINode* aNode, int32_t aOffset)
-    : node(aNode)
-    , offset(aOffset)
-  {}
-  EditorDOMPoint(nsIDOMNode* aNode, int32_t aOffset)
-    : node(do_QueryInterface(aNode))
-    , offset(aOffset)
-  {}
-
-  void SetPoint(nsINode* aNode, int32_t aOffset)
-  {
-    node = aNode;
-    offset = aOffset;
-  }
-  void SetPoint(nsIDOMNode* aNode, int32_t aOffset)
-  {
-    node = do_QueryInterface(aNode);
-    offset = aOffset;
-  }
-};
-
-class EditorUtils final
-{
-public:
-  // Note that aChild isn't a normal XPCOM outparam and won't get AddRef'ed.
-  static bool IsDescendantOf(nsINode* aNode, nsINode* aParent,
-                             nsIContent** aChild);
-  static bool IsDescendantOf(nsINode* aNode, nsINode* aParent,
-                             int32_t* aOffset = nullptr);
-  static bool IsDescendantOf(nsIDOMNode* aNode, nsIDOMNode* aParent,
-                             int32_t* aOffset = nullptr);
-  static bool IsLeafNode(nsIDOMNode* aNode);
-};
-
-class EditorHookUtils final
-{
-public:
-  static bool DoInsertionHook(nsIDOMDocument* aDoc, nsIDOMEvent* aEvent,
-                              nsITransferable* aTrans);
-
-private:
-  static nsresult GetHookEnumeratorFromDocument(
-                    nsIDOMDocument*aDoc,
-                    nsISimpleEnumerator** aEnumerator);
 };
 
 } // namespace mozilla
 
-#endif // #ifndef mozilla_EditorUtils_h
+#endif // #ifndef mozilla_EditorDOMPoint_h
--- a/editor/libeditor/EditorUtils.h
+++ b/editor/libeditor/EditorUtils.h
@@ -370,49 +370,16 @@ class TrivialFunctor final : public Bool
 public:
   // Used to build list of all nodes iterator covers
   virtual bool operator()(nsINode* aNode) const
   {
     return true;
   }
 };
 
-/******************************************************************************
- * general dom point utility struct
- *****************************************************************************/
-struct MOZ_STACK_CLASS EditorDOMPoint final
-{
-  nsCOMPtr<nsINode> node;
-  int32_t offset;
-
-  EditorDOMPoint()
-    : node(nullptr)
-    , offset(-1)
-  {}
-  EditorDOMPoint(nsINode* aNode, int32_t aOffset)
-    : node(aNode)
-    , offset(aOffset)
-  {}
-  EditorDOMPoint(nsIDOMNode* aNode, int32_t aOffset)
-    : node(do_QueryInterface(aNode))
-    , offset(aOffset)
-  {}
-
-  void SetPoint(nsINode* aNode, int32_t aOffset)
-  {
-    node = aNode;
-    offset = aOffset;
-  }
-  void SetPoint(nsIDOMNode* aNode, int32_t aOffset)
-  {
-    node = do_QueryInterface(aNode);
-    offset = aOffset;
-  }
-};
-
 class EditorUtils final
 {
 public:
   // Note that aChild isn't a normal XPCOM outparam and won't get AddRef'ed.
   static bool IsDescendantOf(nsINode* aNode, nsINode* aParent,
                              nsIContent** aChild);
   static bool IsDescendantOf(nsINode* aNode, nsINode* aParent,
                              int32_t* aOffset = nullptr);
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -8,16 +8,17 @@
 
 #include <stdlib.h>
 
 #include "HTMLEditUtils.h"
 #include "TextEditUtils.h"
 #include "WSRunObject.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/CSSEditUtils.h"
+#include "mozilla/EditorDOMPoint.h"
 #include "mozilla/EditorUtils.h"
 #include "mozilla/HTMLEditor.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Move.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/Unused.h"
 #include "mozilla/dom/Selection.h"
@@ -2299,19 +2300,21 @@ HTMLEditRules::WillDeleteSelection(Selec
       if (sibling) {
         NS_ENSURE_STATE(mHTMLEditor);
         stepbrother = mHTMLEditor->GetNextHTMLSibling(sibling);
       }
       // Are they both text nodes?  If so, join them!
       if (startNode == stepbrother && startNode->GetAsText() &&
           sibling->GetAsText()) {
         EditorDOMPoint pt = JoinNodesSmart(*sibling, *startNode->AsContent());
-        NS_ENSURE_STATE(pt.node);
+        if (NS_WARN_IF(!pt.IsSet())) {
+          return NS_ERROR_FAILURE;
+        }
         // Fix up selection
-        rv = aSelection->Collapse(pt.node, pt.offset);
+        rv = aSelection->Collapse(pt.Container(), pt.Offset());
         NS_ENSURE_SUCCESS(rv, rv);
       }
       rv = InsertBRIfNeeded(aSelection);
       NS_ENSURE_SUCCESS(rv, rv);
       return NS_OK;
     }
 
     if (wsType == WSType::otherBlock) {
@@ -2369,18 +2372,20 @@ HTMLEditRules::WillDeleteSelection(Selec
           InDifferentTableElements(leftNode, rightNode)) {
         return NS_OK;
       }
 
       if (bDeletedBR) {
         // Put selection at edge of block and we are done.
         NS_ENSURE_STATE(leafNode);
         EditorDOMPoint newSel = GetGoodSelPointForNode(*leafNode, aAction);
-        NS_ENSURE_STATE(newSel.node);
-        aSelection->Collapse(newSel.node, newSel.offset);
+        if (NS_WARN_IF(!newSel.IsSet())) {
+          return NS_ERROR_FAILURE;
+        }
+        aSelection->Collapse(newSel.Container(), newSel.Offset());
         return NS_OK;
       }
 
       // Else we are joining content to block
 
       nsCOMPtr<nsINode> selPointNode = startNode;
       int32_t selPointOffset = startOffset;
       {
@@ -2558,19 +2563,21 @@ HTMLEditRules::WillDeleteSelection(Selec
           // First delete the selection
           NS_ENSURE_STATE(mHTMLEditor);
           rv = mHTMLEditor->DeleteSelectionImpl(aAction, aStripWrappers);
           NS_ENSURE_SUCCESS(rv, rv);
           // Join blocks
           NS_ENSURE_STATE(mHTMLEditor);
           EditorDOMPoint pt =
             mHTMLEditor->JoinNodeDeep(*leftParent, *rightParent);
-          NS_ENSURE_STATE(pt.node);
+          if (NS_WARN_IF(!pt.IsSet())) {
+            return NS_ERROR_FAILURE;
+          }
           // Fix up selection
-          rv = aSelection->Collapse(pt.node, pt.offset);
+          rv = aSelection->Collapse(pt.Container(), pt.Offset());
           NS_ENSURE_SUCCESS(rv, rv);
           return NS_OK;
         }
 
         // Else blocks not same type, or not siblings.  Delete everything
         // except table elements.
         join = true;
 
@@ -2767,29 +2774,33 @@ HTMLEditRules::GetGoodSelPointForNode(ns
              aAction == nsIEditor::ePreviousWord ||
              aAction == nsIEditor::eToBeginningOfLine ||
              aAction == nsIEditor::eToEndOfLine);
 
   bool isPreviousAction = (aAction == nsIEditor::ePrevious ||
                            aAction == nsIEditor::ePreviousWord ||
                            aAction == nsIEditor::eToBeginningOfLine);
 
-  NS_ENSURE_TRUE(mHTMLEditor, EditorDOMPoint());
+  if (NS_WARN_IF(!mHTMLEditor)) {
+    return EditorDOMPoint();
+  }
   if (aNode.GetAsText() || mHTMLEditor->IsContainer(&aNode) ||
       NS_WARN_IF(!aNode.GetParentNode())) {
     return EditorDOMPoint(&aNode, isPreviousAction ? aNode.Length() : 0);
   }
 
-  EditorDOMPoint ret;
-  ret.node = aNode.GetParentNode();
-  ret.offset = ret.node ? ret.node->IndexOf(&aNode) : -1;
-  NS_ENSURE_TRUE(mHTMLEditor, EditorDOMPoint());
+  if (NS_WARN_IF(!mHTMLEditor) ||
+      NS_WARN_IF(!aNode.IsContent())) {
+    return EditorDOMPoint();
+  }
+
+  EditorDOMPoint ret(aNode.GetParentNode(), aNode.AsContent());
   if ((!aNode.IsHTMLElement(nsGkAtoms::br) ||
        mHTMLEditor->IsVisibleBRElement(&aNode)) && isPreviousAction) {
-    ret.offset++;
+    ret.AdvanceOffset();
   }
   return ret;
 }
 
 EditActionResult
 HTMLEditRules::TryToJoinBlocks(nsIContent& aLeftNode,
                                nsIContent& aRightNode)
 {
@@ -3066,17 +3077,17 @@ HTMLEditRules::TryToJoinBlocks(nsIConten
   // Do br adjustment.
   nsCOMPtr<Element> brNode =
     CheckForInvisibleBR(*leftBlock, BRLocation::blockEnd);
   EditActionResult ret(NS_OK);
   if (mergeLists || leftBlock->NodeInfo()->NameAtom() ==
                     rightBlock->NodeInfo()->NameAtom()) {
     // Nodes are same type.  merge them.
     EditorDOMPoint pt = JoinNodesSmart(*leftBlock, *rightBlock);
-    if (pt.node && mergeLists) {
+    if (pt.IsSet() && mergeLists) {
       RefPtr<Element> newBlock =
         ConvertListType(rightBlock, existingList, nsGkAtoms::li);
     }
     ret.MarkAsHandled();
   } else {
     // Nodes are dissimilar types.
     ret |= MoveBlock(*leftBlock, *rightBlock, leftOffset, rightOffset);
     if (NS_WARN_IF(ret.Failed())) {
@@ -5159,34 +5170,34 @@ HTMLEditRules::CheckForEmptyBlock(nsINod
       if (aAction == nsIEditor::eNext || aAction == nsIEditor::eNextWord ||
           aAction == nsIEditor::eToEndOfLine) {
         // Move to the start of the next node, if any
         nsINode* child = emptyBlock->GetNextSibling();
         nsCOMPtr<nsIContent> nextNode =
           htmlEditor->GetNextNode(blockParent, offset + 1, child, true);
         if (nextNode) {
           EditorDOMPoint pt = GetGoodSelPointForNode(*nextNode, aAction);
-          nsresult rv = aSelection->Collapse(pt.node, pt.offset);
+          nsresult rv = aSelection->Collapse(pt.Container(), pt.Offset());
           NS_ENSURE_SUCCESS(rv, rv);
         } else {
           // Adjust selection to be right after it.
           nsresult rv = aSelection->Collapse(blockParent, offset + 1);
           NS_ENSURE_SUCCESS(rv, rv);
         }
       } else if (aAction == nsIEditor::ePrevious ||
                  aAction == nsIEditor::ePreviousWord ||
                  aAction == nsIEditor::eToBeginningOfLine) {
         // Move to the end of the previous node
         nsCOMPtr<nsIContent> priorNode = htmlEditor->GetPriorNode(blockParent,
                                                                   offset,
                                                                   emptyBlock,
                                                                   true);
         if (priorNode) {
           EditorDOMPoint pt = GetGoodSelPointForNode(*priorNode, aAction);
-          nsresult rv = aSelection->Collapse(pt.node, pt.offset);
+          nsresult rv = aSelection->Collapse(pt.Container(), pt.Offset());
           NS_ENSURE_SUCCESS(rv, rv);
         } else {
           nsresult rv = aSelection->Collapse(blockParent, offset + 1);
           NS_ENSURE_SUCCESS(rv, rv);
         }
       } else if (aAction != nsIEditor::eNone) {
         MOZ_CRASH("CheckForEmptyBlock doesn't support this action yet");
       }
@@ -5848,32 +5859,37 @@ HTMLEditRules::PromoteRange(nsRange& aRa
        return;
      }
   }
 
   // Make a new adjusted range to represent the appropriate block content.
   // This is tricky.  The basic idea is to push out the range endpoints to
   // truly enclose the blocks that we will affect.
 
-  EditorDOMPoint opStart =
+  // Make sure that the new range ends up to be in the editable section.
+  // XXX Looks like that this check wastes the time.  Perhaps, we should
+  //     implement a method which checks both two DOM points in the editor
+  //     root.
+  EditorDOMPoint startPoint =
     GetPromotedPoint(kStart, *startNode, startOffset, aOperationType);
-  EditorDOMPoint opEnd =
+  if (!htmlEditor->IsDescendantOfEditorRoot(
+         EditorBase::GetNodeAtRangeOffsetPoint(startPoint.AsRaw()))) {
+    return;
+  }
+  EditorDOMPoint endPoint =
     GetPromotedPoint(kEnd, *endNode, endOffset, aOperationType);
-
-  // Make sure that the new range ends up to be in the editable section.
+  EditorRawDOMPoint lastRawPoint(endPoint.AsRaw());
+  lastRawPoint.RewindOffset();
   if (!htmlEditor->IsDescendantOfEditorRoot(
-        EditorBase::GetNodeAtRangeOffsetPoint(opStart.node, opStart.offset)) ||
-      !htmlEditor->IsDescendantOfEditorRoot(
-        EditorBase::GetNodeAtRangeOffsetPoint(opEnd.node, opEnd.offset - 1))) {
+         EditorBase::GetNodeAtRangeOffsetPoint(lastRawPoint))) {
     return;
   }
 
   DebugOnly<nsresult> rv =
-    aRange.SetStartAndEnd(opStart.node, opStart.offset,
-                          opEnd.node, opEnd.offset);
+    aRange.SetStartAndEnd(startPoint.AsRaw(), endPoint.AsRaw());
   MOZ_ASSERT(NS_SUCCEEDED(rv));
 }
 
 class UniqueFunctor final : public BoolDomIterFunctor
 {
 public:
   explicit UniqueFunctor(nsTArray<OwningNonNull<nsINode>>& aArray)
     : mArray(aArray)
@@ -6395,39 +6411,44 @@ HTMLEditRules::GetHighestInlineParent(ns
 }
 
 /**
  * GetNodesFromPoint() constructs a list of nodes from a point that will be
  * operated on.
  */
 nsresult
 HTMLEditRules::GetNodesFromPoint(
-                 EditorDOMPoint aPoint,
+                 const EditorDOMPoint& aPoint,
                  EditAction aOperation,
                  nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
                  TouchContent aTouchContent)
 {
-  NS_ENSURE_STATE(aPoint.node);
-  RefPtr<nsRange> range = new nsRange(aPoint.node);
-  nsresult rv = range->SetStart(aPoint.node, aPoint.offset);
+  if (NS_WARN_IF(!aPoint.IsSet())) {
+    return NS_ERROR_INVALID_ARG;
+  }
+  RefPtr<nsRange> range = new nsRange(aPoint.Container());
+  DebugOnly<nsresult> rv = range->SetStart(aPoint.Container(), aPoint.Offset());
   MOZ_ASSERT(NS_SUCCEEDED(rv));
 
   // Expand the range to include adjacent inlines
   PromoteRange(*range, aOperation);
 
   // Make array of ranges
   nsTArray<RefPtr<nsRange>> arrayOfRanges;
 
   // Stuff new opRange into array
   arrayOfRanges.AppendElement(range);
 
   // Use these ranges to contruct a list of nodes to act on
-  rv = GetNodesForOperation(arrayOfRanges, outArrayOfNodes, aOperation,
-                            aTouchContent);
-  NS_ENSURE_SUCCESS(rv, rv);
+  nsresult rv2 =
+    GetNodesForOperation(arrayOfRanges, outArrayOfNodes, aOperation,
+                         aTouchContent);
+  if (NS_WARN_IF(NS_FAILED(rv2))) {
+    return rv2;
+  }
 
   return NS_OK;
 }
 
 /**
  * GetNodesFromSelection() constructs a list of nodes from the selection that
  * will be operated on.
  */
@@ -7320,59 +7341,81 @@ HTMLEditRules::SplitAsNeeded(nsAtom& aTa
  * Returns the point where they're merged, or (nullptr, -1) on failure.
  */
 EditorDOMPoint
 HTMLEditRules::JoinNodesSmart(nsIContent& aNodeLeft,
                               nsIContent& aNodeRight)
 {
   // Caller responsible for left and right node being the same type
   nsCOMPtr<nsINode> parent = aNodeLeft.GetParentNode();
-  NS_ENSURE_TRUE(parent, EditorDOMPoint());
+  if (NS_WARN_IF(!parent)) {
+    return EditorDOMPoint();
+  }
   int32_t parOffset = parent->IndexOf(&aNodeLeft);
   nsCOMPtr<nsINode> rightParent = aNodeRight.GetParentNode();
 
   // If they don't have the same parent, first move the right node to after the
   // left one
   if (parent != rightParent) {
-    NS_ENSURE_TRUE(mHTMLEditor, EditorDOMPoint());
+    if (NS_WARN_IF(!mHTMLEditor)) {
+      return EditorDOMPoint();
+    }
     nsresult rv = mHTMLEditor->MoveNode(&aNodeRight, parent, parOffset);
-    NS_ENSURE_SUCCESS(rv, EditorDOMPoint());
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return EditorDOMPoint();
+    }
   }
 
   EditorDOMPoint ret(&aNodeRight, aNodeLeft.Length());
 
   // Separate join rules for differing blocks
   if (HTMLEditUtils::IsList(&aNodeLeft) || aNodeLeft.GetAsText()) {
     // For lists, merge shallow (wouldn't want to combine list items)
     nsresult rv = mHTMLEditor->JoinNodes(aNodeLeft, aNodeRight);
-    NS_ENSURE_SUCCESS(rv, EditorDOMPoint());
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return EditorDOMPoint();
+    }
     return ret;
   }
 
   // Remember the last left child, and first right child
-  NS_ENSURE_TRUE(mHTMLEditor, EditorDOMPoint());
+  if (NS_WARN_IF(!mHTMLEditor)) {
+    return EditorDOMPoint();
+  }
   nsCOMPtr<nsIContent> lastLeft = mHTMLEditor->GetLastEditableChild(aNodeLeft);
-  NS_ENSURE_TRUE(lastLeft, EditorDOMPoint());
-
-  NS_ENSURE_TRUE(mHTMLEditor, EditorDOMPoint());
+  if (NS_WARN_IF(!lastLeft)) {
+    return EditorDOMPoint();
+  }
+
+  if (NS_WARN_IF(!mHTMLEditor)) {
+    return EditorDOMPoint();
+  }
   nsCOMPtr<nsIContent> firstRight = mHTMLEditor->GetFirstEditableChild(aNodeRight);
-  NS_ENSURE_TRUE(firstRight, EditorDOMPoint());
+  if (NS_WARN_IF(!firstRight)) {
+    return EditorDOMPoint();
+  }
 
   // For list items, divs, etc., merge smart
-  NS_ENSURE_TRUE(mHTMLEditor, EditorDOMPoint());
+  if (NS_WARN_IF(!mHTMLEditor)) {
+    return EditorDOMPoint();
+  }
   nsresult rv = mHTMLEditor->JoinNodes(aNodeLeft, aNodeRight);
-  NS_ENSURE_SUCCESS(rv, EditorDOMPoint());
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return EditorDOMPoint();
+  }
 
   if (lastLeft && firstRight && mHTMLEditor &&
       mHTMLEditor->AreNodesSameType(lastLeft, firstRight) &&
       (lastLeft->GetAsText() || !mHTMLEditor ||
        (lastLeft->IsElement() && firstRight->IsElement() &&
         mHTMLEditor->mCSSEditUtils->ElementsSameStyle(lastLeft->AsElement(),
                                                   firstRight->AsElement())))) {
-    NS_ENSURE_TRUE(mHTMLEditor, EditorDOMPoint());
+    if (NS_WARN_IF(!mHTMLEditor)) {
+      return EditorDOMPoint();
+    }
     return JoinNodesSmart(*lastLeft, *firstRight);
   }
   return ret;
 }
 
 Element*
 HTMLEditRules::GetTopEnclosingMailCite(nsINode& aNode)
 {
@@ -7833,17 +7876,17 @@ HTMLEditRules::AdjustSelection(Selection
   rv = FindNearSelectableNode(selNode, selOffset, child, aAction,
                               address_of(nearNode));
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!nearNode) {
     return NS_OK;
   }
   EditorDOMPoint pt = GetGoodSelPointForNode(*nearNode, aAction);
-  rv = aSelection->Collapse(pt.node, pt.offset);
+  rv = aSelection->Collapse(pt.Container(), pt.Offset());
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   return NS_OK;
 }
 
 
 nsresult
--- a/editor/libeditor/HTMLEditRules.h
+++ b/editor/libeditor/HTMLEditRules.h
@@ -2,16 +2,17 @@
 /* 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/. */
 
 #ifndef HTMLEditRules_h
 #define HTMLEditRules_h
 
 #include "TypeInState.h"
+#include "mozilla/EditorDOMPoint.h" // for EditorDOMPoint
 #include "mozilla/SelectionState.h"
 #include "mozilla/TextEditRules.h"
 #include "nsCOMPtr.h"
 #include "nsIEditActionListener.h"
 #include "nsIEditor.h"
 #include "nsIHTMLEditor.h"
 #include "nsISupportsImpl.h"
 #include "nsTArray.h"
@@ -27,17 +28,16 @@ class nsINode;
 class nsRange;
 
 namespace mozilla {
 
 class EditActionResult;
 class HTMLEditor;
 class RulesInfo;
 class TextEditor;
-struct EditorDOMPoint;
 namespace dom {
 class Element;
 class Selection;
 } // namespace dom
 
 struct StyleCache final : public PropItem
 {
   bool mPresent;
@@ -184,18 +184,18 @@ protected:
    *
    * @param aNode           Reference to a block parent.
    * @param aInsertMozBR    true if this should insert a moz-<br> element.
    *                        Otherwise, i.e., this should insert a normal <br>
    *                        element, false.
    */
   nsresult InsertBRIfNeededInternal(nsINode& aNode, bool aInsertMozBR);
 
-  mozilla::EditorDOMPoint GetGoodSelPointForNode(nsINode& aNode,
-                                                 nsIEditor::EDirection aAction);
+  EditorDOMPoint GetGoodSelPointForNode(nsINode& aNode,
+                                        nsIEditor::EDirection aAction);
 
   /**
    * TryToJoinBlocks() tries to join two block elements.  The right element is
    * always joined to the left element.  If the elements are the same type and
    * not nested within each other, JoinNodesSmart() is called (example, joining
    * two list items together into one).  If the elements are not the same type,
    * or one is a descendant of the other, we instead destroy the right block
    * placing its children into leftblock.  DTD containment rules are followed
@@ -350,17 +350,17 @@ protected:
   nsresult GetNodesForOperation(
              nsTArray<RefPtr<nsRange>>& aArrayOfRanges,
              nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
              EditAction aOperationType,
              TouchContent aTouchContent = TouchContent::yes);
   void GetChildNodesForOperation(
          nsINode& aNode,
          nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes);
-  nsresult GetNodesFromPoint(EditorDOMPoint aPoint,
+  nsresult GetNodesFromPoint(const EditorDOMPoint& aPoint,
                              EditAction aOperation,
                              nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
                              TouchContent aTouchContent);
   nsresult GetNodesFromSelection(
              Selection& aSelection,
              EditAction aOperation,
              nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
              TouchContent aTouchContent = TouchContent::yes);
--- a/editor/libeditor/WSRunObject.cpp
+++ b/editor/libeditor/WSRunObject.cpp
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WSRunObject.h"
 
 #include "TextEditUtils.h"
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Casting.h"
+#include "mozilla/EditorDOMPoint.h"
 #include "mozilla/EditorUtils.h"
 #include "mozilla/HTMLEditor.h"
 #include "mozilla/mozalloc.h"
 #include "mozilla/OwningNonNull.h"
 #include "mozilla/SelectionState.h"
 
 #include "nsAString.h"
 #include "nsCRT.h"
@@ -645,45 +646,44 @@ WSRunObject::GetWSNodes()
           mFirstNBSPNode = textNode;
           mFirstNBSPOffset = pos;
           // also keep track of latest nbsp so far
           if (!mLastNBSPNode) {
             mLastNBSPNode = textNode;
             mLastNBSPOffset = pos;
           }
         }
-        start.node = textNode;
-        start.offset = pos;
+        start.Set(textNode, pos);
       }
     }
   }
 
   while (!mStartNode) {
     // we haven't found the start of ws yet.  Keep looking
     nsCOMPtr<nsIContent> priorNode = GetPreviousWSNode(start, wsBoundingParent);
     if (priorNode) {
       if (IsBlockNode(priorNode)) {
-        mStartNode = start.node;
-        mStartOffset = start.offset;
+        mStartNode = start.Container();
+        mStartOffset = start.Offset();
         mStartReason = WSType::otherBlock;
         mStartReasonNode = priorNode;
       } else if (priorNode->IsNodeOfType(nsINode::eTEXT) &&
                  priorNode->IsEditable()) {
         RefPtr<Text> textNode = priorNode->GetAsText();
         mNodeArray.InsertElementAt(0, textNode);
         const nsTextFragment *textFrag;
         if (!textNode || !(textFrag = textNode->GetText())) {
           return NS_ERROR_NULL_POINTER;
         }
         uint32_t len = textNode->TextLength();
 
         if (len < 1) {
           // Zero length text node. Set start point to it
           // so we can get past it!
-          start.SetPoint(priorNode, 0);
+          start.Set(priorNode, 0);
         } else {
           for (int32_t pos = len - 1; pos >= 0; pos--) {
             // sanity bounds check the char position.  bug 136165
             if (uint32_t(pos) >= textFrag->GetLength()) {
               NS_NOTREACHED("looking beyond end of text fragment");
               continue;
             }
             char16_t theChar = textFrag->CharAt(pos);
@@ -699,35 +699,35 @@ WSRunObject::GetWSNodes()
               mFirstNBSPNode = textNode;
               mFirstNBSPOffset = pos;
               // also keep track of latest nbsp so far
               if (!mLastNBSPNode) {
                 mLastNBSPNode = textNode;
                 mLastNBSPOffset = pos;
               }
             }
-            start.SetPoint(textNode, pos);
+            start.Set(textNode, pos);
           }
         }
       } else {
         // it's a break or a special node, like <img>, that is not a block and not
         // a break but still serves as a terminator to ws runs.
-        mStartNode = start.node;
-        mStartOffset = start.offset;
+        mStartNode = start.Container();
+        mStartOffset = start.Offset();
         if (TextEditUtils::IsBreak(priorNode)) {
           mStartReason = WSType::br;
         } else {
           mStartReason = WSType::special;
         }
         mStartReasonNode = priorNode;
       }
     } else {
       // no prior node means we exhausted wsBoundingParent
-      mStartNode = start.node;
-      mStartOffset = start.offset;
+      mStartNode = start.Container();
+      mStartOffset = start.Offset();
       mStartReason = WSType::thisBlock;
       mStartReasonNode = wsBoundingParent;
     }
   }
 
   // then look ahead to find following ws nodes
   if (RefPtr<Text> textNode = mNode->GetAsText()) {
     // don't need to put it on list. it already is from code above
@@ -754,45 +754,45 @@ WSRunObject::GetWSNodes()
           mLastNBSPNode = textNode;
           mLastNBSPOffset = pos;
           // also keep track of earliest nbsp so far
           if (!mFirstNBSPNode) {
             mFirstNBSPNode = textNode;
             mFirstNBSPOffset = pos;
           }
         }
-        end.SetPoint(textNode, pos + 1);
+        end.Set(textNode, pos + 1);
       }
     }
   }
 
   while (!mEndNode) {
     // we haven't found the end of ws yet.  Keep looking
     nsCOMPtr<nsIContent> nextNode = GetNextWSNode(end, wsBoundingParent);
     if (nextNode) {
       if (IsBlockNode(nextNode)) {
         // we encountered a new block.  therefore no more ws.
-        mEndNode = end.node;
-        mEndOffset = end.offset;
+        mEndNode = end.Container();
+        mEndOffset = end.Offset();
         mEndReason = WSType::otherBlock;
         mEndReasonNode = nextNode;
       } else if (nextNode->IsNodeOfType(nsINode::eTEXT) &&
                  nextNode->IsEditable()) {
         RefPtr<Text> textNode = nextNode->GetAsText();
         mNodeArray.AppendElement(textNode);
         const nsTextFragment *textFrag;
         if (!textNode || !(textFrag = textNode->GetText())) {
           return NS_ERROR_NULL_POINTER;
         }
         uint32_t len = textNode->TextLength();
 
         if (len < 1) {
           // Zero length text node. Set end point to it
           // so we can get past it!
-          end.SetPoint(textNode, 0);
+          end.Set(textNode, 0);
         } else {
           for (uint32_t pos = 0; pos < len; pos++) {
             // sanity bounds check the char position.  bug 136165
             if (pos >= textFrag->GetLength()) {
               NS_NOTREACHED("looking beyond end of text fragment");
               continue;
             }
             char16_t theChar = textFrag->CharAt(pos);
@@ -808,36 +808,36 @@ WSRunObject::GetWSNodes()
               mLastNBSPNode = textNode;
               mLastNBSPOffset = pos;
               // also keep track of earliest nbsp so far
               if (!mFirstNBSPNode) {
                 mFirstNBSPNode = textNode;
                 mFirstNBSPOffset = pos;
               }
             }
-            end.SetPoint(textNode, pos + 1);
+            end.Set(textNode, pos + 1);
           }
         }
       } else {
         // we encountered a break or a special node, like <img>,
         // that is not a block and not a break but still
         // serves as a terminator to ws runs.
-        mEndNode = end.node;
-        mEndOffset = end.offset;
+        mEndNode = end.Container();
+        mEndOffset = end.Offset();
         if (TextEditUtils::IsBreak(nextNode)) {
           mEndReason = WSType::br;
         } else {
           mEndReason = WSType::special;
         }
         mEndReasonNode = nextNode;
       }
     } else {
       // no next node means we exhausted wsBoundingParent
-      mEndNode = end.node;
-      mEndOffset = end.offset;
+      mEndNode = end.Container();
+      mEndOffset = end.Offset();
       mEndReason = WSType::thisBlock;
       mEndReasonNode = wsBoundingParent;
     }
   }
 
   return NS_OK;
 }
 
@@ -1028,45 +1028,50 @@ WSRunObject::GetPreviousWSNodeInner(nsIN
       return child;
     }
   }
   // Else return the node itself
   return priorNode;
 }
 
 nsIContent*
-WSRunObject::GetPreviousWSNode(EditorDOMPoint aPoint,
+WSRunObject::GetPreviousWSNode(const EditorDOMPoint& aPoint,
                                nsINode* aBlockParent)
 {
   // Can't really recycle various getnext/prior routines because we
   // have special needs here.  Need to step into inline containers but
   // not block containers.
-  MOZ_ASSERT(aPoint.node && aBlockParent);
+  MOZ_ASSERT(aPoint.IsSet() && aBlockParent);
 
-  if (aPoint.node->NodeType() == nsIDOMNode::TEXT_NODE) {
-    return GetPreviousWSNodeInner(aPoint.node, aBlockParent);
+  if (aPoint.Container()->NodeType() == nsIDOMNode::TEXT_NODE) {
+    return GetPreviousWSNodeInner(aPoint.Container(), aBlockParent);
   }
-  if (!mHTMLEditor->IsContainer(aPoint.node)) {
-    return GetPreviousWSNodeInner(aPoint.node, aBlockParent);
+  if (!mHTMLEditor->IsContainer(aPoint.Container())) {
+    return GetPreviousWSNodeInner(aPoint.Container(), aBlockParent);
   }
 
-  if (!aPoint.offset) {
-    if (aPoint.node == aBlockParent) {
+  if (!aPoint.Offset()) {
+    if (aPoint.Container() == aBlockParent) {
       // We are at start of the block.
       return nullptr;
     }
 
     // We are at start of non-block container
-    return GetPreviousWSNodeInner(aPoint.node, aBlockParent);
+    return GetPreviousWSNodeInner(aPoint.Container(), aBlockParent);
   }
 
-  nsCOMPtr<nsIContent> startContent = do_QueryInterface(aPoint.node);
-  NS_ENSURE_TRUE(startContent, nullptr);
-  nsCOMPtr<nsIContent> priorNode = startContent->GetChildAt(aPoint.offset - 1);
-  NS_ENSURE_TRUE(priorNode, nullptr);
+  if (NS_WARN_IF(!aPoint.Container()->IsContent())) {
+    return nullptr;
+  }
+
+  nsCOMPtr<nsIContent> priorNode = aPoint.GetPreviousSiblingOfChildAtOffset();
+  if (NS_WARN_IF(!priorNode)) {
+    return nullptr;
+  }
+
   // We have a prior node.  If it's a block, return it.
   if (IsBlockNode(priorNode)) {
     return priorNode;
   }
   if (mHTMLEditor->IsContainer(priorNode)) {
     // Else if it's a container, get deep rightmost child
     nsCOMPtr<nsIContent> child = mHTMLEditor->GetRightmostChild(priorNode);
     if (child) {
@@ -1112,43 +1117,44 @@ WSRunObject::GetNextWSNodeInner(nsINode*
       return child;
     }
   }
   // Else return the node itself
   return nextNode;
 }
 
 nsIContent*
-WSRunObject::GetNextWSNode(EditorDOMPoint aPoint,
+WSRunObject::GetNextWSNode(const EditorDOMPoint& aPoint,
                            nsINode* aBlockParent)
 {
   // Can't really recycle various getnext/prior routines because we have
   // special needs here.  Need to step into inline containers but not block
   // containers.
-  MOZ_ASSERT(aPoint.node && aBlockParent);
+  MOZ_ASSERT(aPoint.IsSet() && aBlockParent);
 
-  if (aPoint.node->NodeType() == nsIDOMNode::TEXT_NODE) {
-    return GetNextWSNodeInner(aPoint.node, aBlockParent);
+  if (aPoint.Container()->NodeType() == nsIDOMNode::TEXT_NODE) {
+    return GetNextWSNodeInner(aPoint.Container(), aBlockParent);
   }
-  if (!mHTMLEditor->IsContainer(aPoint.node)) {
-    return GetNextWSNodeInner(aPoint.node, aBlockParent);
+  if (!mHTMLEditor->IsContainer(aPoint.Container())) {
+    return GetNextWSNodeInner(aPoint.Container(), aBlockParent);
   }
 
-  nsCOMPtr<nsIContent> startContent = do_QueryInterface(aPoint.node);
-  NS_ENSURE_TRUE(startContent, nullptr);
+  if (NS_WARN_IF(!aPoint.Container()->IsContent())) {
+    return nullptr;
+  }
 
-  nsCOMPtr<nsIContent> nextNode = startContent->GetChildAt(aPoint.offset);
+  nsCOMPtr<nsIContent> nextNode = aPoint.GetChildAtOffset();
   if (!nextNode) {
-    if (aPoint.node == aBlockParent) {
+    if (aPoint.Container() == aBlockParent) {
       // We are at end of the block.
       return nullptr;
     }
 
     // We are at end of non-block container
-    return GetNextWSNodeInner(aPoint.node, aBlockParent);
+    return GetNextWSNodeInner(aPoint.Container(), aBlockParent);
   }
 
   // We have a next node.  If it's a block, return it.
   if (IsBlockNode(nextNode)) {
     return nextNode;
   }
   if (mHTMLEditor->IsContainer(nextNode)) {
     // else if it's a container, get deep leftmost child
--- a/editor/libeditor/WSRunObject.h
+++ b/editor/libeditor/WSRunObject.h
@@ -7,24 +7,24 @@
 #define WSRunObject_h
 
 #include "nsCOMPtr.h"
 #include "nsIEditor.h" // for EDirection
 #include "nsINode.h"
 #include "nscore.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/Text.h"
+#include "mozilla/EditorDOMPoint.h" // for EditorDOMPoint
 
 class nsIDOMNode;
 
 namespace mozilla {
 
 class HTMLEditor;
 class HTMLEditRules;
-struct EditorDOMPoint;
 
 // class WSRunObject represents the entire whitespace situation
 // around a given point.  It collects up a list of nodes that contain
 // whitespace and categorizes in up to 3 different WSFragments (detailed
 // below).  Each WSFragment is a collection of whitespace that is
 // either all insignificant, or that is significant.  A WSFragment could
 // consist of insignificant whitespace because it is after a block
 // boundary or after a break.  Or it could be insignificant because it
@@ -317,19 +317,21 @@ protected:
   nsINode* GetWSBoundingParent();
 
   nsresult GetWSNodes();
   void GetRuns();
   void ClearRuns();
   void MakeSingleWSRun(WSType aType);
   nsIContent* GetPreviousWSNodeInner(nsINode* aStartNode,
                                      nsINode* aBlockParent);
-  nsIContent* GetPreviousWSNode(EditorDOMPoint aPoint, nsINode* aBlockParent);
+  nsIContent* GetPreviousWSNode(const EditorDOMPoint& aPoint,
+                                nsINode* aBlockParent);
   nsIContent* GetNextWSNodeInner(nsINode* aStartNode, nsINode* aBlockParent);
-  nsIContent* GetNextWSNode(EditorDOMPoint aPoint, nsINode* aBlockParent);
+  nsIContent* GetNextWSNode(const EditorDOMPoint& aPoint,
+                            nsINode* aBlockParent);
   nsresult PrepareToDeleteRangePriv(WSRunObject* aEndObject);
   nsresult PrepareToSplitAcrossBlocksPriv();
   nsresult DeleteChars(nsINode* aStartNode, int32_t aStartOffset,
                        nsINode* aEndNode, int32_t aEndOffset);
   WSPoint GetCharAfter(nsINode* aNode, int32_t aOffset);
   WSPoint GetCharBefore(nsINode* aNode, int32_t aOffset);
   WSPoint GetCharAfter(const WSPoint& aPoint);
   WSPoint GetCharBefore(const WSPoint& aPoint);
--- a/editor/libeditor/moz.build
+++ b/editor/libeditor/moz.build
@@ -17,16 +17,17 @@ EXPORTS += [
     'nsIEditRules.h',
 ]
 
 EXPORTS.mozilla += [
     'ChangeStyleTransaction.h',
     'CSSEditUtils.h',
     'EditorBase.h',
     'EditorController.h',
+    'EditorDOMPoint.h',
     'EditorUtils.h',
     'EditTransactionBase.h',
     'HTMLEditor.h',
     'ManualNAC.h',
     'SelectionState.h',
     'TextEditor.h',
     'TextEditRules.h',
 ]
--- a/gfx/gl/GLBlitHelper.h
+++ b/gfx/gl/GLBlitHelper.h
@@ -31,17 +31,16 @@ class MacIOSurfaceImage;
 class SurfaceDescriptorD3D10;
 class SurfaceDescriptorDXGIYCbCr;
 } // namespace layers
 
 namespace gl {
 
 class BindAnglePlanes;
 class GLContext;
-class GLBlitHelper;
 
 bool
 GuessDivisors(const gfx::IntSize& ySize, const gfx::IntSize& uvSize,
               gfx::IntSize* const out_divisors);
 
 template<uint8_t N>
 struct Mat
 {
--- a/gfx/vr/VRDisplayClient.cpp
+++ b/gfx/vr/VRDisplayClient.cpp
@@ -28,17 +28,16 @@ using namespace mozilla;
 using namespace mozilla::gfx;
 
 VRDisplayClient::VRDisplayClient(const VRDisplayInfo& aDisplayInfo)
   : mDisplayInfo(aDisplayInfo)
   , bLastEventWasMounted(false)
   , bLastEventWasPresenting(false)
   , mPresentationCount(0)
   , mLastEventFrameId(0)
-  , mLastPresentingGeneration(0)
 {
   MOZ_COUNT_CTOR(VRDisplayClient);
 }
 
 VRDisplayClient::~VRDisplayClient() {
   MOZ_COUNT_DTOR(VRDisplayClient);
 }
 
@@ -73,32 +72,16 @@ VRDisplayClient::ZeroSensor()
 
 void
 VRDisplayClient::SetGroupMask(uint32_t aGroupMask)
 {
   VRManagerChild *vm = VRManagerChild::Get();
   vm->SendSetGroupMask(mDisplayInfo.mDisplayID, aGroupMask);
 }
 
-bool
-VRDisplayClient::IsPresentationGenerationCurrent() const
-{
-  if (mLastPresentingGeneration != mDisplayInfo.mPresentingGeneration) {
-    return false;
-  }
-
-  return true;
-}
-
-void
-VRDisplayClient::MakePresentationGenerationCurrent()
-{
-  mLastPresentingGeneration = mDisplayInfo.mPresentingGeneration;
-}
-
 void
 VRDisplayClient::FireEvents()
 {
   VRManagerChild *vm = VRManagerChild::Get();
   // Only fire these events for non-chrome VR sessions
   bool isPresenting = (mDisplayInfo.mPresentingGroups & kVRGroupContent) != 0;
 
   // Check if we need to trigger onVRDisplayPresentChange event
--- a/gfx/vr/VRDisplayClient.h
+++ b/gfx/vr/VRDisplayClient.h
@@ -39,32 +39,28 @@ public:
                                                             uint32_t aGroup);
   void PresentationDestroyed();
 
   bool GetIsConnected() const;
 
   void NotifyDisconnected();
   void SetGroupMask(uint32_t aGroupMask);
 
-  bool IsPresentationGenerationCurrent() const;
-  void MakePresentationGenerationCurrent();
-
 protected:
   virtual ~VRDisplayClient();
 
   void FireEvents();
 
   VRDisplayInfo mDisplayInfo;
 
   bool bLastEventWasMounted;
   bool bLastEventWasPresenting;
 
   int mPresentationCount;
   uint64_t mLastEventFrameId;
-  uint32_t mLastPresentingGeneration;
 private:
   VRSubmitFrameResultInfo mSubmitFrameResult;
 };
 
 } // namespace gfx
 } // namespace mozilla
 
 #endif /* GFX_VR_DISPLAY_CLIENT_H */
--- a/gfx/vr/VRDisplayHost.cpp
+++ b/gfx/vr/VRDisplayHost.cpp
@@ -67,17 +67,16 @@ VRDisplayHost::VRDisplayHost(VRDeviceTyp
  , mFrameStarted(false)
 {
   MOZ_COUNT_CTOR(VRDisplayHost);
   mDisplayInfo.mType = aType;
   mDisplayInfo.mDisplayID = VRSystemManager::AllocateDisplayID();
   mDisplayInfo.mPresentingGroups = 0;
   mDisplayInfo.mGroupMask = kVRGroupContent;
   mDisplayInfo.mFrameId = 0;
-  mDisplayInfo.mPresentingGeneration = 0;
 }
 
 VRDisplayHost::~VRDisplayHost()
 {
   MOZ_COUNT_DTOR(VRDisplayHost);
 }
 
 #if defined(XP_WIN)
@@ -329,33 +328,24 @@ VRDisplayHost::SubmitFrame(VRLayerParent
       }
       IntSize texSize = gfx::IntSize(surf->GetDevicePixelWidth(),
                                      surf->GetDevicePixelHeight());
       if (!SubmitFrame(surf, texSize, aLeftEyeRect, aRightEyeRect)) {
         return;
       }
       break;
     }
-#elif defined(MOZ_ANDROID_GOOGLE_VR)
-    case SurfaceDescriptor::TEGLImageDescriptor: {
-       const EGLImageDescriptor& desc = aTexture.get_EGLImageDescriptor();
-       if (!SubmitFrame(&desc, aLeftEyeRect, aRightEyeRect)) {
-         return;
-       }
-       break;
-    }
 #endif
     default: {
       NS_WARNING("Unsupported SurfaceDescriptor type for VR layer texture");
       return;
     }
   }
 
-#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_ANDROID_GOOGLE_VR)
-
+#if defined(XP_WIN) || defined(XP_MACOSX)
   /**
    * Trigger the next VSync immediately after we are successfully
    * submitting frames.  As SubmitFrame is responsible for throttling
    * the render loop, if we don't successfully call it, we shouldn't trigger
    * NotifyVRVsync immediately, as it will run unbounded.
    * If NotifyVRVsync is not called here due to SubmitFrame failing, the
    * fallback "watchdog" code in VRDisplayHost::NotifyVSync() will cause
    * frames to continue at a lower refresh rate until frame submission
--- a/gfx/vr/VRDisplayHost.h
+++ b/gfx/vr/VRDisplayHost.h
@@ -80,20 +80,16 @@ protected:
                            const IntSize& aSize,
                            const gfx::Rect& aLeftEyeRect,
                            const gfx::Rect& aRightEyeRect) = 0;
 #elif defined(XP_MACOSX)
   virtual bool SubmitFrame(MacIOSurface* aMacIOSurface,
                            const IntSize& aSize,
                            const gfx::Rect& aLeftEyeRect,
                            const gfx::Rect& aRightEyeRect) = 0;
-#elif defined(MOZ_ANDROID_GOOGLE_VR)
-  virtual bool SubmitFrame(const mozilla::layers::EGLImageDescriptor* aDescriptor,
-                           const gfx::Rect& aLeftEyeRect,
-                           const gfx::Rect& aRightEyeRect) = 0;
 #endif
 
   VRDisplayInfo mDisplayInfo;
 
   nsTArray<RefPtr<VRLayerParent>> mLayers;
   // Weak reference to mLayers entries are cleared in
   // VRLayerParent destructor
 
--- a/gfx/vr/VRManager.cpp
+++ b/gfx/vr/VRManager.cpp
@@ -20,20 +20,16 @@
 #include "gfxVR.h"
 #if defined(XP_WIN)
 #include "gfxVROculus.h"
 #endif
 #if defined(XP_WIN) || defined(XP_MACOSX) || (defined(XP_LINUX) && !defined(MOZ_WIDGET_ANDROID))
 #include "gfxVROpenVR.h"
 #include "gfxVROSVR.h"
 #endif
-#if defined(MOZ_ANDROID_GOOGLE_VR)
-#include "gfxVRGVR.h"
-#endif // MOZ_ANDROID_GOOGLE_VR
-
 #include "gfxVRPuppet.h"
 #include "ipc/VRLayerParent.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::layers;
 using namespace mozilla::gl;
 
@@ -92,24 +88,16 @@ VRManager::VRManager()
   }
 
   // OSVR is cross platform compatible
   mgr = VRSystemManagerOSVR::Create();
   if (mgr) {
       mManagers.AppendElement(mgr);
   }
 #endif
-
-#if defined(MOZ_ANDROID_GOOGLE_VR)
-   mgr = VRSystemManagerGVR::Create();
-   if (mgr) {
-     mManagers.AppendElement(mgr);
-   }
-#endif // defined(MOZ_ANDROID_GOOGLE_VR)
-
   // Enable gamepad extensions while VR is enabled.
   // Preference only can be set at the Parent process.
   if (XRE_IsParentProcess() && gfxPrefs::VREnabled()) {
     Preferences::SetBool("dom.gamepad.extensions.enabled", true);
   }
 }
 
 VRManager::~VRManager()
--- a/gfx/vr/gfxVR.h
+++ b/gfx/vr/gfxVR.h
@@ -30,17 +30,16 @@ namespace gfx {
 class VRLayerParent;
 class VRDisplayHost;
 class VRControllerHost;
 
 enum class VRDeviceType : uint16_t {
   Oculus,
   OpenVR,
   OSVR,
-  GVR,
   Puppet,
   NumVRDeviceTypes
 };
 
 enum class VRDisplayCapabilityFlags : uint16_t {
   Cap_None = 0,
   /**
    * Cap_Position is set if the VRDisplay is capable of tracking its position.
@@ -217,17 +216,16 @@ struct VRDisplayInfo
   IntSize mEyeResolution;
   bool mIsConnected;
   bool mIsMounted;
   uint32_t mPresentingGroups;
   uint32_t mGroupMask;
   Size mStageSize;
   Matrix4x4 mSittingToStandingTransform;
   uint64_t mFrameId;
-  uint32_t mPresentingGeneration;
   VRHMDSensorState mLastSensorState[kVRMaxLatencyFrames];
 
   bool operator==(const VRDisplayInfo& other) const {
     for (size_t i = 0; i < kVRMaxLatencyFrames; i++) {
       if (mLastSensorState[i] != other.mLastSensorState[i]) {
         return false;
       }
     }
@@ -241,18 +239,17 @@ struct VRDisplayInfo
            mPresentingGroups == other.mPresentingGroups &&
            mGroupMask == other.mGroupMask &&
            mEyeFOV[0] == other.mEyeFOV[0] &&
            mEyeFOV[1] == other.mEyeFOV[1] &&
            mEyeTranslation[0] == other.mEyeTranslation[0] &&
            mEyeTranslation[1] == other.mEyeTranslation[1] &&
            mStageSize == other.mStageSize &&
            mSittingToStandingTransform == other.mSittingToStandingTransform &&
-           mFrameId == other.mFrameId &&
-           mPresentingGeneration == other.mPresentingGeneration;
+           mFrameId == other.mFrameId;
   }
 
   bool operator!=(const VRDisplayInfo& other) const {
     return !(*this == other);
   }
 
   const VRHMDSensorState& GetSensorState() const
   {
deleted file mode 100644
--- a/gfx/vr/gfxVRGVR.cpp
+++ /dev/null
@@ -1,799 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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 <math.h>
-
-#include "GLBlitHelper.h"
-#include "GLContextEGL.h"
-#include "GLContextProvider.h"
-#include "GLContextTypes.h"
-#include "GLImages.h"
-#include "GLLibraryEGL.h"
-
-#include "gfxPrefs.h"
-#include "gfxVRGVRAPI.h"
-#include "gfxVRGVR.h"
-
-#include "mozilla/dom/GamepadEventTypes.h"
-#include "mozilla/dom/GamepadBinding.h"
-#include "mozilla/gfx/Matrix.h"
-#include "mozilla/gfx/Quaternion.h"
-#include "mozilla/jni/Utils.h"
-#include "mozilla/layers/CompositorThread.h"
-#include "mozilla/layers/TextureHostOGL.h"
-#include "mozilla/Preferences.h"
-
-#include "GeckoVRManager.h"
-#include "nsString.h"
-
-#include "SurfaceTypes.h"
-
-#include "VRManager.h"
-
-#define MOZ_CHECK_GVR_ERRORS
-
-#if defined(MOZ_CHECK_GVR_ERRORS)
-#define GVR_LOGTAG "GeckoWebVR"
-#include <android/log.h>
-#define GVR_CHECK(X) X; \
-{ \
-  gvr_context* context = (mPresentingContext ? mPresentingContext : GetNonPresentingContext()); \
-  if (context && (gvr_get_error(context) != GVR_ERROR_NONE)) { \
-     __android_log_print(ANDROID_LOG_ERROR, GVR_LOGTAG, \
-                         "GVR ERROR: %s at%s:%s:%d", \
-                         gvr_get_error_string(gvr_get_error(context)), \
-                         __FILE__, __FUNCTION__, __LINE__); \
-    gvr_clear_error(context); \
-  } else if (!context) { \
-    __android_log_print(ANDROID_LOG_ERROR, GVR_LOGTAG, \
-                        "UNABLE TO CHECK GVR ERROR: NO CONTEXT"); \
-  } \
-}
-#define GVR_LOG(format, ...) __android_log_print(ANDROID_LOG_INFO, GVR_LOGTAG, format, ##__VA_ARGS__);
-#else
-#define GVR_CHECK(X) X
-#define GVR_LOG(...)
-#endif
-
-using namespace mozilla;
-using namespace mozilla::gl;
-using namespace mozilla::gfx;
-using namespace mozilla::gfx::impl;
-using namespace mozilla::layers;
-using namespace mozilla::dom;
-
-namespace {
-static VRDisplayGVR* sContextObserver;
-static RefPtr<GLContextEGL> sGLContextEGL;
-static gvr_context* sNonPresentingContext;
-
-gvr_context*
-GetNonPresentingContext() {
-  if (!sNonPresentingContext) {
-    // Try and restore if it has been lost
-    sNonPresentingContext = (gvr_context*)GeckoVRManager::CreateGVRNonPresentingContext();
-  }
-  return sNonPresentingContext;
-}
-
-class SynchronousRunnable : public nsIRunnable {
-public:
-  enum class Type {
-    PresentingContext,
-    NonPresentingContext,
-    Pause,
-    Resume
-  };
-  SynchronousRunnable(const Type aType, void* aContext)
-  : mType(aType)
-  , mContext(aContext)
-  , mUpdateMonitor(new Monitor("SynchronousRunnable_for_Android"))
-  , mUpdated(false)
-  {}
-  NS_DECL_THREADSAFE_ISUPPORTS
-  nsresult Run() override
-  {
-    MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
-    MonitorAutoLock lock(*mUpdateMonitor);
-    if (mType == Type::PresentingContext) {
-      SetGVRPresentingContext(mContext);
-    } else if (mType == Type::NonPresentingContext) {
-      CleanupGVRNonPresentingContext();
-    } else if (mType == Type::Pause) {
-      SetGVRPaused(true);
-    } else if (mType == Type::Resume) {
-      SetGVRPaused(false);
-    } else {
-      GVR_LOG("UNKNOWN SynchronousRunnable::Type!");
-    }
-    mUpdated = true;
-    lock.NotifyAll();
-    return NS_OK;
-  }
-  void Wait()
-  {
-    MonitorAutoLock lock(*mUpdateMonitor);
-    while(!mUpdated) {
-      lock.Wait();
-    }
-  }
-
-  static bool Dispatch(const Type aType, void* aContext)
-  {
-    if (!CompositorThreadHolder::IsInCompositorThread()) {
-      RefPtr<SynchronousRunnable> runnable = new SynchronousRunnable(aType, aContext);
-      CompositorThreadHolder::Loop()->PostTask(do_AddRef(runnable));
-      runnable->Wait();
-      return true;
-    }
-
-    return false;
-  }
-
-protected:
-  virtual ~SynchronousRunnable()
-  {
-    delete mUpdateMonitor;
-  }
-
-  Type mType;
-  void* mContext;
-  Monitor* mUpdateMonitor;
-  bool mUpdated;
-};
-
-}
-
-NS_IMPL_ISUPPORTS(SynchronousRunnable, nsIRunnable)
-
-void
-mozilla::gfx::SetGVRPresentingContext(void* aGVRPresentingContext)
-{
-  if (SynchronousRunnable::Dispatch(SynchronousRunnable::Type::PresentingContext, aGVRPresentingContext)) {
-    GVR_LOG("Done waiting for compositor thread to set presenting context.");
-    return;
-  }
-
-  MOZ_ASSERT(sContextObserver);
-  if (!sGLContextEGL && aGVRPresentingContext) {
-    CreateContextFlags flags = CreateContextFlags::NONE;
-    SurfaceCaps caps = SurfaceCaps::ForRGBA();
-    nsCString str;
-    sGLContextEGL = GLContextEGL::CreateEGLPBufferOffscreenContext(flags, IntSize(4, 4), caps, &str);
-    if (!sGLContextEGL->MakeCurrent()) {
-      GVR_LOG("Failed to make GL context current");
-    }
-  }
-  sContextObserver->SetPresentingContext(aGVRPresentingContext);
-}
-
-void
-mozilla::gfx::CleanupGVRNonPresentingContext()
-{
-  if (SynchronousRunnable::Dispatch(SynchronousRunnable::Type::NonPresentingContext, nullptr)) {
-    GVR_LOG("Done waiting for compositor thread to set non presenting context.");
-    return;
-  }
-
-  if (sNonPresentingContext) {
-    sNonPresentingContext = nullptr;
-    GeckoVRManager::DestroyGVRNonPresentingContext();
-  }
-}
-
-void
-mozilla::gfx::SetGVRPaused(const bool aPaused)
-{
-  if (SynchronousRunnable::Dispatch((aPaused ? SynchronousRunnable::Type::Pause : SynchronousRunnable::Type::Resume), nullptr)) {
-    GVR_LOG("Done waiting for GVR in compositor to: %s",(aPaused ? "Pause" : "Resume"));
-    return;
-  }
-  MOZ_ASSERT(sContextObserver);
-  sContextObserver->SetPaused(aPaused);
-}
-
-VRDisplayGVR::VRDisplayGVR()
-  : VRDisplayHost(VRDeviceType::GVR)
-  , mIsPresenting(false)
-  , mControllerAdded(false)
-  , mPresentingContext(nullptr)
-  , mControllerContext(nullptr)
-  , mControllerState(nullptr)
-  , mViewportList(nullptr)
-  , mLeftViewport(nullptr)
-  , mRightViewport(nullptr)
-  , mSwapChain(nullptr)
-  , mFrameBufferSize{0, 0}
-{
-  MOZ_COUNT_CTOR_INHERITED(VRDisplayGVR, VRDisplayHost);
-  MOZ_ASSERT(GetNonPresentingContext());
-  MOZ_ASSERT(!sContextObserver); // There can be only one GVR display at a time.
-  sContextObserver = this;
-
-  mDisplayInfo.mDisplayName.AssignLiteral("GVR HMD");
-  mDisplayInfo.mIsConnected = true;
-  mDisplayInfo.mIsMounted = true;
-  mDisplayInfo.mCapabilityFlags = VRDisplayCapabilityFlags::Cap_None |
-                                  VRDisplayCapabilityFlags::Cap_Orientation |
-                                  VRDisplayCapabilityFlags::Cap_Position | // Not yet...
-                                  VRDisplayCapabilityFlags::Cap_Present;
-
-  GVR_CHECK(gvr_refresh_viewer_profile(GetNonPresentingContext()));
-  mViewportList = GVR_CHECK(gvr_buffer_viewport_list_create(GetNonPresentingContext()));
-  mLeftViewport = GVR_CHECK(gvr_buffer_viewport_create(GetNonPresentingContext()));
-  mRightViewport = GVR_CHECK(gvr_buffer_viewport_create(GetNonPresentingContext()));
-  UpdateViewport();
-
-  dom::GamepadHand hand = dom::GamepadHand::Right;
-  const gvr_user_prefs* prefs = GVR_CHECK(gvr_get_user_prefs(GetNonPresentingContext()));
-  if (prefs) {
-    hand = ((gvr_user_prefs_get_controller_handedness(prefs) == GVR_CONTROLLER_RIGHT_HANDED) ?
-             dom::GamepadHand::Right : dom::GamepadHand::Left);
-  }
-  mController = new VRControllerGVR(hand, mDisplayInfo.mDisplayID);
-}
-
-VRDisplayGVR::~VRDisplayGVR()
-{
-  MOZ_COUNT_DTOR_INHERITED(VRDisplayGVR, VRDisplayHost);
-}
-
-void
-VRDisplayGVR::ZeroSensor()
-{
-}
-
-void
-VRDisplayGVR::StartPresentation()
-{
-  if (mIsPresenting) {
-    return;
-  }
-
-  mIsPresenting = true;
-  GeckoVRManager::EnableVRMode();
-}
-
-void
-VRDisplayGVR::StopPresentation()
-{
-  if (!mIsPresenting) {
-    return;
-  }
-
-  mIsPresenting = false;
-  GeckoVRManager::DisableVRMode();
-}
-
-bool
-VRDisplayGVR::SubmitFrame(const mozilla::layers::EGLImageDescriptor* aDescriptor,
-                          const gfx::Rect& aLeftEyeRect,
-                          const gfx::Rect& aRightEyeRect)
-{
-  if (!mPresentingContext) {
-    GVR_LOG("Unable to submit frame. No presenting context")
-    return false;
-  }
-  if (!sGLContextEGL) {
-    GVR_LOG("Unable to submit frame. No GL Context");
-    return false;
-  }
-
-  if (!sGLContextEGL->MakeCurrent()) {
-    GVR_LOG("Failed to make GL context current");
-    return false;
-  }
-
-  EGLImage image = (EGLImage)aDescriptor->image();
-  EGLSync sync = (EGLSync)aDescriptor->fence();
-  gfx::IntSize size = aDescriptor->size();
-  MOZ_ASSERT(mSwapChain);
-  GVR_CHECK(gvr_get_recommended_buffer_viewports(mPresentingContext, mViewportList));
-  if ((size.width != mFrameBufferSize.width) || (size.height != mFrameBufferSize.height)) {
-    mFrameBufferSize.width = size.width;
-    mFrameBufferSize.height = size.height;
-    GVR_CHECK(gvr_swap_chain_resize_buffer(mSwapChain, 0, mFrameBufferSize));
-    GVR_LOG("Resize Swap Chain %d,%d", mFrameBufferSize.width, mFrameBufferSize.height);
-  }
-  gvr_frame* frame = GVR_CHECK(gvr_swap_chain_acquire_frame(mSwapChain));
-  if (!frame) {
-    // Sometimes the swap chain seems to not initialized correctly so that
-    // frames can not be acquired. Recreating the swap chain seems to fix the
-    // issue.
-    GVR_LOG("Unable to acquire GVR frame. Recreating swap chain.");
-    RecreateSwapChain();
-    return false;
-  }
-  GVR_CHECK(gvr_frame_bind_buffer(frame, 0));
-
-  EGLint status = LOCAL_EGL_CONDITION_SATISFIED;
-
-  if (sync) {
-    MOZ_ASSERT(sEGLLibrary.IsExtensionSupported(GLLibraryEGL::KHR_fence_sync));
-    status = sEGLLibrary.fClientWaitSync(EGL_DISPLAY(), sync, 0, LOCAL_EGL_FOREVER);
-  }
-
-  if (status != LOCAL_EGL_CONDITION_SATISFIED) {
-    MOZ_ASSERT(status != 0,
-               "ClientWaitSync generated an error. Has sync already been destroyed?");
-    return false;
-  }
-
-  if (image) {
-    GLuint tex = 0;
-    sGLContextEGL->fGenTextures(1, &tex);
-
-    const ScopedSaveMultiTex saveTex(sGLContextEGL, 1, LOCAL_GL_TEXTURE_2D);
-    sGLContextEGL->fBindTexture(LOCAL_GL_TEXTURE_2D, tex);
-    sGLContextEGL->TexParams_SetClampNoMips();
-    sGLContextEGL->fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, image);
-    sGLContextEGL->BlitHelper()->DrawBlitTextureToFramebuffer(tex, gfx::IntSize(size.width, size.height), gfx::IntSize(mFrameBufferSize.width,  mFrameBufferSize.height));
-    sGLContextEGL->fDeleteTextures(1, &tex);
-  } else {
-    GVR_LOG("Unable to submit frame. Unable to extract EGLImage");
-    return false;
-  }
-  GVR_CHECK(gvr_frame_unbind(frame));
-  GVR_CHECK(gvr_frame_submit(&frame, mViewportList, mHeadMatrix));
-  return true;
-}
-
-void
-VRDisplayGVR::NotifyVSync()
-{
-  VRDisplayHost::NotifyVSync();
-}
-
-static void
-FillMatrix(gfx::Matrix4x4 &target, const gvr_mat4f& source)
-{
-  target._11 = source.m[0][0];
-  target._12 = source.m[0][1];
-  target._13 = source.m[0][2];
-  target._14 = source.m[0][3];
-  target._21 = source.m[1][0];
-  target._22 = source.m[1][1];
-  target._23 = source.m[1][2];
-  target._24 = source.m[1][3];
-  target._31 = source.m[2][0];
-  target._32 = source.m[2][1];
-  target._33 = source.m[2][2];
-  target._34 = source.m[2][3];
-  target._41 = source.m[3][0];
-  target._42 = source.m[3][1];
-  target._43 = source.m[3][2];
-  target._44 = source.m[3][3];
-}
-
-VRHMDSensorState
-VRDisplayGVR::GetSensorState()
-{
-  VRHMDSensorState result{};
-
-  gvr_context* context = (mPresentingContext ? mPresentingContext : GetNonPresentingContext());
-
-  if (!context) {
-    GVR_LOG("Unable to get sensor state. Context is null");
-    return result;
-  }
-
-  gvr_clock_time_point when = GVR_CHECK(gvr_get_time_point_now());
-  if (mIsPresenting) {
-    // 50ms into the future is what GVR docs recommends using for head rotation
-    // prediction.
-    when.monotonic_system_time_nanos += 50000000;
-  }
-  mHeadMatrix = GVR_CHECK(gvr_get_head_space_from_start_space_rotation(context, when));
-  gvr_mat4f neck = GVR_CHECK(gvr_apply_neck_model(context, mHeadMatrix, 1.0));;
-
-  gfx::Matrix4x4 m;
-
-  FillMatrix(m, neck);
-  m.Invert();
-  gfx::Quaternion rot;
-  rot.SetFromRotationMatrix(m);
-
-  result.flags |= VRDisplayCapabilityFlags::Cap_Orientation;
-  result.orientation[0] = rot.x;
-  result.orientation[1] = rot.y;
-  result.orientation[2] = rot.z;
-  result.orientation[3] = rot.w;
-  result.angularVelocity[0] = 0.0f;
-  result.angularVelocity[1] = 0.0f;
-  result.angularVelocity[2] = 0.0f;
-
-  result.flags |= VRDisplayCapabilityFlags::Cap_Position;
-  result.position[0] = m._14;
-  result.position[1] = m._24;
-  result.position[2] = m._34;
-  result.linearVelocity[0] = 0.0f;
-  result.linearVelocity[1] = 0.0f;
-  result.linearVelocity[2] = 0.0f;
-
-  UpdateHeadToEye(context, &rot);
-  result.CalcViewMatrices(mHeadToEyes);
-
-  return result;
-}
-
-void
-VRDisplayGVR::SetPaused(const bool aPaused)
-{
-  if (aPaused) {
-    if (mPresentingContext) {
-      GVR_CHECK(gvr_pause_tracking(mPresentingContext));
-    } else if (sNonPresentingContext) {
-      GVR_CHECK(gvr_pause_tracking(sNonPresentingContext));
-    }
-
-    if (mControllerContext) {
-      GVR_CHECK(gvr_controller_pause(mControllerContext));
-    }
-  } else {
-    if (mPresentingContext) {
-      GVR_CHECK(gvr_refresh_viewer_profile(mPresentingContext));
-      GVR_CHECK(gvr_resume_tracking(mPresentingContext));
-    } else if (sNonPresentingContext) {
-      GVR_CHECK(gvr_resume_tracking(sNonPresentingContext));
-    }
-
-    if (mControllerContext) {
-      GVR_CHECK(gvr_controller_resume(mControllerContext));
-    }
-  }
-}
-
-void
-VRDisplayGVR::SetPresentingContext(void* aGVRPresentingContext)
-{
-  MOZ_ASSERT(sGLContextEGL);
-  sGLContextEGL->MakeCurrent();
-  mPresentingContext = (gvr_context*)aGVRPresentingContext;
-  if (mPresentingContext) {
-    GVR_CHECK(gvr_initialize_gl(mPresentingContext));
-    RecreateSwapChain();
-  } else {
-
-    if (mSwapChain) {
-      // gvr_swap_chain_destroy will set the pointer to null
-      GVR_CHECK(gvr_swap_chain_destroy(&mSwapChain));
-      MOZ_ASSERT(!mSwapChain);
-    }
-
-    // The presentation context has been destroy, probably by the user so increment the presenting
-    // generation if we are presenting so that the DOM knows to end the current presentation.
-    if (mIsPresenting) {
-      mDisplayInfo.mPresentingGeneration++;
-    }
-  }
-}
-
-void
-VRDisplayGVR::UpdateHeadToEye(gvr_context* aContext, gfx::Quaternion* aRot)
-{
-  if (!aContext) {
-    return;
-  }
-
-  for (uint32_t eyeIndex = 0; eyeIndex < 2; eyeIndex++) {
-    gvr_mat4f eye = GVR_CHECK(gvr_get_eye_from_head_matrix(aContext, eyeIndex));
-    mDisplayInfo.mEyeTranslation[eyeIndex].x = -eye.m[0][3];
-    mDisplayInfo.mEyeTranslation[eyeIndex].y = -eye.m[1][3];
-    mDisplayInfo.mEyeTranslation[eyeIndex].z = -eye.m[2][3];
-    if (aRot) {
-      mHeadToEyes[eyeIndex].SetRotationFromQuaternion(*aRot);
-    } else {
-      mHeadToEyes[eyeIndex] = gfx::Matrix4x4();
-    }
-    mHeadToEyes[eyeIndex].PreTranslate(eye.m[0][3], eye.m[1][3], eye.m[2][3]);
-  }
-}
-
-void
-VRDisplayGVR::UpdateViewport()
-{
-  gvr_context* context = (mPresentingContext ? mPresentingContext : GetNonPresentingContext());
-
-  if (!context) {
-    return;
-  }
-
-  GVR_CHECK(gvr_get_recommended_buffer_viewports(context, mViewportList));
-  GVR_CHECK(gvr_buffer_viewport_list_get_item(mViewportList, 0, mLeftViewport));
-  GVR_CHECK(gvr_buffer_viewport_list_get_item(mViewportList, 1, mRightViewport));
-
-  gvr_rectf fov = GVR_CHECK(gvr_buffer_viewport_get_source_fov(mLeftViewport));
-  mDisplayInfo.mEyeFOV[VRDisplayInfo::Eye_Left] = VRFieldOfView(fov.top, fov.right, fov.bottom, fov.left);
-  GVR_LOG("FOV:L top:%f right:%f bottom:%f left:%f",(float)fov.top, (float)fov.left, (float)fov.bottom, (float)fov.right);
-
-  fov = GVR_CHECK(gvr_buffer_viewport_get_source_fov(mRightViewport));
-  mDisplayInfo.mEyeFOV[VRDisplayInfo::Eye_Right] = VRFieldOfView(fov.top, fov.right, fov.bottom, fov.left);
-  GVR_LOG("FOV:R top:%f right:%f bottom:%f left:%f",(float)fov.top, (float)fov.left, (float)fov.bottom, (float)fov.right);
-
-  gvr_sizei size = GVR_CHECK(gvr_get_maximum_effective_render_target_size(context));
-  mDisplayInfo.mEyeResolution = IntSize(size.width / 2, size.height);
-  GVR_LOG("Eye Resolution: %dx%d",mDisplayInfo.mEyeResolution.width,mDisplayInfo.mEyeResolution.height);
-
-  UpdateHeadToEye(context);
-}
-
-void
-VRDisplayGVR::RecreateSwapChain()
-{
-  MOZ_ASSERT(sGLContextEGL);
-  sGLContextEGL->MakeCurrent();
-  if (mSwapChain) {
-    // gvr_swap_chain_destroy will set the pointer to null
-    GVR_CHECK(gvr_swap_chain_destroy(&mSwapChain));
-    MOZ_ASSERT(!mSwapChain);
-  }
-  gvr_buffer_spec* spec = GVR_CHECK(gvr_buffer_spec_create(mPresentingContext));
-  mFrameBufferSize = GVR_CHECK(gvr_get_maximum_effective_render_target_size(mPresentingContext));
-  GVR_CHECK(gvr_buffer_spec_set_size(spec, mFrameBufferSize));
-  GVR_CHECK(gvr_buffer_spec_set_samples(spec, 0));
-  GVR_CHECK(gvr_buffer_spec_set_color_format(spec, GVR_COLOR_FORMAT_RGBA_8888));
-  GVR_CHECK(gvr_buffer_spec_set_depth_stencil_format(spec, GVR_DEPTH_STENCIL_FORMAT_NONE));
-  mSwapChain = GVR_CHECK(gvr_swap_chain_create(mPresentingContext, (const gvr_buffer_spec**)&spec, 1));
-  GVR_CHECK(gvr_buffer_spec_destroy(&spec));
-}
-
-void
-VRDisplayGVR::EnableControllers(const bool aEnable, VRSystemManager* aManager)
-{
-  if (aEnable && !mControllerAdded) {
-    // Sometimes the gamepad doesn't get removed cleanly so just try to remove it before adding it.
-    aManager->RemoveGamepad(mController->GetControllerInfo().mControllerID);
-    aManager->AddGamepad(mController->GetControllerInfo());
-    mControllerAdded = true;
-  } else if (!aEnable && mControllerAdded) {
-    mControllerAdded = false;
-    aManager->RemoveGamepad(mController->GetControllerInfo().mControllerID);
-  }
-
-  gvr_context* context = mPresentingContext;
-
-  if (!context) {
-    if (mControllerContext) {
-      GVR_CHECK(gvr_controller_destroy(&mControllerContext));
-    }
-    return;
-  }
-
-  if ((aEnable && mControllerContext) || (!aEnable && !mControllerContext)) {
-    return;
-  }
-
-  if (aEnable) {
-    if (!mControllerContext) {
-      int32_t options = GVR_CHECK(gvr_controller_get_default_options());
-      options |= GVR_CONTROLLER_ENABLE_GYRO | GVR_CONTROLLER_ENABLE_ACCEL | GVR_CONTROLLER_ENABLE_ARM_MODEL;
-      mControllerContext = GVR_CHECK(gvr_controller_create_and_init(options, context));
-      GVR_CHECK(gvr_controller_resume(mControllerContext));
-    }
-    if (!mControllerState) {
-      mControllerState = GVR_CHECK(gvr_controller_state_create());
-    }
-  } else {
-    GVR_CHECK(gvr_controller_pause(mControllerContext));
-    GVR_CHECK(gvr_controller_destroy(&mControllerContext));
-  }
-}
-
-void
-VRDisplayGVR::UpdateControllers(VRSystemManager* aManager)
-{
-  if (!mControllerContext) {
-    return;
-  }
-
-  GVR_CHECK(gvr_controller_apply_arm_model(mControllerContext, GVR_CONTROLLER_RIGHT_HANDED,GVR_ARM_MODEL_FOLLOW_GAZE, mHeadMatrix));
-  GVR_CHECK(gvr_controller_state_update(mControllerContext, 0, mControllerState));
-  mController->Update(mControllerState, aManager);
-}
-
-
-void
-VRDisplayGVR::GetControllers(nsTArray<RefPtr<VRControllerHost> >& aControllerResult)
-{
-  aControllerResult.AppendElement(mController.get());
-}
-
-VRControllerGVR::VRControllerGVR(dom::GamepadHand aHand, uint32_t aDisplayID)
-  : VRControllerHost(VRDeviceType::GVR, aHand, aDisplayID)
-{
-  MOZ_COUNT_CTOR_INHERITED(VRControllerGVR, VRControllerHost);
-  mControllerInfo.mControllerName.AssignLiteral("Daydream Controller");
-  // The gvr_controller_button enum starts with GVR_CONTROLLER_BUTTON_NONE at index zero
-  // so the GVR controller has one less button than GVR_CONTROLLER_BUTTON_COUNT specifies.
-  mControllerInfo.mNumButtons = GVR_CONTROLLER_BUTTON_COUNT - 1; // Skip dummy none button
-  mControllerInfo.mNumAxes = 2;
-  mControllerInfo.mNumHaptics = 0;
-}
-
-VRControllerGVR::~VRControllerGVR()
-{
-  MOZ_COUNT_DTOR_INHERITED(VRControllerGVR, VRControllerHost);
-}
-
-void
-VRControllerGVR::Update(gvr_controller_state* aState, VRSystemManager* aManager)
-{
-  mPose.Clear();
-
-  if (gvr_controller_state_get_connection_state(aState) != GVR_CONTROLLER_CONNECTED) {
-    return;
-  }
-  const uint64_t previousPressMask = GetButtonPressed();
-  const uint64_t previousTouchMask = GetButtonTouched();
-  uint64_t currentPressMask = 0;
-  uint64_t currentTouchMask = 0;
-  // Index 0 is the dummy button so skip it.
-  for (int ix = 1; ix < GVR_CONTROLLER_BUTTON_COUNT; ix++) {
-    const uint64_t buttonMask = 0x01 << (ix - 1);
-    bool pressed = gvr_controller_state_get_button_state(aState, ix);
-    bool touched = pressed;
-    if (ix == GVR_CONTROLLER_BUTTON_CLICK) {
-       touched = gvr_controller_state_is_touching(aState);
-       double xAxis = 0.0;
-       double yAxis = 0.0;
-       if (touched) {
-         gvr_vec2f axes = gvr_controller_state_get_touch_pos(aState);
-         xAxis = (axes.x * 2.0) - 1.0;
-         yAxis = (axes.y * 2.0) - 1.0;
-       }
-       aManager->NewAxisMove(0, 0, xAxis);
-       aManager->NewAxisMove(0, 1, yAxis);
-    }
-    if (pressed) {
-      currentPressMask |= buttonMask;
-    }
-    if (touched) {
-      currentTouchMask |= buttonMask;
-    }
-    if (((currentPressMask & buttonMask) ^ (previousPressMask & buttonMask)) ||
-        ((currentTouchMask & buttonMask) ^ (previousTouchMask & buttonMask))) {
-      aManager->NewButtonEvent(0, ix - 1, pressed, touched, pressed ? 1.0 : 0.0);
-    }
-  }
-  SetButtonPressed(currentPressMask);
-  SetButtonTouched(currentTouchMask);
-
-  mPose.flags = dom::GamepadCapabilityFlags::Cap_Orientation | dom::GamepadCapabilityFlags::Cap_Position | dom::GamepadCapabilityFlags::Cap_LinearAcceleration;
-
-  gvr_quatf ori = gvr_controller_state_get_orientation(aState);
-  mPose.orientation[0] = ori.qx;
-  mPose.orientation[1] = ori.qy;
-  mPose.orientation[2] = ori.qz;
-  mPose.orientation[3] = ori.qw;
-  mPose.isOrientationValid = true;
-
-  gvr_vec3f acc = gvr_controller_state_get_accel(aState);
-  mPose.linearAcceleration[0] = acc.x;
-  mPose.linearAcceleration[1] = acc.y;
-  mPose.linearAcceleration[2] = acc.z;
-
-  gvr_vec3f vel = gvr_controller_state_get_gyro(aState);
-  mPose.angularVelocity[0] = vel.x;
-  mPose.angularVelocity[1] = vel.y;
-  mPose.angularVelocity[2] = vel.z;
-
-  gvr_vec3f pos =  gvr_controller_state_get_position(aState);
-  mPose.position[0] = pos.x;
-  mPose.position[1] = pos.y;
-  mPose.position[2] = pos.z;
-
-  aManager->NewPoseState(0, mPose);
-}
-
-/*static*/ already_AddRefed<VRSystemManagerGVR>
-VRSystemManagerGVR::Create()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!gfxPrefs::VREnabled()) {
-    return nullptr;
-  }
-
-  RefPtr<VRSystemManagerGVR> manager = new VRSystemManagerGVR();
-  return manager.forget();
-}
-
-void
-VRSystemManagerGVR::Destroy()
-{
-
-}
-
-void
-VRSystemManagerGVR::Shutdown()
-{
-
-}
-
-bool
-VRSystemManagerGVR::GetHMDs(nsTArray<RefPtr<VRDisplayHost> >& aHMDResult)
-{
-  if (!GeckoVRManager::IsGVRPresent()) {
-    return false;
-  }
-
-  if (!mGVRHMD) {
-    mGVRHMD = new VRDisplayGVR();
-  }
-
-  aHMDResult.AppendElement(mGVRHMD);
-  return true;
-}
-
-bool
-VRSystemManagerGVR::GetIsPresenting()
-{
-  if (!mGVRHMD) {
-    return false;
-  }
-
-  VRDisplayInfo displayInfo(mGVRHMD->GetDisplayInfo());
-  return displayInfo.GetPresentingGroups() != kVRGroupNone;
-}
-
-void
-VRSystemManagerGVR::HandleInput()
-{
-  if (mGVRHMD) {
-    mGVRHMD->UpdateControllers(this);
-  }
-}
-
-void
-VRSystemManagerGVR::GetControllers(nsTArray<RefPtr<VRControllerHost>>& aControllerResult)
-{
-  if (mGVRHMD) {
-    mGVRHMD->GetControllers(aControllerResult);
-  }
-}
-
-void
-VRSystemManagerGVR::ScanForControllers()
-{
-  if (mGVRHMD) {
-    mGVRHMD->EnableControllers(true, this);
-  }
-}
-
-void
-VRSystemManagerGVR::RemoveControllers()
-{
-  if (mGVRHMD) {
-    mGVRHMD->EnableControllers(false, this);
-  }
-}
-
-void
-VRSystemManagerGVR::VibrateHaptic(uint32_t aControllerIdx,
-                                  uint32_t aHapticIndex,
-                                  double aIntensity,
-                                  double aDuration,
-                                  uint32_t aPromiseID)
-{
-
-}
-
-void
-VRSystemManagerGVR::StopVibrateHaptic(uint32_t aControllerIdx)
-{
-
-}
-
-VRSystemManagerGVR::VRSystemManagerGVR()
-  : mGVRHMD(nullptr)
-{
-
-}
-
-VRSystemManagerGVR::~VRSystemManagerGVR()
-{
-
-}
-
deleted file mode 100644
--- a/gfx/vr/gfxVRGVR.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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/. */
-
-#ifndef GFX_VR_GVR_H
-#define GFX_VR_GVR_H
-
-#include "gfxVR.h"
-
-#include <memory>
-
-#include "mozilla/EnumeratedArray.h"
-#include "mozilla/gfx/2D.h"
-#include "mozilla/gfx/Matrix.h"
-#include "mozilla/RefPtr.h"
-#include "mozilla/UniquePtr.h"
-
-#include "nsTArray.h"
-#include "nsIRunnable.h"
-#include "nsIScreen.h"
-#include "nsCOMPtr.h"
-
-#include "VRDisplayHost.h"
-
-#pragma GCC system_header
-#pragma GCC visibility push(default)
-#include "vr/gvr/capi/include/gvr.h"
-#include "vr/gvr/capi/include/gvr_controller.h"
-#pragma GCC visibility pop
-
-
-namespace mozilla {
-namespace gl {
-class GLContextEGL;
-} // namespace gl
-namespace layers {
-class EGLImageDescriptor;
-} // namespace layers
-namespace gfx {
-namespace impl {
-
-class VRControllerGVR : public VRControllerHost
-{
-public:
-  explicit VRControllerGVR(dom::GamepadHand aHand, uint32_t aDisplayID);
-  virtual ~VRControllerGVR();
-  void Update(gvr_controller_state* aState, VRSystemManager* aManager);
-};
-
-class VRDisplayGVR : public VRDisplayHost
-{
-public:
-  VRDisplayGVR();
-
-  // BEGIN VRDisplayHost interface
-  void ZeroSensor() override;
-  void StartPresentation() override;
-  void StopPresentation() override;
-  bool SubmitFrame(const mozilla::layers::EGLImageDescriptor* aDescriptor,
-                   const gfx::Rect& aLeftEyeRect,
-                   const gfx::Rect& aRightEyeRect) override;
-  void NotifyVSync() override;
-protected:
-  virtual VRHMDSensorState GetSensorState() override;
-  // END VRDisplayHost interface
-
-public:
-  void SetPaused(const bool aPaused);
-  void SetPresentingContext(void* aGVRPresentingContext);
-  void EnableControllers(const bool aEnable, VRSystemManager* aManager);
-  void UpdateControllers(VRSystemManager* aManager);
-  void GetControllers(nsTArray<RefPtr<VRControllerHost> >& aControllerResult);
-
-protected:
-  virtual ~VRDisplayGVR();
-  void UpdateHeadToEye(gvr_context* aContext, gfx::Quaternion* aRot = nullptr);
-  void UpdateViewport();
-  void RecreateSwapChain();
-
-  bool mIsPresenting;
-  bool mControllerAdded;
-
-  gfx::Matrix4x4 mHeadToEyes[2];
-  gvr_context* mPresentingContext;
-  gvr_controller_context* mControllerContext;
-  gvr_controller_state* mControllerState;
-  gvr_buffer_viewport_list* mViewportList;
-  gvr_buffer_viewport* mLeftViewport;
-  gvr_buffer_viewport* mRightViewport;
-  gvr_mat4f mHeadMatrix;
-  gvr_swap_chain* mSwapChain;
-  gvr_sizei mFrameBufferSize;
-
-  RefPtr<VRControllerGVR> mController;
-};
-
-
-} // namespace impl
-
-class VRSystemManagerGVR : public VRSystemManager
-{
-public:
-  static already_AddRefed<VRSystemManagerGVR> Create();
-
-  void Destroy() override;
-  void Shutdown() override;
-  bool GetHMDs(nsTArray<RefPtr<VRDisplayHost> >& aHMDResult) override;
-  bool GetIsPresenting() override;
-  void HandleInput() override;
-  void GetControllers(nsTArray<RefPtr<VRControllerHost>>&
-                      aControllerResult) override;
-  void ScanForControllers() override;
-  void RemoveControllers() override;
-  void VibrateHaptic(uint32_t aControllerIdx,
-                     uint32_t aHapticIndex,
-                     double aIntensity,
-                     double aDuration,
-                     uint32_t aPromiseID) override;
-  void StopVibrateHaptic(uint32_t aControllerIdx) override;
-
-protected:
-  VRSystemManagerGVR();
-  virtual ~VRSystemManagerGVR();
-
-private:
-  RefPtr<impl::VRDisplayGVR> mGVRHMD;
-};
-
-} // namespace gfx
-} // namespace mozilla
-
-
-#endif /* GFX_VR_GVR_H */
deleted file mode 100644
--- a/gfx/vr/gfxVRGVRAPI.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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/. */
-
-#ifndef GFX_VR_GVR_API_H
-#define GFX_VR_GVR_API_H
-namespace mozilla {
-namespace gfx {
-
-void SetGVRPresentingContext(void* aGVRPresentingContext);
-void CleanupGVRNonPresentingContext();
-void SetGVRPaused(const bool aPaused);
-
-} // namespace gfx
-} // namespace mozilla
-#endif // GFX_VR_GVR_API_H
--- a/gfx/vr/gfxVROSVR.cpp
+++ b/gfx/vr/gfxVROSVR.cpp
@@ -352,27 +352,16 @@ VRDisplayOSVR::SubmitFrame(MacIOSurface*
                            const IntSize& aSize,
                            const gfx::Rect& aLeftEyeRect,
                            const gfx::Rect& aRightEyeRect)
 {
   // XXX Add code to submit frame
   return false;
 }
 
-#elif defined(MOZ_ANDROID_GOOGLE_VR)
-
-bool
-VRDisplayOSVR::SubmitFrame(const mozilla::layers::EGLImageDescriptor*,
-                           const gfx::Rect& aLeftEyeRect,
-                           const gfx::Rect& aRightEyeRect)
-{
-  // XXX Add code to submit frame
-  return false;
-}
-
 #endif
 
 void
 VRDisplayOSVR::StartPresentation()
 {
   // XXX Add code to start VR Presentation
 }
 
--- a/gfx/vr/gfxVROSVR.h
+++ b/gfx/vr/gfxVROSVR.h
@@ -41,20 +41,16 @@ protected:
                            const IntSize& aSize,
                            const gfx::Rect& aLeftEyeRect,
                            const gfx::Rect& aRightEyeRect) override;
 #elif defined(XP_MACOSX)
   virtual bool SubmitFrame(MacIOSurface* aMacIOSurface,
                            const IntSize& aSize,
                            const gfx::Rect& aLeftEyeRect,
                            const gfx::Rect& aRightEyeRect) override;
-#elif defined(MOZ_ANDROID_GOOGLE_VR)
-  virtual bool SubmitFrame(const mozilla::layers::EGLImageDescriptor*,
-                           const gfx::Rect& aLeftEyeRect,
-                           const gfx::Rect& aRightEyeRect) override;
 #endif
 
 public:
   explicit VRDisplayOSVR(OSVR_ClientContext* context,
                          OSVR_ClientInterface* iface,
                          OSVR_DisplayConfig* display);
 
 protected:
@@ -123,9 +119,9 @@ private:
   void InitializeClientContext();
   void InitializeDisplay();
   void InitializeInterface();
 };
 
 } // namespace gfx
 } // namespace mozilla
 
-#endif /* GFX_VR_OSVR_H */
+#endif /* GFX_VR_OSVR_H */
\ No newline at end of file
--- a/gfx/vr/gfxVRPuppet.cpp
+++ b/gfx/vr/gfxVRPuppet.cpp
@@ -545,26 +545,16 @@ VRDisplayPuppet::SubmitFrame(MacIOSurfac
       MOZ_ASSERT(false, "No support for showing VR frames on MacOSX yet.");
       break;
     }
   }
 
   return false;
 }
 
-#elif defined(MOZ_ANDROID_GOOGLE_VR)
-
-bool
-VRDisplayPuppet::SubmitFrame(const mozilla::layers::EGLImageDescriptor* aDescriptor,
-                           const gfx::Rect& aLeftEyeRect,
-                           const gfx::Rect& aRightEyeRect) {
-
-  return false;
-}
-
 #endif
 
 void
 VRDisplayPuppet::NotifyVSync()
 {
   // We update mIsConneced once per frame.
   mDisplayInfo.mIsConnected = true;
 
--- a/gfx/vr/gfxVRPuppet.h
+++ b/gfx/vr/gfxVRPuppet.h
@@ -37,20 +37,16 @@ protected:
                            const IntSize& aSize,
                            const gfx::Rect& aLeftEyeRect,
                            const gfx::Rect& aRightEyeRect) override;
 #elif defined(XP_MACOSX)
   virtual bool SubmitFrame(MacIOSurface* aMacIOSurface,
                            const IntSize& aSize,
                            const gfx::Rect& aLeftEyeRect,
                            const gfx::Rect& aRightEyeRect) override;
-#elif defined(MOZ_ANDROID_GOOGLE_VR)
-  virtual bool SubmitFrame(const mozilla::layers::EGLImageDescriptor* aDescriptor,
-                           const gfx::Rect& aLeftEyeRect,
-                           const gfx::Rect& aRightEyeRect) override;
 #endif
 
 public:
   explicit VRDisplayPuppet();
 
 protected:
   virtual ~VRDisplayPuppet();
   void Destroy();
@@ -142,9 +138,9 @@ private:
   // there can only be one
   RefPtr<impl::VRDisplayPuppet> mPuppetHMD;
   nsTArray<RefPtr<impl::VRControllerPuppet>> mPuppetController;
 };
 
 } // namespace gfx
 } // namespace mozilla
 
-#endif  /* GFX_VR_PUPPET_H*/
+#endif  /* GFX_VR_PUPPET_H*/
\ No newline at end of file
--- a/gfx/vr/ipc/VRMessageUtils.h
+++ b/gfx/vr/ipc/VRMessageUtils.h
@@ -40,17 +40,16 @@ struct ParamTraits<mozilla::gfx::VRDispl
     WriteParam(aMsg, aParam.mEyeResolution);
     WriteParam(aMsg, aParam.mIsConnected);
     WriteParam(aMsg, aParam.mIsMounted);
     WriteParam(aMsg, aParam.mPresentingGroups);
     WriteParam(aMsg, aParam.mGroupMask);
     WriteParam(aMsg, aParam.mStageSize);
     WriteParam(aMsg, aParam.mSittingToStandingTransform);
     WriteParam(aMsg, aParam.mFrameId);
-    WriteParam(aMsg, aParam.mPresentingGeneration);
     for (int i = 0; i < mozilla::gfx::VRDisplayInfo::NumEyes; i++) {
       WriteParam(aMsg, aParam.mEyeFOV[i]);
       WriteParam(aMsg, aParam.mEyeTranslation[i]);
     }
     for (int i = 0; i < mozilla::gfx::kVRMaxLatencyFrames; i++) {
       WriteParam(aMsg, aParam.mLastSensorState[i]);
     }
   }
@@ -63,18 +62,17 @@ struct ParamTraits<mozilla::gfx::VRDispl
         !ReadParam(aMsg, aIter, &(aResult->mCapabilityFlags)) ||
         !ReadParam(aMsg, aIter, &(aResult->mEyeResolution)) ||
         !ReadParam(aMsg, aIter, &(aResult->mIsConnected)) ||
         !ReadParam(aMsg, aIter, &(aResult->mIsMounted)) ||
         !ReadParam(aMsg, aIter, &(aResult->mPresentingGroups)) ||
         !ReadParam(aMsg, aIter, &(aResult->mGroupMask)) ||
         !ReadParam(aMsg, aIter, &(aResult->mStageSize)) ||
         !ReadParam(aMsg, aIter, &(aResult->mSittingToStandingTransform)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mFrameId)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mPresentingGeneration))) {
+        !ReadParam(aMsg, aIter, &(aResult->mFrameId))) {
       return false;
     }
     for (int i = 0; i < mozilla::gfx::VRDisplayInfo::NumEyes; i++) {
       if (!ReadParam(aMsg, aIter, &(aResult->mEyeFOV[i])) ||
           !ReadParam(aMsg, aIter, &(aResult->mEyeTranslation[i]))) {
         return false;
       }
     }
deleted file mode 100644
--- a/gfx/vr/jni/gfxGVRJNI.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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 <jni.h>
-
-extern "C" __attribute__((visibility("default"))) jlong
-Java_com_google_vr_cardboard_DisplaySynchronizer_nativeCreate(
-    JNIEnv* env,
-    jobject jcaller,
-    jclass classLoader,
-    jobject appContext);
-
-// Step 2: method stubs.
-extern "C" __attribute__((visibility("default"))) void
-Java_com_google_vr_cardboard_DisplaySynchronizer_nativeDestroy(
-    JNIEnv* env,
-    jobject jcaller,
-    jlong nativeDisplaySynchronizer);
-
-extern "C" __attribute__((visibility("default"))) void
-Java_com_google_vr_cardboard_DisplaySynchronizer_nativeReset(
-    JNIEnv* env,
-    jobject jcaller,
-    jlong nativeDisplaySynchronizer,
-    jlong expectedInterval,
-    jlong vsyncOffset);
-
-extern "C" __attribute__((visibility("default"))) void
-Java_com_google_vr_cardboard_DisplaySynchronizer_nativeUpdate(
-    JNIEnv* env,
-    jobject jcaller,
-    jlong nativeDisplaySynchronizer,
-    jlong syncTime,
-    jint currentRotation);
-
-namespace {
-
-bool
-check(JNIEnv* env) {
-  if (env->ExceptionCheck()) {
-    env->ExceptionDescribe();
-    env->ExceptionClear();
-    return false;
-  }
-  return true;
-}
-
-const char kDisplaySynchronizerClassPath[] = "com/google/vr/cardboard/DisplaySynchronizer";
-
-static const JNINativeMethod kMethodsDisplaySynchronizer[] = {
-    {"nativeCreate",
-     "("
-     "Ljava/lang/ClassLoader;"
-     "Landroid/content/Context;"
-     ")"
-     "J",
-     reinterpret_cast<void*>(
-         Java_com_google_vr_cardboard_DisplaySynchronizer_nativeCreate)},
-    {"nativeDestroy",
-     "("
-     "J"
-     ")"
-     "V",
-     reinterpret_cast<void*>(
-         Java_com_google_vr_cardboard_DisplaySynchronizer_nativeDestroy)},
-    {"nativeReset",
-     "("
-     "J"
-     "J"
-     "J"
-     ")"
-     "V",
-     reinterpret_cast<void*>(
-         Java_com_google_vr_cardboard_DisplaySynchronizer_nativeReset)},
-    {"nativeUpdate",
-     "("
-     "J"
-     "J"
-     "I"
-     ")"
-     "V",
-     reinterpret_cast<void*>(
-         Java_com_google_vr_cardboard_DisplaySynchronizer_nativeUpdate)},
-};
-}
-
-bool
-SetupGVRJNI(JNIEnv* env)
-{
-  jclass displaySynchronizerClazz = env->FindClass(kDisplaySynchronizerClassPath);
-  if (!check(env)) { return false; }
-  if (displaySynchronizerClazz == nullptr) {
-    return false;
-  }
-  env->RegisterNatives(displaySynchronizerClazz, kMethodsDisplaySynchronizer, sizeof(kMethodsDisplaySynchronizer) / sizeof(kMethodsDisplaySynchronizer[0]));
-  if (!check(env)) { return false; }
-  env->DeleteLocalRef(displaySynchronizerClazz);
-  if (!check(env)) { return false; }
-
-  return true;
-}
-
--- a/gfx/vr/moz.build
+++ b/gfx/vr/moz.build
@@ -52,24 +52,16 @@ if CONFIG['OS_TARGET'] in ('WINNT', 'Lin
         'gfxVROpenVR.cpp',
     ]
 
 if CONFIG['OS_TARGET'] == 'WINNT':
     SOURCES += [
         'gfxVROculus.cpp',
     ]
 
-if CONFIG['MOZ_ANDROID_GOOGLE_VR']:
-    SOURCES += [
-        'gfxVRGVR.cpp',
-        'jni/gfxGVRJNI.cpp',
-    ]
-    CXXFLAGS += ['-I%s' % CONFIG['MOZ_ANDROID_GOOGLE_VR_INCLUDE']]
-    LOCAL_INCLUDES += ['/widget/android']
-
 IPDL_SOURCES = [
     'ipc/PVRLayer.ipdl',
     'ipc/PVRManager.ipdl',
 ]
 
 # For building with the real SDK instead of our local hack
 #SOURCES += [
 #    'OVR_CAPI_Util.cpp',
new file mode 100644
--- /dev/null
+++ b/layout/painting/crashtests/1405881-1.html
@@ -0,0 +1,24 @@
+<style type="text/css">
+    #container {
+        height: 300px;
+        width: 300px;
+    }
+    #box {
+        height: 100px;
+        width: 100px;
+        background: red;
+        animation: 2s anim;
+    }
+    @keyframes anim {
+        from {
+            -moz-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 10%, 10%, 0, 1);
+        }
+        to {
+            -moz-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 40%, 40%, 0, 1);
+        }
+    }
+
+</style>
+<div id=container>
+    <div id=box></div>
+</div>
--- a/layout/painting/crashtests/crashtests.list
+++ b/layout/painting/crashtests/crashtests.list
@@ -1,2 +1,3 @@
 load 1402183-1.html
 skip-if(!(stylo||styloVsGecko)||Android) load 1407470-1.html
+load 1405881-1.html
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -340,18 +340,22 @@ static void AddTransformFunctions(const 
         matrix._21 = array->Item(3).GetFloatValue();
         matrix._22 = array->Item(4).GetFloatValue();
         matrix._23 = 0;
         matrix._24 = 0;
         matrix._31 = 0;
         matrix._32 = 0;
         matrix._33 = 1;
         matrix._34 = 0;
-        matrix._41 = array->Item(5).GetFloatValue();
-        matrix._42 = array->Item(6).GetFloatValue();
+        matrix._41 = ProcessTranslatePart(array->Item(5), contextIfGecko,
+                                          aPresContext, conditions,
+                                          &aRefBox, &TransformReferenceBox::Width);
+        matrix._42 = ProcessTranslatePart(array->Item(6), contextIfGecko,
+                                          aPresContext, conditions,
+                                          &aRefBox, &TransformReferenceBox::Height);
         matrix._43 = 0;
         matrix._44 = 1;
         aFunctions.AppendElement(TransformMatrix(matrix));
         break;
       }
       case eCSSKeyword_matrix3d:
       {
         gfx::Matrix4x4 matrix;
@@ -362,19 +366,25 @@ static void AddTransformFunctions(const 
         matrix._21 = array->Item(5).GetFloatValue();
         matrix._22 = array->Item(6).GetFloatValue();
         matrix._23 = array->Item(7).GetFloatValue();
         matrix._24 = array->Item(8).GetFloatValue();
         matrix._31 = array->Item(9).GetFloatValue();
         matrix._32 = array->Item(10).GetFloatValue();
         matrix._33 = array->Item(11).GetFloatValue();
         matrix._34 = array->Item(12).GetFloatValue();
-        matrix._41 = array->Item(13).GetFloatValue();
-        matrix._42 = array->Item(14).GetFloatValue();
-        matrix._43 = array->Item(15).GetFloatValue();
+        matrix._41 = ProcessTranslatePart(array->Item(13), contextIfGecko,
+                                          aPresContext, conditions,
+                                          &aRefBox, &TransformReferenceBox::Width);
+        matrix._42 = ProcessTranslatePart(array->Item(14), contextIfGecko,
+                                          aPresContext, conditions,
+                                          &aRefBox, &TransformReferenceBox::Height);
+        matrix._43 = ProcessTranslatePart(array->Item(15), contextIfGecko,
+                                          aPresContext, conditions,
+                                          &aRefBox, nullptr);
         matrix._44 = array->Item(16).GetFloatValue();
         aFunctions.AppendElement(TransformMatrix(matrix));
         break;
       }
       case eCSSKeyword_interpolatematrix:
       {
         bool dummy;
         Matrix4x4 matrix;
--- a/media/ffvpx/README_MOZILLA
+++ b/media/ffvpx/README_MOZILLA
@@ -2,33 +2,33 @@ This directory contains files used in ge
 (http://ffmpeg.org). The current files are from FFmpeg as of
 revision n3.4-1-g587fadaef1
 All source files match their path from the library's source archive.
 
 Currently, we only use the vp8 and vp9 portion of the library, and only on x86
 based platforms. If this changes, configuration files will most likely
 need to be updated.
 
-AVX2 must be disabled on Linux due to the use of yasm 1.1 on the build bots.
+AVX2 must be disabled on Linux 32 bits due to the use of yasm 1.1 on the build bots.
 Once yasm is upgraded to 1.2 or later, AVX2 code could be re-enabled.
 Add --disable-avx2 to configure on those platforms.
 
 configuration files were generated as follow using the configure script:
-./configure --disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-decoder=flac --enable-asm --enable-yasm
+./configure --disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-decoder=flac --enable-asm --enable-x86asm
 
 config*:
 replace: /HAVE_(MALLOC_H|ARC4RANDOM|LOCALTIME_R|MEMALIGN|POSIX_MEMALIGN)/d
 
 config_unix32.h:
-add to configure command: --disable-asm --disable-yasm --cc='clang -m32'
+add to configure command: --disable-asm --disable-x86asm --cc='clang -m32'
 
 config_android.h:
 ./configure --disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-decoder=flac --disable-asm --cross-prefix=~/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --target-os=linux --arch=arm --enable-cross-compile --sysroot=~/.mozbuild/android-ndk-r15c/platforms/android-24/arch-arm
 
-config_unix64.h/config_unix64.asm:
+config_unix32.h/config_unix64.h/config_unix64.asm:
 replace: s/HAVE_SYSCTL 1/HAVE_SYSCTL 0
 
 config_win32/64.h/asm:
 add to configure command: --toolchain=msvc
 
 Regenerate defaults_disabled.{h,asm} with:
 $ grep -E ".*_(INDEV|OUTDEV|DECODER|ENCODER|DEMUXER|MUXER|PARSER|FILTER|HWACCEL|PROTOCOL|ENCODERS|DECODERS|HWACCELS|INDEVS|OUTDEVS|FILTERS|DEMUXERS|MUXERS|PROTOCOLS|BSF) 0" config.h > ~/Work/Mozilla/mozilla-central/media/ffvpx/defaults_disabled.h
 $ grep -E ".*_(INDEV|OUTDEV|DECODER|ENCODER|DEMUXER|MUXER|PARSER|FILTER|HWACCEL|PROTOCOL|ENCODERS|DECODERS|HWACCELS|INDEVS|OUTDEVS|FILTERS|DEMUXERS|MUXERS|PROTOCOLS|BSF) 0" config.asm > ~/Work/Mozilla/mozilla-central/media/ffvpx/defaults_disabled.asm
--- a/media/ffvpx/config_darwin64.asm
+++ b/media/ffvpx/config_darwin64.asm
@@ -58,18 +58,18 @@
 %define HAVE_MIPS32R2 0
 %define HAVE_MIPS32R5 0
 %define HAVE_MIPS64R2 0
 %define HAVE_MIPS32R6 0
 %define HAVE_MIPS64R6 0
 %define HAVE_MIPSDSP 0
 %define HAVE_MIPSDSPR2 0
 %define HAVE_MSA 0
-%define HAVE_LOONGSON2 1
-%define HAVE_LOONGSON3 1
+%define HAVE_LOONGSON2 0
+%define HAVE_LOONGSON3 0
 %define HAVE_MMI 0
 %define HAVE_ARMV5TE_EXTERNAL 0
 %define HAVE_ARMV6_EXTERNAL 0
 %define HAVE_ARMV6T2_EXTERNAL 0
 %define HAVE_ARMV8_EXTERNAL 0
 %define HAVE_NEON_EXTERNAL 0
 %define HAVE_VFP_EXTERNAL 0
 %define HAVE_VFPV3_EXTERNAL 0
@@ -157,65 +157,67 @@
 %define HAVE_ALIGNED_STACK 1
 %define HAVE_FAST_64BIT 1
 %define HAVE_FAST_CLZ 1
 %define HAVE_FAST_CMOV 1
 %define HAVE_LOCAL_ALIGNED_8 1
 %define HAVE_LOCAL_ALIGNED_16 1
 %define HAVE_LOCAL_ALIGNED_32 1
 %define HAVE_SIMD_ALIGN_16 1
+%define HAVE_SIMD_ALIGN_32 1
 %define HAVE_ATOMICS_GCC 1
 %define HAVE_ATOMICS_SUNCC 0
 %define HAVE_ATOMICS_WIN32 0
 %define HAVE_ATOMIC_CAS_PTR 0
-%define HAVE_ATOMIC_COMPARE_EXCHANGE 1
 %define HAVE_MACHINE_RW_BARRIER 0
 %define HAVE_MEMORYBARRIER 0
 %define HAVE_MM_EMPTY 1
 %define HAVE_RDTSC 0
 %define HAVE_SARESTART 1
-%define HAVE_SEM_TIMEDWAIT 1
+%define HAVE_SEM_TIMEDWAIT 0
 %define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1
 %define HAVE_CABS 1
 %define HAVE_CEXP 1
 %define HAVE_INLINE_ASM 1
 %define HAVE_SYMVER 1
-%define HAVE_YASM 1
+%define HAVE_X86ASM 1
 %define HAVE_BIGENDIAN 0
 %define HAVE_FAST_UNALIGNED 1
-%define HAVE_ALSA_ASOUNDLIB_H 0
 %define HAVE_ALTIVEC_H 0
 %define HAVE_ARPA_INET_H 1
 %define HAVE_ASM_TYPES_H 0
 %define HAVE_CDIO_PARANOIA_H 0
 %define HAVE_CDIO_PARANOIA_PARANOIA_H 0
-%define HAVE_DISPATCH_DISPATCH_H 0
+%define HAVE_CUDA_H 0
+%define HAVE_D3D11_H 0
+%define HAVE_DISPATCH_DISPATCH_H 1
 %define HAVE_DEV_BKTR_IOCTL_BT848_H 0
 %define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
 %define HAVE_DEV_IC_BT8XX_H 0
 %define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0
 %define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0
 %define HAVE_DIRECT_H 0
 %define HAVE_DIRENT_H 1
 %define HAVE_DLFCN_H 1
-%define HAVE_D3D11_H 0
+%define HAVE_DXGIDEBUG_H 0
 %define HAVE_DXVA_H 0
 %define HAVE_ES2_GL_H 0
 %define HAVE_GSM_H 0
 %define HAVE_IO_H 0
 %define HAVE_MACH_MACH_TIME_H 1
 %define HAVE_MACHINE_IOCTL_BT848_H 0
 %define HAVE_MACHINE_IOCTL_METEOR_H 0
 %define HAVE_OPENCV2_CORE_CORE_C_H 0
+%define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+%define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
 %define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
 %define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
 %define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
 %define HAVE_OPENGL_GL3_H 0
 %define HAVE_POLL_H 1
-%define HAVE_SNDIO_H 0
 %define HAVE_SOUNDCARD_H 0
 %define HAVE_STDATOMIC_H 1
 %define HAVE_SYS_MMAN_H 1
 %define HAVE_SYS_PARAM_H 1
 %define HAVE_SYS_RESOURCE_H 1
 %define HAVE_SYS_SELECT_H 1
 %define HAVE_SYS_SOUNDCARD_H 0
 %define HAVE_SYS_TIME_H 1
@@ -254,22 +256,21 @@
 %define HAVE_RINT 1
 %define HAVE_ROUND 1
 %define HAVE_ROUNDF 1
 %define HAVE_SINF 1
 %define HAVE_TRUNC 1
 %define HAVE_TRUNCF 1
 %define HAVE_ACCESS 1
 %define HAVE_ALIGNED_MALLOC 0
-%define HAVE_CLOCK_GETTIME 0
+%define HAVE_CLOCK_GETTIME 1
 %define HAVE_CLOSESOCKET 0
 %define HAVE_COMMANDLINETOARGVW 0
 %define HAVE_COTASKMEMFREE 0
 %define HAVE_CRYPTGENRANDOM 0
-%define HAVE_DLOPEN 1
 %define HAVE_FCNTL 1
 %define HAVE_FLT_LIM 1
 %define HAVE_FORK 1
 %define HAVE_GETADDRINFO 1
 %define HAVE_GETHRTIME 0
 %define HAVE_GETOPT 1
 %define HAVE_GETPROCESSAFFINITYMASK 0
 %define HAVE_GETPROCESSMEMORYINFO 0
@@ -300,204 +301,213 @@
 %define HAVE_SETCONSOLECTRLHANDLER 0
 %define HAVE_SETMODE 0
 %define HAVE_SETRLIMIT 1
 %define HAVE_SLEEP 0
 %define HAVE_STRERROR_R 1
 %define HAVE_SYSCONF 1
 %define HAVE_SYSCTL 1
 %define HAVE_USLEEP 1
-%define HAVE_UTGETOSTYPEFROMSTRING 1
+%define HAVE_UTGETOSTYPEFROMSTRING 0
 %define HAVE_VIRTUALALLOC 0
 %define HAVE_WGLGETPROCADDRESS 0
 %define HAVE_PTHREADS 1
 %define HAVE_OS2THREADS 0
 %define HAVE_W32THREADS 0
 %define HAVE_AS_DN_DIRECTIVE 0
+%define HAVE_AS_FPU_DIRECTIVE 0
 %define HAVE_AS_FUNC 0
 %define HAVE_AS_OBJECT_ARCH 0
 %define HAVE_ASM_MOD_Q 0
 %define HAVE_ATTRIBUTE_MAY_ALIAS 1
 %define HAVE_ATTRIBUTE_PACKED 1
+%define HAVE_BLOCKS_EXTENSION 1
 %define HAVE_EBP_AVAILABLE 1
 %define HAVE_EBX_AVAILABLE 1
 %define HAVE_GNU_AS 0
 %define HAVE_GNU_WINDRES 0
 %define HAVE_IBM_ASM 0
 %define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1
 %define HAVE_INLINE_ASM_LABELS 1
 %define HAVE_INLINE_ASM_NONLOCAL_LABELS 1
 %define HAVE_PRAGMA_DEPRECATED 1
 %define HAVE_RSYNC_CONTIMEOUT 0
 %define HAVE_SYMVER_ASM_LABEL 1
 %define HAVE_SYMVER_GNU_ASM 0
 %define HAVE_VFP_ARGS 0
 %define HAVE_XFORM_ASM 0
 %define HAVE_XMM_CLOBBERS 1
 %define HAVE_CONDITION_VARIABLE_PTR 0
+%define HAVE_KCMVIDEOCODECTYPE_HEVC 0
 %define HAVE_SOCKLEN_T 1
 %define HAVE_STRUCT_ADDRINFO 1
 %define HAVE_STRUCT_GROUP_SOURCE_REQ 1
 %define HAVE_STRUCT_IP_MREQ_SOURCE 1
 %define HAVE_STRUCT_IPV6_MREQ 1
 %define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1
 %define HAVE_STRUCT_POLLFD 1
 %define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1
 %define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
 %define HAVE_STRUCT_SOCKADDR_IN6 1
 %define HAVE_STRUCT_SOCKADDR_SA_LEN 1
 %define HAVE_STRUCT_SOCKADDR_STORAGE 1
 %define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0
 %define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0
 %define HAVE_ATOMICS_NATIVE 1
 %define HAVE_DOS_PATHS 0
-%define HAVE_DXVA2_LIB 0
-%define HAVE_DXVA2API_COBJ 0
 %define HAVE_LIBC_MSVCRT 0
-%define HAVE_LIBDC1394_1 0
-%define HAVE_LIBDC1394_2 0
 %define HAVE_MAKEINFO 1
-%define HAVE_MAKEINFO_HTML 1
+%define HAVE_MAKEINFO_HTML 0
 %define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
 %define HAVE_PERL 1
 %define HAVE_POD2MAN 1
-%define HAVE_SDL2 0
 %define HAVE_SECTION_DATA_REL_RO 0
 %define HAVE_TEXI2HTML 0
 %define HAVE_THREADS 1
+%define HAVE_UWP 0
 %define HAVE_VAAPI_DRM 0
 %define HAVE_VAAPI_X11 0
 %define HAVE_VDPAU_X11 0
 %define HAVE_WINRT 0
-%define HAVE_XLIB 0
-%define CONFIG_BSFS 0
-%define CONFIG_DECODERS 1
-%define CONFIG_PARSERS 1
 %define CONFIG_DOC 0
-%define CONFIG_HTMLPAGES 1
+%define CONFIG_HTMLPAGES 0
 %define CONFIG_MANPAGES 1
 %define CONFIG_PODPAGES 1
 %define CONFIG_TXTPAGES 1
 %define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
 %define CONFIG_AVIO_READING_EXAMPLE 1
-%define CONFIG_DECODING_ENCODING_EXAMPLE 0
+%define CONFIG_DECODE_AUDIO_EXAMPLE 1
+%define CONFIG_DECODE_VIDEO_EXAMPLE 1
 %define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+%define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+%define CONFIG_ENCODE_VIDEO_EXAMPLE 1
 %define CONFIG_EXTRACT_MVS_EXAMPLE 0
 %define CONFIG_FILTER_AUDIO_EXAMPLE 0
 %define CONFIG_FILTERING_AUDIO_EXAMPLE 0
 %define CONFIG_FILTERING_VIDEO_EXAMPLE 0
 %define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+%define CONFIG_HW_DECODE_EXAMPLE 0
 %define CONFIG_METADATA_EXAMPLE 0
 %define CONFIG_MUXING_EXAMPLE 0
 %define CONFIG_QSVDEC_EXAMPLE 0
 %define CONFIG_REMUXING_EXAMPLE 0
 %define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0
 %define CONFIG_SCALING_VIDEO_EXAMPLE 0
 %define CONFIG_TRANSCODE_AAC_EXAMPLE 0
 %define CONFIG_TRANSCODING_EXAMPLE 0
+%define CONFIG_ALSA 0
+%define CONFIG_APPKIT 1
+%define CONFIG_AVFOUNDATION 1
+%define CONFIG_BZLIB 1
+%define CONFIG_COREIMAGE 1
+%define CONFIG_ICONV 0
+%define CONFIG_JACK 0
+%define CONFIG_LIBXCB 0
+%define CONFIG_LIBXCB_SHM 0
+%define CONFIG_LIBXCB_SHAPE 0
+%define CONFIG_LIBXCB_XFIXES 0
+%define CONFIG_LZMA 0
+%define CONFIG_SCHANNEL 0
+%define CONFIG_SDL2 0
+%define CONFIG_SECURETRANSPORT 0
+%define CONFIG_SNDIO 0
+%define CONFIG_XLIB 1
+%define CONFIG_ZLIB 1
 %define CONFIG_AVISYNTH 0
-%define CONFIG_BZLIB 0
-%define CONFIG_CHROMAPRINT 0
-%define CONFIG_CRYSTALHD 0
+%define CONFIG_FREI0R 0
+%define CONFIG_LIBCDIO 0
+%define CONFIG_LIBRUBBERBAND 0
+%define CONFIG_LIBVIDSTAB 0
+%define CONFIG_LIBX264 0
+%define CONFIG_LIBX265 0
+%define CONFIG_LIBXAVS 0
+%define CONFIG_LIBXVID 0
 %define CONFIG_DECKLINK 0
-%define CONFIG_FREI0R 0
-%define CONFIG_GCRYPT 0
+%define CONFIG_LIBNDI_NEWTEK 0
+%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_OPENSSL 0
 %define CONFIG_GMP 0
+%define CONFIG_LIBOPENCORE_AMRNB 0
+%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_RKMPP 0
+%define CONFIG_LIBSMBCLIENT 0
+%define CONFIG_CHROMAPRINT 0
+%define CONFIG_GCRYPT 0
 %define CONFIG_GNUTLS 0
-%define CONFIG_ICONV 0
 %define CONFIG_JNI 0
 %define CONFIG_LADSPA 0
 %define CONFIG_LIBASS 0
 %define CONFIG_LIBBLURAY 0
 %define CONFIG_LIBBS2B 0
 %define CONFIG_LIBCACA 0
-%define CONFIG_LIBCDIO 0
 %define CONFIG_LIBCELT 0
 %define CONFIG_LIBDC1394 0
-%define CONFIG_LIBEBUR128 0
-%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_LIBDRM 0
 %define CONFIG_LIBFLITE 0
 %define CONFIG_LIBFONTCONFIG 0
 %define CONFIG_LIBFREETYPE 0
 %define CONFIG_LIBFRIBIDI 0
 %define CONFIG_LIBGME 0
 %define CONFIG_LIBGSM 0
 %define CONFIG_LIBIEC61883 0
 %define CONFIG_LIBILBC 0
 %define CONFIG_LIBKVAZAAR 0
 %define CONFIG_LIBMODPLUG 0
 %define CONFIG_LIBMP3LAME 0
-%define CONFIG_LIBNUT 0
-%define CONFIG_LIBOPENCORE_AMRNB 0
-%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBMYSOFA 0
 %define CONFIG_LIBOPENCV 0
 %define CONFIG_LIBOPENH264 0
 %define CONFIG_LIBOPENJPEG 0
 %define CONFIG_LIBOPENMPT 0
 %define CONFIG_LIBOPUS 0
 %define CONFIG_LIBPULSE 0
+%define CONFIG_LIBRSVG 0
 %define CONFIG_LIBRTMP 0
-%define CONFIG_LIBRUBBERBAND 0
-%define CONFIG_LIBSCHROEDINGER 0
 %define CONFIG_LIBSHINE 0
 %define CONFIG_LIBSMBCLIENT 0
 %define CONFIG_LIBSNAPPY 0
 %define CONFIG_LIBSOXR 0
 %define CONFIG_LIBSPEEX 0
 %define CONFIG_LIBSSH 0
 %define CONFIG_LIBTESSERACT 0
 %define CONFIG_LIBTHEORA 0
 %define CONFIG_LIBTWOLAME 0
 %define CONFIG_LIBV4L2 0
-%define CONFIG_LIBVIDSTAB 0
-%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_LIBVMAF 0
 %define CONFIG_LIBVORBIS 0
 %define CONFIG_LIBVPX 0
 %define CONFIG_LIBWAVPACK 0
 %define CONFIG_LIBWEBP 0
-%define CONFIG_LIBX264 0
-%define CONFIG_LIBX265 0
-%define CONFIG_LIBXAVS 0
-%define CONFIG_LIBXCB 0
-%define CONFIG_LIBXCB_SHM 0
-%define CONFIG_LIBXCB_SHAPE 0
-%define CONFIG_LIBXCB_XFIXES 0
-%define CONFIG_LIBXVID 0
+%define CONFIG_LIBXML2 0
 %define CONFIG_LIBZIMG 0
 %define CONFIG_LIBZMQ 0
 %define CONFIG_LIBZVBI 0
-%define CONFIG_LZMA 0
 %define CONFIG_MEDIACODEC 0
-%define CONFIG_NETCDF 0
 %define CONFIG_OPENAL 0
 %define CONFIG_OPENCL 0
 %define CONFIG_OPENGL 0
-%define CONFIG_OPENSSL 0
-%define CONFIG_SCHANNEL 0
-%define CONFIG_SDL 0
-%define CONFIG_SDL2 0
-%define CONFIG_SECURETRANSPORT 0
-%define CONFIG_VIDEOTOOLBOX 0
-%define CONFIG_X11GRAB 0
-%define CONFIG_XLIB 0
-%define CONFIG_ZLIB 0
-%define CONFIG_AUDIOTOOLBOX 0
+%define CONFIG_AUDIOTOOLBOX 1
+%define CONFIG_CRYSTALHD 0
 %define CONFIG_CUDA 0
 %define CONFIG_CUVID 0
 %define CONFIG_D3D11VA 0
 %define CONFIG_DXVA2 0
-%define CONFIG_LIBMFX 0
-%define CONFIG_LIBNPP 0
-%define CONFIG_MMAL 0
 %define CONFIG_NVENC 0
-%define CONFIG_OMX 0
 %define CONFIG_VAAPI 0
 %define CONFIG_VDA 0
 %define CONFIG_VDPAU 0
+%define CONFIG_VIDEOTOOLBOX 0
+%define CONFIG_V4L2_M2M 0
 %define CONFIG_XVMC 0
+%define CONFIG_CUDA_SDK 0
+%define CONFIG_LIBNPP 0
+%define CONFIG_LIBMFX 0
+%define CONFIG_MMAL 0
+%define CONFIG_OMX 0
 %define CONFIG_FTRAPV 0
 %define CONFIG_GRAY 0
 %define CONFIG_HARDCODED_TABLES 0
 %define CONFIG_OMX_RPI 0
 %define CONFIG_RUNTIME_CPUDETECT 1
 %define CONFIG_SAFE_BITSTREAM_READER 1
 %define CONFIG_SHARED 1
 %define CONFIG_SMALL 0
@@ -526,70 +536,86 @@
 %define CONFIG_FAST_UNALIGNED 1
 %define CONFIG_FFT 0
 %define CONFIG_LSP 0
 %define CONFIG_LZO 0
 %define CONFIG_MDCT 0
 %define CONFIG_PIXELUTILS 0
 %define CONFIG_NETWORK 0
 %define CONFIG_RDFT 0
+%define CONFIG_AUTODETECT 0
 %define CONFIG_FONTCONFIG 0
-%define CONFIG_MEMALIGN_HACK 0
+%define CONFIG_LINUX_PERF 0
 %define CONFIG_MEMORY_POISONING 0
 %define CONFIG_NEON_CLOBBER_TEST 0
+%define CONFIG_OSSFUZZ 0
 %define CONFIG_PIC 1
-%define CONFIG_POD2MAN 1
-%define CONFIG_RAISE_MAJOR 0
 %define CONFIG_THUMB 0
 %define CONFIG_VALGRIND_BACKTRACE 0
 %define CONFIG_XMM_CLOBBER_TEST 0
+%define CONFIG_BSFS 1
+%define CONFIG_DECODERS 1
+%define CONFIG_ENCODERS 0
+%define CONFIG_HWACCELS 0
+%define CONFIG_PARSERS 1
+%define CONFIG_INDEVS 0
+%define CONFIG_OUTDEVS 0
+%define CONFIG_FILTERS 0
+%define CONFIG_DEMUXERS 0
+%define CONFIG_MUXERS 0
+%define CONFIG_PROTOCOLS 0
 %define CONFIG_AANDCTTABLES 0
 %define CONFIG_AC3DSP 0
 %define CONFIG_AUDIO_FRAME_QUEUE 0
 %define CONFIG_AUDIODSP 0
 %define CONFIG_BLOCKDSP 0
 %define CONFIG_BSWAPDSP 0
 %define CONFIG_CABAC 0
 %define CONFIG_DIRAC_PARSE 0
 %define CONFIG_DVPROFILE 0
 %define CONFIG_EXIF 0
 %define CONFIG_FAANDCT 0
 %define CONFIG_FAANIDCT 0
 %define CONFIG_FDCTDSP 0
 %define CONFIG_FLACDSP 1
 %define CONFIG_FMTCONVERT 0
+%define CONFIG_FRAME_THREAD_ENCODER 0
 %define CONFIG_G722DSP 0
-%define CONFIG_GOLOMB 1
+%define CONFIG_GOLOMB 0
 %define CONFIG_GPLV3 0
 %define CONFIG_H263DSP 0
 %define CONFIG_H264CHROMA 0
 %define CONFIG_H264DSP 0
+%define CONFIG_H264PARSE 0
 %define CONFIG_H264PRED 1
 %define CONFIG_H264QPEL 0
+%define CONFIG_HEVCPARSE 0
 %define CONFIG_HPELDSP 0
 %define CONFIG_HUFFMAN 0
 %define CONFIG_HUFFYUVDSP 0
 %define CONFIG_HUFFYUVENCDSP 0
 %define CONFIG_IDCTDSP 0
 %define CONFIG_IIRFILTER 0
-%define CONFIG_IMDCT15 0
+%define CONFIG_MDCT15 0
 %define CONFIG_INTRAX8 0
 %define CONFIG_ISO_MEDIA 0
 %define CONFIG_IVIDSP 0
 %define CONFIG_JPEGTABLES 0
 %define CONFIG_LGPLV3 0
 %define CONFIG_LIBX262 0
 %define CONFIG_LLAUDDSP 0
 %define CONFIG_LLVIDDSP 0
+%define CONFIG_LLVIDENCDSP 0
 %define CONFIG_LPC 0
 %define CONFIG_LZF 0
 %define CONFIG_ME_CMP 0
 %define CONFIG_MPEG_ER 0
 %define CONFIG_MPEGAUDIO 0
 %define CONFIG_MPEGAUDIODSP 0
+%define CONFIG_MPEGAUDIOHEADER 0
 %define CONFIG_MPEGVIDEO 0
 %define CONFIG_MPEGVIDEOENC 0
 %define CONFIG_MSS34DSP 0
 %define CONFIG_PIXBLOCKDSP 0
 %define CONFIG_QPELDSP 0
 %define CONFIG_QSV 0
 %define CONFIG_QSVDEC 0
 %define CONFIG_QSVENC 0
@@ -601,23 +627,23 @@
 %define CONFIG_RV34DSP 0
 %define CONFIG_SINEWIN 0
 %define CONFIG_SNAPPY 0
 %define CONFIG_SRTP 0
 %define CONFIG_STARTCODE 0
 %define CONFIG_TEXTUREDSP 0
 %define CONFIG_TEXTUREDSPENC 0
 %define CONFIG_TPELDSP 0
+%define CONFIG_VAAPI_1 0
 %define CONFIG_VAAPI_ENCODE 0
 %define CONFIG_VC1DSP 0
 %define CONFIG_VIDEODSP 1
 %define CONFIG_VP3DSP 0
 %define CONFIG_VP56DSP 0
 %define CONFIG_VP8DSP 1
-%define CONFIG_VT_BT2020 0
 %define CONFIG_WMA_FREQS 0
 %define CONFIG_WMV2DSP 0
 %define CONFIG_NULL_BSF 1
 %define CONFIG_VP8_DECODER 1
 %define CONFIG_VP9_DECODER 1
 %define CONFIG_FLAC_DECODER 1
 %define CONFIG_FLAC_PARSER 0
 %define CONFIG_VP8_PARSER 1
--- a/media/ffvpx/config_darwin64.h
+++ b/media/ffvpx/config_darwin64.h
@@ -1,17 +1,17 @@
 /* Automatically generated by configure - do not modify! */
 #ifndef FFMPEG_CONFIG_H
 #define FFMPEG_CONFIG_H
-#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-asm --enable-yasm"
+#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --disable-videotoolbox --enable-decoder=flac --enable-asm --enable-x86asm"
 #define FFMPEG_LICENSE "LGPL version 2.1 or later"
-#define CONFIG_THIS_YEAR 2016
+#define CONFIG_THIS_YEAR 2017
 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg"
 #define AVCONV_DATADIR "/usr/local/share/ffmpeg"
-#define CC_IDENT "Apple LLVM version 7.0.2 (clang-700.1.81)"
+#define CC_IDENT "Apple LLVM version 9.0.0 (clang-900.0.38)"
 #define av_restrict restrict
 #define EXTERN_PREFIX "_"
 #define EXTERN_ASM _
 #define BUILDSUF ""
 #define SLIBSUF ".dylib"
 #define HAVE_MMX2 HAVE_MMXEXT
 #define SWS_MAX_FILTER_SIZE 256
 #define ARCH_AARCH64 0
@@ -74,18 +74,18 @@
 #define HAVE_MIPS32R2 0
 #define HAVE_MIPS32R5 0
 #define HAVE_MIPS64R2 0
 #define HAVE_MIPS32R6 0
 #define HAVE_MIPS64R6 0
 #define HAVE_MIPSDSP 0
 #define HAVE_MIPSDSPR2 0
 #define HAVE_MSA 0
-#define HAVE_LOONGSON2 1
-#define HAVE_LOONGSON3 1
+#define HAVE_LOONGSON2 0
+#define HAVE_LOONGSON3 0
 #define HAVE_MMI 0
 #define HAVE_ARMV5TE_EXTERNAL 0
 #define HAVE_ARMV6_EXTERNAL 0
 #define HAVE_ARMV6T2_EXTERNAL 0
 #define HAVE_ARMV8_EXTERNAL 0
 #define HAVE_NEON_EXTERNAL 0
 #define HAVE_VFP_EXTERNAL 0
 #define HAVE_VFPV3_EXTERNAL 0
@@ -173,66 +173,67 @@
 #define HAVE_ALIGNED_STACK 1
 #define HAVE_FAST_64BIT 1
 #define HAVE_FAST_CLZ 1
 #define HAVE_FAST_CMOV 1
 #define HAVE_LOCAL_ALIGNED_8 1
 #define HAVE_LOCAL_ALIGNED_16 1
 #define HAVE_LOCAL_ALIGNED_32 1
 #define HAVE_SIMD_ALIGN_16 1
+#define HAVE_SIMD_ALIGN_32 1
 #define HAVE_ATOMICS_GCC 1
 #define HAVE_ATOMICS_SUNCC 0
 #define HAVE_ATOMICS_WIN32 0
 #define HAVE_ATOMIC_CAS_PTR 0
-#define HAVE_ATOMIC_COMPARE_EXCHANGE 1
 #define HAVE_MACHINE_RW_BARRIER 0
 #define HAVE_MEMORYBARRIER 0
 #define HAVE_MM_EMPTY 1
 #define HAVE_RDTSC 0
 #define HAVE_SARESTART 1
-#define HAVE_SEM_TIMEDWAIT 1
+#define HAVE_SEM_TIMEDWAIT 0
 #define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1
 #define HAVE_CABS 1
 #define HAVE_CEXP 1
 #define HAVE_INLINE_ASM 1
 #define HAVE_SYMVER 1
-#define HAVE_YASM 1
+#define HAVE_X86ASM 1
 #define HAVE_BIGENDIAN 0
 #define HAVE_FAST_UNALIGNED 1
-#define HAVE_INCOMPATIBLE_LIBAV_ABI 0
-#define HAVE_ALSA_ASOUNDLIB_H 0
 #define HAVE_ALTIVEC_H 0
 #define HAVE_ARPA_INET_H 1
 #define HAVE_ASM_TYPES_H 0
 #define HAVE_CDIO_PARANOIA_H 0
 #define HAVE_CDIO_PARANOIA_PARANOIA_H 0
-#define HAVE_DISPATCH_DISPATCH_H 0
+#define HAVE_CUDA_H 0
+#define HAVE_D3D11_H 0
+#define HAVE_DISPATCH_DISPATCH_H 1
 #define HAVE_DEV_BKTR_IOCTL_BT848_H 0
 #define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
 #define HAVE_DEV_IC_BT8XX_H 0
 #define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0
 #define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0
 #define HAVE_DIRECT_H 0
 #define HAVE_DIRENT_H 1
 #define HAVE_DLFCN_H 1
-#define HAVE_D3D11_H 0
+#define HAVE_DXGIDEBUG_H 0
 #define HAVE_DXVA_H 0
 #define HAVE_ES2_GL_H 0
 #define HAVE_GSM_H 0
 #define HAVE_IO_H 0
 #define HAVE_MACH_MACH_TIME_H 1
 #define HAVE_MACHINE_IOCTL_BT848_H 0
 #define HAVE_MACHINE_IOCTL_METEOR_H 0
 #define HAVE_OPENCV2_CORE_CORE_C_H 0
+#define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+#define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
 #define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
 #define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
 #define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
 #define HAVE_OPENGL_GL3_H 0
 #define HAVE_POLL_H 1
-#define HAVE_SNDIO_H 0
 #define HAVE_SOUNDCARD_H 0
 #define HAVE_STDATOMIC_H 1
 #define HAVE_SYS_MMAN_H 1
 #define HAVE_SYS_PARAM_H 1
 #define HAVE_SYS_RESOURCE_H 1
 #define HAVE_SYS_SELECT_H 1
 #define HAVE_SYS_SOUNDCARD_H 0
 #define HAVE_SYS_TIME_H 1
@@ -271,22 +272,21 @@
 #define HAVE_RINT 1
 #define HAVE_ROUND 1
 #define HAVE_ROUNDF 1
 #define HAVE_SINF 1
 #define HAVE_TRUNC 1
 #define HAVE_TRUNCF 1
 #define HAVE_ACCESS 1
 #define HAVE_ALIGNED_MALLOC 0
-#define HAVE_CLOCK_GETTIME 0
+#define HAVE_CLOCK_GETTIME 1
 #define HAVE_CLOSESOCKET 0
 #define HAVE_COMMANDLINETOARGVW 0
 #define HAVE_COTASKMEMFREE 0
 #define HAVE_CRYPTGENRANDOM 0
-#define HAVE_DLOPEN 1
 #define HAVE_FCNTL 1
 #define HAVE_FLT_LIM 1
 #define HAVE_FORK 1
 #define HAVE_GETADDRINFO 1
 #define HAVE_GETHRTIME 0
 #define HAVE_GETOPT 1
 #define HAVE_GETPROCESSAFFINITYMASK 0
 #define HAVE_GETPROCESSMEMORYINFO 0
@@ -315,205 +315,215 @@
 #define HAVE_SCHED_GETAFFINITY 0
 #define HAVE_SETCONSOLETEXTATTRIBUTE 0
 #define HAVE_SETCONSOLECTRLHANDLER 0
 #define HAVE_SETMODE 0
 #define HAVE_SETRLIMIT 1
 #define HAVE_SLEEP 0
 #define HAVE_STRERROR_R 1
 #define HAVE_SYSCONF 1
+#define HAVE_SYSCTL 1
 #define HAVE_USLEEP 1
-#define HAVE_UTGETOSTYPEFROMSTRING 1
+#define HAVE_UTGETOSTYPEFROMSTRING 0
 #define HAVE_VIRTUALALLOC 0
 #define HAVE_WGLGETPROCADDRESS 0
 #define HAVE_PTHREADS 1
 #define HAVE_OS2THREADS 0
 #define HAVE_W32THREADS 0
 #define HAVE_AS_DN_DIRECTIVE 0
+#define HAVE_AS_FPU_DIRECTIVE 0
 #define HAVE_AS_FUNC 0
 #define HAVE_AS_OBJECT_ARCH 0
 #define HAVE_ASM_MOD_Q 0
 #define HAVE_ATTRIBUTE_MAY_ALIAS 1
 #define HAVE_ATTRIBUTE_PACKED 1
+#define HAVE_BLOCKS_EXTENSION 1
 #define HAVE_EBP_AVAILABLE 1
 #define HAVE_EBX_AVAILABLE 1
 #define HAVE_GNU_AS 0
 #define HAVE_GNU_WINDRES 0
 #define HAVE_IBM_ASM 0
 #define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1
 #define HAVE_INLINE_ASM_LABELS 1
 #define HAVE_INLINE_ASM_NONLOCAL_LABELS 1
 #define HAVE_PRAGMA_DEPRECATED 1
 #define HAVE_RSYNC_CONTIMEOUT 0
 #define HAVE_SYMVER_ASM_LABEL 1
 #define HAVE_SYMVER_GNU_ASM 0
 #define HAVE_VFP_ARGS 0
 #define HAVE_XFORM_ASM 0
 #define HAVE_XMM_CLOBBERS 1
 #define HAVE_CONDITION_VARIABLE_PTR 0
+#define HAVE_KCMVIDEOCODECTYPE_HEVC 0
 #define HAVE_SOCKLEN_T 1
 #define HAVE_STRUCT_ADDRINFO 1
 #define HAVE_STRUCT_GROUP_SOURCE_REQ 1
 #define HAVE_STRUCT_IP_MREQ_SOURCE 1
 #define HAVE_STRUCT_IPV6_MREQ 1
 #define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1
 #define HAVE_STRUCT_POLLFD 1
 #define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1
 #define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
 #define HAVE_STRUCT_SOCKADDR_IN6 1
 #define HAVE_STRUCT_SOCKADDR_SA_LEN 1
 #define HAVE_STRUCT_SOCKADDR_STORAGE 1
 #define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0
 #define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0
 #define HAVE_ATOMICS_NATIVE 1
 #define HAVE_DOS_PATHS 0
-#define HAVE_DXVA2_LIB 0
-#define HAVE_DXVA2API_COBJ 0
 #define HAVE_LIBC_MSVCRT 0
-#define HAVE_LIBDC1394_1 0
-#define HAVE_LIBDC1394_2 0
 #define HAVE_MAKEINFO 1
-#define HAVE_MAKEINFO_HTML 1
+#define HAVE_MAKEINFO_HTML 0
 #define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
 #define HAVE_PERL 1
 #define HAVE_POD2MAN 1
-#define HAVE_SDL2 0
 #define HAVE_SECTION_DATA_REL_RO 0
 #define HAVE_TEXI2HTML 0
 #define HAVE_THREADS 1
+#define HAVE_UWP 0
 #define HAVE_VAAPI_DRM 0
 #define HAVE_VAAPI_X11 0
 #define HAVE_VDPAU_X11 0
 #define HAVE_WINRT 0
-#define HAVE_XLIB 0
-#define CONFIG_BSFS 0
-#define CONFIG_DECODERS 1
-#define CONFIG_PARSERS 1
 #define CONFIG_DOC 0
-#define CONFIG_HTMLPAGES 1
+#define CONFIG_HTMLPAGES 0
 #define CONFIG_MANPAGES 1
 #define CONFIG_PODPAGES 1
 #define CONFIG_TXTPAGES 1
 #define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
 #define CONFIG_AVIO_READING_EXAMPLE 1
-#define CONFIG_DECODING_ENCODING_EXAMPLE 0
+#define CONFIG_DECODE_AUDIO_EXAMPLE 1
+#define CONFIG_DECODE_VIDEO_EXAMPLE 1
 #define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+#define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+#define CONFIG_ENCODE_VIDEO_EXAMPLE 1
 #define CONFIG_EXTRACT_MVS_EXAMPLE 0
 #define CONFIG_FILTER_AUDIO_EXAMPLE 0
 #define CONFIG_FILTERING_AUDIO_EXAMPLE 0
 #define CONFIG_FILTERING_VIDEO_EXAMPLE 0
 #define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+#define CONFIG_HW_DECODE_EXAMPLE 0
 #define CONFIG_METADATA_EXAMPLE 0
 #define CONFIG_MUXING_EXAMPLE 0
 #define CONFIG_QSVDEC_EXAMPLE 0
 #define CONFIG_REMUXING_EXAMPLE 0
 #define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0
 #define CONFIG_SCALING_VIDEO_EXAMPLE 0
 #define CONFIG_TRANSCODE_AAC_EXAMPLE 0
 #define CONFIG_TRANSCODING_EXAMPLE 0
+#define CONFIG_ALSA 0
+#define CONFIG_APPKIT 1
+#define CONFIG_AVFOUNDATION 1
+#define CONFIG_BZLIB 1
+#define CONFIG_COREIMAGE 1
+#define CONFIG_ICONV 0
+#define CONFIG_JACK 0
+#define CONFIG_LIBXCB 0
+#define CONFIG_LIBXCB_SHM 0
+#define CONFIG_LIBXCB_SHAPE 0
+#define CONFIG_LIBXCB_XFIXES 0
+#define CONFIG_LZMA 0
+#define CONFIG_SCHANNEL 0
+#define CONFIG_SDL2 0
+#define CONFIG_SECURETRANSPORT 0
+#define CONFIG_SNDIO 0
+#define CONFIG_XLIB 1
+#define CONFIG_ZLIB 1
 #define CONFIG_AVISYNTH 0
-#define CONFIG_BZLIB 0
-#define CONFIG_CHROMAPRINT 0
-#define CONFIG_CRYSTALHD 0
+#define CONFIG_FREI0R 0
+#define CONFIG_LIBCDIO 0
+#define CONFIG_LIBRUBBERBAND 0
+#define CONFIG_LIBVIDSTAB 0
+#define CONFIG_LIBX264 0
+#define CONFIG_LIBX265 0
+#define CONFIG_LIBXAVS 0
+#define CONFIG_LIBXVID 0
 #define CONFIG_DECKLINK 0
-#define CONFIG_FREI0R 0
-#define CONFIG_GCRYPT 0
+#define CONFIG_LIBNDI_NEWTEK 0
+#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_OPENSSL 0
 #define CONFIG_GMP 0
+#define CONFIG_LIBOPENCORE_AMRNB 0
+#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_RKMPP 0
+#define CONFIG_LIBSMBCLIENT 0
+#define CONFIG_CHROMAPRINT 0
+#define CONFIG_GCRYPT 0
 #define CONFIG_GNUTLS 0
-#define CONFIG_ICONV 0
 #define CONFIG_JNI 0
 #define CONFIG_LADSPA 0
 #define CONFIG_LIBASS 0
 #define CONFIG_LIBBLURAY 0
 #define CONFIG_LIBBS2B 0
 #define CONFIG_LIBCACA 0
-#define CONFIG_LIBCDIO 0
 #define CONFIG_LIBCELT 0
 #define CONFIG_LIBDC1394 0
-#define CONFIG_LIBEBUR128 0
-#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_LIBDRM 0
 #define CONFIG_LIBFLITE 0
 #define CONFIG_LIBFONTCONFIG 0
 #define CONFIG_LIBFREETYPE 0
 #define CONFIG_LIBFRIBIDI 0
 #define CONFIG_LIBGME 0
 #define CONFIG_LIBGSM 0
 #define CONFIG_LIBIEC61883 0
 #define CONFIG_LIBILBC 0
 #define CONFIG_LIBKVAZAAR 0
 #define CONFIG_LIBMODPLUG 0
 #define CONFIG_LIBMP3LAME 0
-#define CONFIG_LIBNUT 0
-#define CONFIG_LIBOPENCORE_AMRNB 0
-#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBMYSOFA 0
 #define CONFIG_LIBOPENCV 0
 #define CONFIG_LIBOPENH264 0
 #define CONFIG_LIBOPENJPEG 0
 #define CONFIG_LIBOPENMPT 0
 #define CONFIG_LIBOPUS 0
 #define CONFIG_LIBPULSE 0
+#define CONFIG_LIBRSVG 0
 #define CONFIG_LIBRTMP 0
-#define CONFIG_LIBRUBBERBAND 0
-#define CONFIG_LIBSCHROEDINGER 0
 #define CONFIG_LIBSHINE 0
 #define CONFIG_LIBSMBCLIENT 0
 #define CONFIG_LIBSNAPPY 0
 #define CONFIG_LIBSOXR 0
 #define CONFIG_LIBSPEEX 0
 #define CONFIG_LIBSSH 0
 #define CONFIG_LIBTESSERACT 0
 #define CONFIG_LIBTHEORA 0
 #define CONFIG_LIBTWOLAME 0
 #define CONFIG_LIBV4L2 0
-#define CONFIG_LIBVIDSTAB 0
-#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_LIBVMAF 0
 #define CONFIG_LIBVORBIS 0
 #define CONFIG_LIBVPX 0
 #define CONFIG_LIBWAVPACK 0
 #define CONFIG_LIBWEBP 0
-#define CONFIG_LIBX264 0
-#define CONFIG_LIBX265 0
-#define CONFIG_LIBXAVS 0
-#define CONFIG_LIBXCB 0
-#define CONFIG_LIBXCB_SHM 0
-#define CONFIG_LIBXCB_SHAPE 0
-#define CONFIG_LIBXCB_XFIXES 0
-#define CONFIG_LIBXVID 0
+#define CONFIG_LIBXML2 0
 #define CONFIG_LIBZIMG 0
 #define CONFIG_LIBZMQ 0
 #define CONFIG_LIBZVBI 0
-#define CONFIG_LZMA 0
 #define CONFIG_MEDIACODEC 0
-#define CONFIG_NETCDF 0
 #define CONFIG_OPENAL 0
 #define CONFIG_OPENCL 0
 #define CONFIG_OPENGL 0
-#define CONFIG_OPENSSL 0
-#define CONFIG_SCHANNEL 0
-#define CONFIG_SDL 0
-#define CONFIG_SDL2 0
-#define CONFIG_SECURETRANSPORT 0
-#define CONFIG_VIDEOTOOLBOX 0
-#define CONFIG_X11GRAB 0
-#define CONFIG_XLIB 0
-#define CONFIG_ZLIB 0
-#define CONFIG_AUDIOTOOLBOX 0
+#define CONFIG_AUDIOTOOLBOX 1
+#define CONFIG_CRYSTALHD 0
 #define CONFIG_CUDA 0
 #define CONFIG_CUVID 0
 #define CONFIG_D3D11VA 0
 #define CONFIG_DXVA2 0
-#define CONFIG_LIBMFX 0
-#define CONFIG_LIBNPP 0
-#define CONFIG_MMAL 0
 #define CONFIG_NVENC 0
-#define CONFIG_OMX 0
 #define CONFIG_VAAPI 0
 #define CONFIG_VDA 0
 #define CONFIG_VDPAU 0
+#define CONFIG_VIDEOTOOLBOX 0
+#define CONFIG_V4L2_M2M 0
 #define CONFIG_XVMC 0
+#define CONFIG_CUDA_SDK 0
+#define CONFIG_LIBNPP 0
+#define CONFIG_LIBMFX 0
+#define CONFIG_MMAL 0
+#define CONFIG_OMX 0
 #define CONFIG_FTRAPV 0
 #define CONFIG_GRAY 0
 #define CONFIG_HARDCODED_TABLES 0
 #define CONFIG_OMX_RPI 0
 #define CONFIG_RUNTIME_CPUDETECT 1
 #define CONFIG_SAFE_BITSTREAM_READER 1
 #define CONFIG_SHARED 1
 #define CONFIG_SMALL 0
@@ -542,70 +552,86 @@
 #define CONFIG_FAST_UNALIGNED 1
 #define CONFIG_FFT 0
 #define CONFIG_LSP 0
 #define CONFIG_LZO 0
 #define CONFIG_MDCT 0
 #define CONFIG_PIXELUTILS 0
 #define CONFIG_NETWORK 0
 #define CONFIG_RDFT 0
+#define CONFIG_AUTODETECT 0
 #define CONFIG_FONTCONFIG 0
-#define CONFIG_MEMALIGN_HACK 0
+#define CONFIG_LINUX_PERF 0
 #define CONFIG_MEMORY_POISONING 0
 #define CONFIG_NEON_CLOBBER_TEST 0
+#define CONFIG_OSSFUZZ 0
 #define CONFIG_PIC 1
-#define CONFIG_POD2MAN 1
-#define CONFIG_RAISE_MAJOR 0
 #define CONFIG_THUMB 0
 #define CONFIG_VALGRIND_BACKTRACE 0
 #define CONFIG_XMM_CLOBBER_TEST 0
+#define CONFIG_BSFS 1
+#define CONFIG_DECODERS 1
+#define CONFIG_ENCODERS 0
+#define CONFIG_HWACCELS 0
+#define CONFIG_PARSERS 1
+#define CONFIG_INDEVS 0
+#define CONFIG_OUTDEVS 0
+#define CONFIG_FILTERS 0
+#define CONFIG_DEMUXERS 0
+#define CONFIG_MUXERS 0
+#define CONFIG_PROTOCOLS 0
 #define CONFIG_AANDCTTABLES 0
 #define CONFIG_AC3DSP 0
 #define CONFIG_AUDIO_FRAME_QUEUE 0
 #define CONFIG_AUDIODSP 0
 #define CONFIG_BLOCKDSP 0
 #define CONFIG_BSWAPDSP 0
 #define CONFIG_CABAC 0
 #define CONFIG_DIRAC_PARSE 0
 #define CONFIG_DVPROFILE 0
 #define CONFIG_EXIF 0
 #define CONFIG_FAANDCT 0
 #define CONFIG_FAANIDCT 0
 #define CONFIG_FDCTDSP 0
 #define CONFIG_FLACDSP 1
 #define CONFIG_FMTCONVERT 0
+#define CONFIG_FRAME_THREAD_ENCODER 0
 #define CONFIG_G722DSP 0
-#define CONFIG_GOLOMB 1
+#define CONFIG_GOLOMB 0
 #define CONFIG_GPLV3 0
 #define CONFIG_H263DSP 0
 #define CONFIG_H264CHROMA 0
 #define CONFIG_H264DSP 0
+#define CONFIG_H264PARSE 0
 #define CONFIG_H264PRED 1
 #define CONFIG_H264QPEL 0
+#define CONFIG_HEVCPARSE 0
 #define CONFIG_HPELDSP 0
 #define CONFIG_HUFFMAN 0
 #define CONFIG_HUFFYUVDSP 0
 #define CONFIG_HUFFYUVENCDSP 0
 #define CONFIG_IDCTDSP 0
 #define CONFIG_IIRFILTER 0
-#define CONFIG_IMDCT15 0
+#define CONFIG_MDCT15 0
 #define CONFIG_INTRAX8 0
 #define CONFIG_ISO_MEDIA 0
 #define CONFIG_IVIDSP 0
 #define CONFIG_JPEGTABLES 0
 #define CONFIG_LGPLV3 0
 #define CONFIG_LIBX262 0
 #define CONFIG_LLAUDDSP 0
 #define CONFIG_LLVIDDSP 0
+#define CONFIG_LLVIDENCDSP 0
 #define CONFIG_LPC 0
 #define CONFIG_LZF 0
 #define CONFIG_ME_CMP 0
 #define CONFIG_MPEG_ER 0
 #define CONFIG_MPEGAUDIO 0
 #define CONFIG_MPEGAUDIODSP 0
+#define CONFIG_MPEGAUDIOHEADER 0
 #define CONFIG_MPEGVIDEO 0
 #define CONFIG_MPEGVIDEOENC 0
 #define CONFIG_MSS34DSP 0
 #define CONFIG_PIXBLOCKDSP 0
 #define CONFIG_QPELDSP 0
 #define CONFIG_QSV 0
 #define CONFIG_QSVDEC 0
 #define CONFIG_QSVENC 0
@@ -617,23 +643,23 @@
 #define CONFIG_RV34DSP 0
 #define CONFIG_SINEWIN 0
 #define CONFIG_SNAPPY 0
 #define CONFIG_SRTP 0
 #define CONFIG_STARTCODE 0
 #define CONFIG_TEXTUREDSP 0
 #define CONFIG_TEXTUREDSPENC 0
 #define CONFIG_TPELDSP 0
+#define CONFIG_VAAPI_1 0
 #define CONFIG_VAAPI_ENCODE 0
 #define CONFIG_VC1DSP 0
 #define CONFIG_VIDEODSP 1
 #define CONFIG_VP3DSP 0
 #define CONFIG_VP56DSP 0
 #define CONFIG_VP8DSP 1
-#define CONFIG_VT_BT2020 0
 #define CONFIG_WMA_FREQS 0
 #define CONFIG_WMV2DSP 0
 #define CONFIG_NULL_BSF 1
 #define CONFIG_VP8_DECODER 1
 #define CONFIG_VP9_DECODER 1
 #define CONFIG_FLAC_DECODER 1
 #define CONFIG_FLAC_PARSER 0
 #define CONFIG_VP8_PARSER 1
--- a/media/ffvpx/config_unix32.h
+++ b/media/ffvpx/config_unix32.h
@@ -1,17 +1,17 @@
 /* Automatically generated by configure - do not modify! */
 #ifndef FFMPEG_CONFIG_H
 #define FFMPEG_CONFIG_H
-#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-asm --enable-yasm --disable-asm --disable-yasm --cc='gcc -m32'"
+#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-decoder=flac --disable-asm --disable-x86asm"
 #define FFMPEG_LICENSE "LGPL version 2.1 or later"
-#define CONFIG_THIS_YEAR 2016
+#define CONFIG_THIS_YEAR 2017
 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg"
 #define AVCONV_DATADIR "/usr/local/share/ffmpeg"
-#define CC_IDENT "gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)"
+#define CC_IDENT "gcc 6.3.0 (Ubuntu 6.3.0-12ubuntu2) 20170406"
 #define av_restrict restrict
 #define EXTERN_PREFIX ""
 #define EXTERN_ASM
 #define BUILDSUF ""
 #define SLIBSUF ".so"
 #define HAVE_MMX2 HAVE_MMXEXT
 #define SWS_MAX_FILTER_SIZE 256
 #define ARCH_AARCH64 0
@@ -173,65 +173,67 @@
 #define HAVE_ALIGNED_STACK 0
 #define HAVE_FAST_64BIT 0
 #define HAVE_FAST_CLZ 0
 #define HAVE_FAST_CMOV 0
 #define HAVE_LOCAL_ALIGNED_8 1
 #define HAVE_LOCAL_ALIGNED_16 1
 #define HAVE_LOCAL_ALIGNED_32 1
 #define HAVE_SIMD_ALIGN_16 0
+#define HAVE_SIMD_ALIGN_32 0
 #define HAVE_ATOMICS_GCC 1
 #define HAVE_ATOMICS_SUNCC 0
 #define HAVE_ATOMICS_WIN32 0
 #define HAVE_ATOMIC_CAS_PTR 0
-#define HAVE_ATOMIC_COMPARE_EXCHANGE 0
 #define HAVE_MACHINE_RW_BARRIER 0
 #define HAVE_MEMORYBARRIER 0
 #define HAVE_MM_EMPTY 0
 #define HAVE_RDTSC 0
 #define HAVE_SARESTART 1
 #define HAVE_SEM_TIMEDWAIT 1
 #define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1
 #define HAVE_CABS 1
 #define HAVE_CEXP 1
 #define HAVE_INLINE_ASM 1
 #define HAVE_SYMVER 1
-#define HAVE_YASM 0
+#define HAVE_X86ASM 0
 #define HAVE_BIGENDIAN 0
 #define HAVE_FAST_UNALIGNED 0
-#define HAVE_ALSA_ASOUNDLIB_H 0
 #define HAVE_ALTIVEC_H 0
 #define HAVE_ARPA_INET_H 1
 #define HAVE_ASM_TYPES_H 1
 #define HAVE_CDIO_PARANOIA_H 0
 #define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+#define HAVE_CUDA_H 0
+#define HAVE_D3D11_H 0
 #define HAVE_DISPATCH_DISPATCH_H 0
 #define HAVE_DEV_BKTR_IOCTL_BT848_H 0
 #define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
 #define HAVE_DEV_IC_BT8XX_H 0
 #define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0
 #define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0
 #define HAVE_DIRECT_H 0
 #define HAVE_DIRENT_H 1
 #define HAVE_DLFCN_H 1
-#define HAVE_D3D11_H 0
+#define HAVE_DXGIDEBUG_H 0
 #define HAVE_DXVA_H 0
 #define HAVE_ES2_GL_H 0
 #define HAVE_GSM_H 0
 #define HAVE_IO_H 0
 #define HAVE_MACH_MACH_TIME_H 0
 #define HAVE_MACHINE_IOCTL_BT848_H 0
 #define HAVE_MACHINE_IOCTL_METEOR_H 0
 #define HAVE_OPENCV2_CORE_CORE_C_H 0
+#define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+#define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
 #define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
 #define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
 #define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
 #define HAVE_OPENGL_GL3_H 0
 #define HAVE_POLL_H 1
-#define HAVE_SNDIO_H 0
 #define HAVE_SOUNDCARD_H 0
 #define HAVE_STDATOMIC_H 1
 #define HAVE_SYS_MMAN_H 1
 #define HAVE_SYS_PARAM_H 1
 #define HAVE_SYS_RESOURCE_H 1
 #define HAVE_SYS_SELECT_H 1
 #define HAVE_SYS_SOUNDCARD_H 1
 #define HAVE_SYS_TIME_H 1
@@ -275,17 +277,16 @@
 #define HAVE_TRUNCF 1
 #define HAVE_ACCESS 1
 #define HAVE_ALIGNED_MALLOC 0
 #define HAVE_CLOCK_GETTIME 1
 #define HAVE_CLOSESOCKET 0
 #define HAVE_COMMANDLINETOARGVW 0
 #define HAVE_COTASKMEMFREE 0
 #define HAVE_CRYPTGENRANDOM 0
-#define HAVE_DLOPEN 1
 #define HAVE_FCNTL 1
 #define HAVE_FLT_LIM 1
 #define HAVE_FORK 1
 #define HAVE_GETADDRINFO 1
 #define HAVE_GETHRTIME 0
 #define HAVE_GETOPT 1
 #define HAVE_GETPROCESSAFFINITYMASK 0
 #define HAVE_GETPROCESSMEMORYINFO 0
@@ -314,204 +315,215 @@
 #define HAVE_SCHED_GETAFFINITY 1
 #define HAVE_SETCONSOLETEXTATTRIBUTE 0
 #define HAVE_SETCONSOLECTRLHANDLER 0
 #define HAVE_SETMODE 0
 #define HAVE_SETRLIMIT 1
 #define HAVE_SLEEP 0
 #define HAVE_STRERROR_R 1
 #define HAVE_SYSCONF 1
+#define HAVE_SYSCTL 0
 #define HAVE_USLEEP 1
 #define HAVE_UTGETOSTYPEFROMSTRING 0
 #define HAVE_VIRTUALALLOC 0
 #define HAVE_WGLGETPROCADDRESS 0
 #define HAVE_PTHREADS 1
 #define HAVE_OS2THREADS 0
 #define HAVE_W32THREADS 0
 #define HAVE_AS_DN_DIRECTIVE 0
+#define HAVE_AS_FPU_DIRECTIVE 0
 #define HAVE_AS_FUNC 0
 #define HAVE_AS_OBJECT_ARCH 0
 #define HAVE_ASM_MOD_Q 0
 #define HAVE_ATTRIBUTE_MAY_ALIAS 1
 #define HAVE_ATTRIBUTE_PACKED 1
+#define HAVE_BLOCKS_EXTENSION 0
 #define HAVE_EBP_AVAILABLE 1
 #define HAVE_EBX_AVAILABLE 1
 #define HAVE_GNU_AS 0
 #define HAVE_GNU_WINDRES 0
 #define HAVE_IBM_ASM 0
 #define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1
 #define HAVE_INLINE_ASM_LABELS 1
 #define HAVE_INLINE_ASM_NONLOCAL_LABELS 1
 #define HAVE_PRAGMA_DEPRECATED 1
 #define HAVE_RSYNC_CONTIMEOUT 1
 #define HAVE_SYMVER_ASM_LABEL 0
 #define HAVE_SYMVER_GNU_ASM 1
 #define HAVE_VFP_ARGS 0
 #define HAVE_XFORM_ASM 0
 #define HAVE_XMM_CLOBBERS 0
 #define HAVE_CONDITION_VARIABLE_PTR 0
+#define HAVE_KCMVIDEOCODECTYPE_HEVC 0
 #define HAVE_SOCKLEN_T 1
 #define HAVE_STRUCT_ADDRINFO 1
 #define HAVE_STRUCT_GROUP_SOURCE_REQ 1
 #define HAVE_STRUCT_IP_MREQ_SOURCE 1
 #define HAVE_STRUCT_IPV6_MREQ 1
 #define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1
 #define HAVE_STRUCT_POLLFD 1
 #define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1
 #define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
 #define HAVE_STRUCT_SOCKADDR_IN6 1
 #define HAVE_STRUCT_SOCKADDR_SA_LEN 0
 #define HAVE_STRUCT_SOCKADDR_STORAGE 1
 #define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
 #define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 1
 #define HAVE_ATOMICS_NATIVE 1
 #define HAVE_DOS_PATHS 0
-#define HAVE_DXVA2_LIB 0
-#define HAVE_DXVA2API_COBJ 0
 #define HAVE_LIBC_MSVCRT 0
-#define HAVE_LIBDC1394_1 0
-#define HAVE_LIBDC1394_2 0
 #define HAVE_MAKEINFO 0
 #define HAVE_MAKEINFO_HTML 0
 #define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
 #define HAVE_PERL 1
 #define HAVE_POD2MAN 1
-#define HAVE_SDL2 0
 #define HAVE_SECTION_DATA_REL_RO 1
 #define HAVE_TEXI2HTML 0
 #define HAVE_THREADS 1
+#define HAVE_UWP 0
 #define HAVE_VAAPI_DRM 0
 #define HAVE_VAAPI_X11 0
 #define HAVE_VDPAU_X11 0
 #define HAVE_WINRT 0
-#define HAVE_XLIB 0
-#define CONFIG_BSFS 0
-#define CONFIG_DECODERS 1
-#define CONFIG_PARSERS 1
 #define CONFIG_DOC 0
 #define CONFIG_HTMLPAGES 0
 #define CONFIG_MANPAGES 1
 #define CONFIG_PODPAGES 1
 #define CONFIG_TXTPAGES 0
 #define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
 #define CONFIG_AVIO_READING_EXAMPLE 1
-#define CONFIG_DECODING_ENCODING_EXAMPLE 0
+#define CONFIG_DECODE_AUDIO_EXAMPLE 1
+#define CONFIG_DECODE_VIDEO_EXAMPLE 1
 #define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+#define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+#define CONFIG_ENCODE_VIDEO_EXAMPLE 1
 #define CONFIG_EXTRACT_MVS_EXAMPLE 0
 #define CONFIG_FILTER_AUDIO_EXAMPLE 0
 #define CONFIG_FILTERING_AUDIO_EXAMPLE 0
 #define CONFIG_FILTERING_VIDEO_EXAMPLE 0
 #define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+#define CONFIG_HW_DECODE_EXAMPLE 0
 #define CONFIG_METADATA_EXAMPLE 0
 #define CONFIG_MUXING_EXAMPLE 0
 #define CONFIG_QSVDEC_EXAMPLE 0
 #define CONFIG_REMUXING_EXAMPLE 0
 #define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0
 #define CONFIG_SCALING_VIDEO_EXAMPLE 0
 #define CONFIG_TRANSCODE_AAC_EXAMPLE 0
 #define CONFIG_TRANSCODING_EXAMPLE 0
-#define CONFIG_AVISYNTH 0
+#define CONFIG_ALSA 0
+#define CONFIG_APPKIT 0
+#define CONFIG_AVFOUNDATION 0
 #define CONFIG_BZLIB 0
-#define CONFIG_CHROMAPRINT 0
-#define CONFIG_CRYSTALHD 0
+#define CONFIG_COREIMAGE 0
+#define CONFIG_ICONV 0
+#define CONFIG_JACK 0
+#define CONFIG_LIBXCB 0
+#define CONFIG_LIBXCB_SHM 0
+#define CONFIG_LIBXCB_SHAPE 0
+#define CONFIG_LIBXCB_XFIXES 0
+#define CONFIG_LZMA 0
+#define CONFIG_SCHANNEL 0
+#define CONFIG_SDL2 0
+#define CONFIG_SECURETRANSPORT 0
+#define CONFIG_SNDIO 0
+#define CONFIG_XLIB 1
+#define CONFIG_ZLIB 0
+#define CONFIG_AVISYNTH 0
+#define CONFIG_FREI0R 0
+#define CONFIG_LIBCDIO 0
+#define CONFIG_LIBRUBBERBAND 0
+#define CONFIG_LIBVIDSTAB 0
+#define CONFIG_LIBX264 0
+#define CONFIG_LIBX265 0
+#define CONFIG_LIBXAVS 0
+#define CONFIG_LIBXVID 0
 #define CONFIG_DECKLINK 0
-#define CONFIG_FREI0R 0
-#define CONFIG_GCRYPT 0
+#define CONFIG_LIBNDI_NEWTEK 0
+#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_OPENSSL 0
 #define CONFIG_GMP 0
+#define CONFIG_LIBOPENCORE_AMRNB 0
+#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_RKMPP 0
+#define CONFIG_LIBSMBCLIENT 0
+#define CONFIG_CHROMAPRINT 0
+#define CONFIG_GCRYPT 0
 #define CONFIG_GNUTLS 0
-#define CONFIG_ICONV 0
 #define CONFIG_JNI 0
 #define CONFIG_LADSPA 0
 #define CONFIG_LIBASS 0
 #define CONFIG_LIBBLURAY 0
 #define CONFIG_LIBBS2B 0
 #define CONFIG_LIBCACA 0
-#define CONFIG_LIBCDIO 0
 #define CONFIG_LIBCELT 0
 #define CONFIG_LIBDC1394 0
-#define CONFIG_LIBEBUR128 0
-#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_LIBDRM 0
 #define CONFIG_LIBFLITE 0
 #define CONFIG_LIBFONTCONFIG 0
 #define CONFIG_LIBFREETYPE 0
 #define CONFIG_LIBFRIBIDI 0
 #define CONFIG_LIBGME 0
 #define CONFIG_LIBGSM 0
 #define CONFIG_LIBIEC61883 0
 #define CONFIG_LIBILBC 0
 #define CONFIG_LIBKVAZAAR 0
 #define CONFIG_LIBMODPLUG 0
 #define CONFIG_LIBMP3LAME 0
-#define CONFIG_LIBNUT 0
-#define CONFIG_LIBOPENCORE_AMRNB 0
-#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBMYSOFA 0
 #define CONFIG_LIBOPENCV 0
 #define CONFIG_LIBOPENH264 0
 #define CONFIG_LIBOPENJPEG 0
 #define CONFIG_LIBOPENMPT 0
 #define CONFIG_LIBOPUS 0
 #define CONFIG_LIBPULSE 0
+#define CONFIG_LIBRSVG 0
 #define CONFIG_LIBRTMP 0
-#define CONFIG_LIBRUBBERBAND 0
-#define CONFIG_LIBSCHROEDINGER 0
 #define CONFIG_LIBSHINE 0
 #define CONFIG_LIBSMBCLIENT 0
 #define CONFIG_LIBSNAPPY 0
 #define CONFIG_LIBSOXR 0
 #define CONFIG_LIBSPEEX 0
 #define CONFIG_LIBSSH 0
 #define CONFIG_LIBTESSERACT 0
 #define CONFIG_LIBTHEORA 0
 #define CONFIG_LIBTWOLAME 0
 #define CONFIG_LIBV4L2 0
-#define CONFIG_LIBVIDSTAB 0
-#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_LIBVMAF 0
 #define CONFIG_LIBVORBIS 0
 #define CONFIG_LIBVPX 0
 #define CONFIG_LIBWAVPACK 0
 #define CONFIG_LIBWEBP 0
-#define CONFIG_LIBX264 0
-#define CONFIG_LIBX265 0
-#define CONFIG_LIBXAVS 0
-#define CONFIG_LIBXCB 0
-#define CONFIG_LIBXCB_SHM 0
-#define CONFIG_LIBXCB_SHAPE 0
-#define CONFIG_LIBXCB_XFIXES 0
-#define CONFIG_LIBXVID 0
+#define CONFIG_LIBXML2 0
 #define CONFIG_LIBZIMG 0
 #define CONFIG_LIBZMQ 0
 #define CONFIG_LIBZVBI 0
-#define CONFIG_LZMA 0
 #define CONFIG_MEDIACODEC 0
-#define CONFIG_NETCDF 0
 #define CONFIG_OPENAL 0
 #define CONFIG_OPENCL 0
 #define CONFIG_OPENGL 0
-#define CONFIG_OPENSSL 0
-#define CONFIG_SCHANNEL 0
-#define CONFIG_SDL 0
-#define CONFIG_SDL2 0
-#define CONFIG_SECURETRANSPORT 0
-#define CONFIG_X11GRAB 0
-#define CONFIG_XLIB 0
-#define CONFIG_ZLIB 0
 #define CONFIG_AUDIOTOOLBOX 0
-#define CONFIG_CUDA 0
-#define CONFIG_CUVID 0
+#define CONFIG_CRYSTALHD 0
+#define CONFIG_CUDA 1
+#define CONFIG_CUVID 1
 #define CONFIG_D3D11VA 0
 #define CONFIG_DXVA2 0
-#define CONFIG_LIBMFX 0
-#define CONFIG_LIBNPP 0
-#define CONFIG_MMAL 0
-#define CONFIG_NVENC 0
-#define CONFIG_OMX 0
+#define CONFIG_NVENC 1
 #define CONFIG_VAAPI 0
 #define CONFIG_VDA 0
 #define CONFIG_VDPAU 0
+#define CONFIG_VIDEOTOOLBOX 0
+#define CONFIG_V4L2_M2M 1
 #define CONFIG_XVMC 0
+#define CONFIG_CUDA_SDK 0
+#define CONFIG_LIBNPP 0
+#define CONFIG_LIBMFX 0
+#define CONFIG_MMAL 0
+#define CONFIG_OMX 0
 #define CONFIG_FTRAPV 0
 #define CONFIG_GRAY 0
 #define CONFIG_HARDCODED_TABLES 0
 #define CONFIG_OMX_RPI 0
 #define CONFIG_RUNTIME_CPUDETECT 1
 #define CONFIG_SAFE_BITSTREAM_READER 1
 #define CONFIG_SHARED 1
 #define CONFIG_SMALL 0
@@ -540,70 +552,86 @@
 #define CONFIG_FAST_UNALIGNED 0
 #define CONFIG_FFT 0
 #define CONFIG_LSP 0
 #define CONFIG_LZO 0
 #define CONFIG_MDCT 0
 #define CONFIG_PIXELUTILS 0
 #define CONFIG_NETWORK 0
 #define CONFIG_RDFT 0
+#define CONFIG_AUTODETECT 0
 #define CONFIG_FONTCONFIG 0
-#define CONFIG_MEMALIGN_HACK 0
+#define CONFIG_LINUX_PERF 0
 #define CONFIG_MEMORY_POISONING 0
 #define CONFIG_NEON_CLOBBER_TEST 0
-#define CONFIG_PIC 0
-#define CONFIG_POD2MAN 1
-#define CONFIG_RAISE_MAJOR 0
+#define CONFIG_OSSFUZZ 0
+#define CONFIG_PIC 1
 #define CONFIG_THUMB 0
 #define CONFIG_VALGRIND_BACKTRACE 0
 #define CONFIG_XMM_CLOBBER_TEST 0
+#define CONFIG_BSFS 1
+#define CONFIG_DECODERS 1
+#define CONFIG_ENCODERS 0
+#define CONFIG_HWACCELS 0
+#define CONFIG_PARSERS 1
+#define CONFIG_INDEVS 0
+#define CONFIG_OUTDEVS 0
+#define CONFIG_FILTERS 0
+#define CONFIG_DEMUXERS 0
+#define CONFIG_MUXERS 0
+#define CONFIG_PROTOCOLS 0
 #define CONFIG_AANDCTTABLES 0
 #define CONFIG_AC3DSP 0
 #define CONFIG_AUDIO_FRAME_QUEUE 0
 #define CONFIG_AUDIODSP 0
 #define CONFIG_BLOCKDSP 0
 #define CONFIG_BSWAPDSP 0
 #define CONFIG_CABAC 0
 #define CONFIG_DIRAC_PARSE 0
 #define CONFIG_DVPROFILE 0
 #define CONFIG_EXIF 0
 #define CONFIG_FAANDCT 0
 #define CONFIG_FAANIDCT 0
 #define CONFIG_FDCTDSP 0
 #define CONFIG_FLACDSP 1
 #define CONFIG_FMTCONVERT 0
+#define CONFIG_FRAME_THREAD_ENCODER 0
 #define CONFIG_G722DSP 0
-#define CONFIG_GOLOMB 1
+#define CONFIG_GOLOMB 0
 #define CONFIG_GPLV3 0
 #define CONFIG_H263DSP 0
 #define CONFIG_H264CHROMA 0
 #define CONFIG_H264DSP 0
+#define CONFIG_H264PARSE 0
 #define CONFIG_H264PRED 1
 #define CONFIG_H264QPEL 0
+#define CONFIG_HEVCPARSE 0
 #define CONFIG_HPELDSP 0
 #define CONFIG_HUFFMAN 0
 #define CONFIG_HUFFYUVDSP 0
 #define CONFIG_HUFFYUVENCDSP 0
 #define CONFIG_IDCTDSP 0
 #define CONFIG_IIRFILTER 0
-#define CONFIG_IMDCT15 0
+#define CONFIG_MDCT15 0
 #define CONFIG_INTRAX8 0
 #define CONFIG_ISO_MEDIA 0
 #define CONFIG_IVIDSP 0
 #define CONFIG_JPEGTABLES 0
 #define CONFIG_LGPLV3 0
 #define CONFIG_LIBX262 0
 #define CONFIG_LLAUDDSP 0
 #define CONFIG_LLVIDDSP 0
+#define CONFIG_LLVIDENCDSP 0
 #define CONFIG_LPC 0
 #define CONFIG_LZF 0
 #define CONFIG_ME_CMP 0
 #define CONFIG_MPEG_ER 0
 #define CONFIG_MPEGAUDIO 0
 #define CONFIG_MPEGAUDIODSP 0
+#define CONFIG_MPEGAUDIOHEADER 0
 #define CONFIG_MPEGVIDEO 0
 #define CONFIG_MPEGVIDEOENC 0
 #define CONFIG_MSS34DSP 0
 #define CONFIG_PIXBLOCKDSP 0
 #define CONFIG_QPELDSP 0
 #define CONFIG_QSV 0
 #define CONFIG_QSVDEC 0
 #define CONFIG_QSVENC 0
@@ -615,23 +643,23 @@
 #define CONFIG_RV34DSP 0
 #define CONFIG_SINEWIN 0
 #define CONFIG_SNAPPY 0
 #define CONFIG_SRTP 0
 #define CONFIG_STARTCODE 0
 #define CONFIG_TEXTUREDSP 0
 #define CONFIG_TEXTUREDSPENC 0
 #define CONFIG_TPELDSP 0
+#define CONFIG_VAAPI_1 0
 #define CONFIG_VAAPI_ENCODE 0
 #define CONFIG_VC1DSP 0
 #define CONFIG_VIDEODSP 1
 #define CONFIG_VP3DSP 0
 #define CONFIG_VP56DSP 0
 #define CONFIG_VP8DSP 1
-#define CONFIG_VT_BT2020 0
 #define CONFIG_WMA_FREQS 0
 #define CONFIG_WMV2DSP 0
 #define CONFIG_NULL_BSF 1
 #define CONFIG_VP8_DECODER 1
 #define CONFIG_VP9_DECODER 1
 #define CONFIG_FLAC_DECODER 1
 #define CONFIG_FLAC_PARSER 0
 #define CONFIG_VP8_PARSER 1
--- a/media/ffvpx/config_unix64.asm
+++ b/media/ffvpx/config_unix64.asm
@@ -58,18 +58,18 @@
 %define HAVE_MIPS32R2 0
 %define HAVE_MIPS32R5 0
 %define HAVE_MIPS64R2 0
 %define HAVE_MIPS32R6 0
 %define HAVE_MIPS64R6 0
 %define HAVE_MIPSDSP 0
 %define HAVE_MIPSDSPR2 0
 %define HAVE_MSA 0
-%define HAVE_LOONGSON2 1
-%define HAVE_LOONGSON3 1
+%define HAVE_LOONGSON2 0
+%define HAVE_LOONGSON3 0
 %define HAVE_MMI 0
 %define HAVE_ARMV5TE_EXTERNAL 0
 %define HAVE_ARMV6_EXTERNAL 0
 %define HAVE_ARMV6T2_EXTERNAL 0
 %define HAVE_ARMV8_EXTERNAL 0
 %define HAVE_NEON_EXTERNAL 0
 %define HAVE_VFP_EXTERNAL 0
 %define HAVE_VFPV3_EXTERNAL 0
@@ -157,65 +157,67 @@
 %define HAVE_ALIGNED_STACK 1
 %define HAVE_FAST_64BIT 1
 %define HAVE_FAST_CLZ 1
 %define HAVE_FAST_CMOV 1
 %define HAVE_LOCAL_ALIGNED_8 1
 %define HAVE_LOCAL_ALIGNED_16 1
 %define HAVE_LOCAL_ALIGNED_32 1
 %define HAVE_SIMD_ALIGN_16 1
+%define HAVE_SIMD_ALIGN_32 1
 %define HAVE_ATOMICS_GCC 1
 %define HAVE_ATOMICS_SUNCC 0
 %define HAVE_ATOMICS_WIN32 0
 %define HAVE_ATOMIC_CAS_PTR 0
-%define HAVE_ATOMIC_COMPARE_EXCHANGE 0
 %define HAVE_MACHINE_RW_BARRIER 0
 %define HAVE_MEMORYBARRIER 0
 %define HAVE_MM_EMPTY 1
 %define HAVE_RDTSC 0
 %define HAVE_SARESTART 1
 %define HAVE_SEM_TIMEDWAIT 1
 %define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1
 %define HAVE_CABS 1
 %define HAVE_CEXP 1
 %define HAVE_INLINE_ASM 1
 %define HAVE_SYMVER 1
-%define HAVE_YASM 1
+%define HAVE_X86ASM 1
 %define HAVE_BIGENDIAN 0
 %define HAVE_FAST_UNALIGNED 1
-%define HAVE_ALSA_ASOUNDLIB_H 0
 %define HAVE_ALTIVEC_H 0
 %define HAVE_ARPA_INET_H 1
 %define HAVE_ASM_TYPES_H 1
 %define HAVE_CDIO_PARANOIA_H 0
 %define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+%define HAVE_CUDA_H 0
+%define HAVE_D3D11_H 0
 %define HAVE_DISPATCH_DISPATCH_H 0
 %define HAVE_DEV_BKTR_IOCTL_BT848_H 0
 %define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
 %define HAVE_DEV_IC_BT8XX_H 0
 %define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0
 %define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0
 %define HAVE_DIRECT_H 0
 %define HAVE_DIRENT_H 1
 %define HAVE_DLFCN_H 1
-%define HAVE_D3D11_H 0
+%define HAVE_DXGIDEBUG_H 0
 %define HAVE_DXVA_H 0
 %define HAVE_ES2_GL_H 0
 %define HAVE_GSM_H 0
 %define HAVE_IO_H 0
 %define HAVE_MACH_MACH_TIME_H 0
 %define HAVE_MACHINE_IOCTL_BT848_H 0
 %define HAVE_MACHINE_IOCTL_METEOR_H 0
 %define HAVE_OPENCV2_CORE_CORE_C_H 0
+%define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+%define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
 %define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
 %define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
 %define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
 %define HAVE_OPENGL_GL3_H 0
 %define HAVE_POLL_H 1
-%define HAVE_SNDIO_H 0
 %define HAVE_SOUNDCARD_H 0
 %define HAVE_STDATOMIC_H 1
 %define HAVE_SYS_MMAN_H 1
 %define HAVE_SYS_PARAM_H 1
 %define HAVE_SYS_RESOURCE_H 1
 %define HAVE_SYS_SELECT_H 1
 %define HAVE_SYS_SOUNDCARD_H 1
 %define HAVE_SYS_TIME_H 1
@@ -259,17 +261,16 @@
 %define HAVE_TRUNCF 1
 %define HAVE_ACCESS 1
 %define HAVE_ALIGNED_MALLOC 0
 %define HAVE_CLOCK_GETTIME 1
 %define HAVE_CLOSESOCKET 0
 %define HAVE_COMMANDLINETOARGVW 0
 %define HAVE_COTASKMEMFREE 0
 %define HAVE_CRYPTGENRANDOM 0
-%define HAVE_DLOPEN 1
 %define HAVE_FCNTL 1
 %define HAVE_FLT_LIM 1
 %define HAVE_FORK 1
 %define HAVE_GETADDRINFO 1
 %define HAVE_GETHRTIME 0
 %define HAVE_GETOPT 1
 %define HAVE_GETPROCESSAFFINITYMASK 0
 %define HAVE_GETPROCESSMEMORYINFO 0
@@ -307,197 +308,206 @@
 %define HAVE_USLEEP 1
 %define HAVE_UTGETOSTYPEFROMSTRING 0
 %define HAVE_VIRTUALALLOC 0
 %define HAVE_WGLGETPROCADDRESS 0
 %define HAVE_PTHREADS 1
 %define HAVE_OS2THREADS 0
 %define HAVE_W32THREADS 0
 %define HAVE_AS_DN_DIRECTIVE 0
+%define HAVE_AS_FPU_DIRECTIVE 0
 %define HAVE_AS_FUNC 0
 %define HAVE_AS_OBJECT_ARCH 0
 %define HAVE_ASM_MOD_Q 0
 %define HAVE_ATTRIBUTE_MAY_ALIAS 1
 %define HAVE_ATTRIBUTE_PACKED 1
+%define HAVE_BLOCKS_EXTENSION 0
 %define HAVE_EBP_AVAILABLE 1
 %define HAVE_EBX_AVAILABLE 1
 %define HAVE_GNU_AS 0
 %define HAVE_GNU_WINDRES 0
 %define HAVE_IBM_ASM 0
 %define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1
 %define HAVE_INLINE_ASM_LABELS 1
 %define HAVE_INLINE_ASM_NONLOCAL_LABELS 1
 %define HAVE_PRAGMA_DEPRECATED 1
 %define HAVE_RSYNC_CONTIMEOUT 1
 %define HAVE_SYMVER_ASM_LABEL 0
 %define HAVE_SYMVER_GNU_ASM 1
 %define HAVE_VFP_ARGS 0
 %define HAVE_XFORM_ASM 0
 %define HAVE_XMM_CLOBBERS 1
 %define HAVE_CONDITION_VARIABLE_PTR 0
+%define HAVE_KCMVIDEOCODECTYPE_HEVC 0
 %define HAVE_SOCKLEN_T 1
 %define HAVE_STRUCT_ADDRINFO 1
 %define HAVE_STRUCT_GROUP_SOURCE_REQ 1
 %define HAVE_STRUCT_IP_MREQ_SOURCE 1
 %define HAVE_STRUCT_IPV6_MREQ 1
 %define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1
 %define HAVE_STRUCT_POLLFD 1
 %define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1
 %define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
 %define HAVE_STRUCT_SOCKADDR_IN6 1
 %define HAVE_STRUCT_SOCKADDR_SA_LEN 0
 %define HAVE_STRUCT_SOCKADDR_STORAGE 1
 %define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
 %define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 1
 %define HAVE_ATOMICS_NATIVE 1
 %define HAVE_DOS_PATHS 0
-%define HAVE_DXVA2_LIB 0
-%define HAVE_DXVA2API_COBJ 0
 %define HAVE_LIBC_MSVCRT 0
-%define HAVE_LIBDC1394_1 0
-%define HAVE_LIBDC1394_2 0
 %define HAVE_MAKEINFO 0
 %define HAVE_MAKEINFO_HTML 0
 %define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
 %define HAVE_PERL 1
 %define HAVE_POD2MAN 1
-%define HAVE_SDL2 0
 %define HAVE_SECTION_DATA_REL_RO 1
 %define HAVE_TEXI2HTML 0
 %define HAVE_THREADS 1
+%define HAVE_UWP 0
 %define HAVE_VAAPI_DRM 0
 %define HAVE_VAAPI_X11 0
 %define HAVE_VDPAU_X11 0
 %define HAVE_WINRT 0
-%define HAVE_XLIB 0
-%define CONFIG_BSFS 0
-%define CONFIG_DECODERS 1
-%define CONFIG_PARSERS 1
 %define CONFIG_DOC 0
 %define CONFIG_HTMLPAGES 0
 %define CONFIG_MANPAGES 1
 %define CONFIG_PODPAGES 1
 %define CONFIG_TXTPAGES 0
 %define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
 %define CONFIG_AVIO_READING_EXAMPLE 1
-%define CONFIG_DECODING_ENCODING_EXAMPLE 0
+%define CONFIG_DECODE_AUDIO_EXAMPLE 1
+%define CONFIG_DECODE_VIDEO_EXAMPLE 1
 %define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+%define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+%define CONFIG_ENCODE_VIDEO_EXAMPLE 1
 %define CONFIG_EXTRACT_MVS_EXAMPLE 0
 %define CONFIG_FILTER_AUDIO_EXAMPLE 0
 %define CONFIG_FILTERING_AUDIO_EXAMPLE 0
 %define CONFIG_FILTERING_VIDEO_EXAMPLE 0
 %define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+%define CONFIG_HW_DECODE_EXAMPLE 0
 %define CONFIG_METADATA_EXAMPLE 0
 %define CONFIG_MUXING_EXAMPLE 0
 %define CONFIG_QSVDEC_EXAMPLE 0
 %define CONFIG_REMUXING_EXAMPLE 0
 %define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0
 %define CONFIG_SCALING_VIDEO_EXAMPLE 0
 %define CONFIG_TRANSCODE_AAC_EXAMPLE 0
 %define CONFIG_TRANSCODING_EXAMPLE 0
-%define CONFIG_AVISYNTH 0
+%define CONFIG_ALSA 1
+%define CONFIG_APPKIT 0
+%define CONFIG_AVFOUNDATION 0
 %define CONFIG_BZLIB 0
-%define CONFIG_CHROMAPRINT 0
-%define CONFIG_CRYSTALHD 0
+%define CONFIG_COREIMAGE 0
+%define CONFIG_ICONV 0
+%define CONFIG_JACK 0
+%define CONFIG_LIBXCB 0
+%define CONFIG_LIBXCB_SHM 0
+%define CONFIG_LIBXCB_SHAPE 0
+%define CONFIG_LIBXCB_XFIXES 0
+%define CONFIG_LZMA 1
+%define CONFIG_SCHANNEL 0
+%define CONFIG_SDL2 0
+%define CONFIG_SECURETRANSPORT 0
+%define CONFIG_SNDIO 0
+%define CONFIG_XLIB 1
+%define CONFIG_ZLIB 1
+%define CONFIG_AVISYNTH 0
+%define CONFIG_FREI0R 0
+%define CONFIG_LIBCDIO 0
+%define CONFIG_LIBRUBBERBAND 0
+%define CONFIG_LIBVIDSTAB 0
+%define CONFIG_LIBX264 0
+%define CONFIG_LIBX265 0
+%define CONFIG_LIBXAVS 0
+%define CONFIG_LIBXVID 0
 %define CONFIG_DECKLINK 0
-%define CONFIG_FREI0R 0
-%define CONFIG_GCRYPT 0
+%define CONFIG_LIBNDI_NEWTEK 0
+%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_OPENSSL 0
 %define CONFIG_GMP 0
+%define CONFIG_LIBOPENCORE_AMRNB 0
+%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_RKMPP 0
+%define CONFIG_LIBSMBCLIENT 0
+%define CONFIG_CHROMAPRINT 0
+%define CONFIG_GCRYPT 0
 %define CONFIG_GNUTLS 0
-%define CONFIG_ICONV 0
 %define CONFIG_JNI 0
 %define CONFIG_LADSPA 0
 %define CONFIG_LIBASS 0
 %define CONFIG_LIBBLURAY 0
 %define CONFIG_LIBBS2B 0
 %define CONFIG_LIBCACA 0
-%define CONFIG_LIBCDIO 0
 %define CONFIG_LIBCELT 0
 %define CONFIG_LIBDC1394 0
-%define CONFIG_LIBEBUR128 0
-%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_LIBDRM 0
 %define CONFIG_LIBFLITE 0
 %define CONFIG_LIBFONTCONFIG 0
 %define CONFIG_LIBFREETYPE 0
 %define CONFIG_LIBFRIBIDI 0
 %define CONFIG_LIBGME 0
 %define CONFIG_LIBGSM 0
 %define CONFIG_LIBIEC61883 0
 %define CONFIG_LIBILBC 0
 %define CONFIG_LIBKVAZAAR 0
 %define CONFIG_LIBMODPLUG 0
 %define CONFIG_LIBMP3LAME 0
-%define CONFIG_LIBNUT 0
-%define CONFIG_LIBOPENCORE_AMRNB 0
-%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBMYSOFA 0
 %define CONFIG_LIBOPENCV 0
 %define CONFIG_LIBOPENH264 0
 %define CONFIG_LIBOPENJPEG 0
 %define CONFIG_LIBOPENMPT 0
 %define CONFIG_LIBOPUS 0
 %define CONFIG_LIBPULSE 0
+%define CONFIG_LIBRSVG 0
 %define CONFIG_LIBRTMP 0
-%define CONFIG_LIBRUBBERBAND 0
-%define CONFIG_LIBSCHROEDINGER 0
 %define CONFIG_LIBSHINE 0
 %define CONFIG_LIBSMBCLIENT 0
 %define CONFIG_LIBSNAPPY 0
 %define CONFIG_LIBSOXR 0
 %define CONFIG_LIBSPEEX 0
 %define CONFIG_LIBSSH 0
 %define CONFIG_LIBTESSERACT 0
 %define CONFIG_LIBTHEORA 0
 %define CONFIG_LIBTWOLAME 0
 %define CONFIG_LIBV4L2 0
-%define CONFIG_LIBVIDSTAB 0
-%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_LIBVMAF 0
 %define CONFIG_LIBVORBIS 0
 %define CONFIG_LIBVPX 0
 %define CONFIG_LIBWAVPACK 0
 %define CONFIG_LIBWEBP 0
-%define CONFIG_LIBX264 0
-%define CONFIG_LIBX265 0
-%define CONFIG_LIBXAVS 0
-%define CONFIG_LIBXCB 0
-%define CONFIG_LIBXCB_SHM 0
-%define CONFIG_LIBXCB_SHAPE 0
-%define CONFIG_LIBXCB_XFIXES 0
-%define CONFIG_LIBXVID 0
+%define CONFIG_LIBXML2 0
 %define CONFIG_LIBZIMG 0
 %define CONFIG_LIBZMQ 0
 %define CONFIG_LIBZVBI 0
-%define CONFIG_LZMA 0
 %define CONFIG_MEDIACODEC 0
-%define CONFIG_NETCDF 0
 %define CONFIG_OPENAL 0
 %define CONFIG_OPENCL 0
 %define CONFIG_OPENGL 0
-%define CONFIG_OPENSSL 0
-%define CONFIG_SCHANNEL 0
-%define CONFIG_SDL 0
-%define CONFIG_SDL2 0
-%define CONFIG_SECURETRANSPORT 0
-%define CONFIG_VIDEOTOOLBOX 0
-%define CONFIG_X11GRAB 0
-%define CONFIG_XLIB 0
-%define CONFIG_ZLIB 0
 %define CONFIG_AUDIOTOOLBOX 0
-%define CONFIG_CUDA 0
-%define CONFIG_CUVID 0
+%define CONFIG_CRYSTALHD 0
+%define CONFIG_CUDA 1
+%define CONFIG_CUVID 1
 %define CONFIG_D3D11VA 0
 %define CONFIG_DXVA2 0
-%define CONFIG_LIBMFX 0
-%define CONFIG_LIBNPP 0
-%define CONFIG_MMAL 0
-%define CONFIG_NVENC 0
-%define CONFIG_OMX 0
+%define CONFIG_NVENC 1
 %define CONFIG_VAAPI 0
 %define CONFIG_VDA 0
 %define CONFIG_VDPAU 0
+%define CONFIG_VIDEOTOOLBOX 0
+%define CONFIG_V4L2_M2M 1
 %define CONFIG_XVMC 0
+%define CONFIG_CUDA_SDK 0
+%define CONFIG_LIBNPP 0
+%define CONFIG_LIBMFX 0
+%define CONFIG_MMAL 0
+%define CONFIG_OMX 0
 %define CONFIG_FTRAPV 0
 %define CONFIG_GRAY 0
 %define CONFIG_HARDCODED_TABLES 0
 %define CONFIG_OMX_RPI 0
 %define CONFIG_RUNTIME_CPUDETECT 1
 %define CONFIG_SAFE_BITSTREAM_READER 1
 %define CONFIG_SHARED 1
 %define CONFIG_SMALL 0
@@ -526,70 +536,86 @@
 %define CONFIG_FAST_UNALIGNED 1
 %define CONFIG_FFT 0
 %define CONFIG_LSP 0
 %define CONFIG_LZO 0
 %define CONFIG_MDCT 0
 %define CONFIG_PIXELUTILS 0
 %define CONFIG_NETWORK 0
 %define CONFIG_RDFT 0
+%define CONFIG_AUTODETECT 0
 %define CONFIG_FONTCONFIG 0
-%define CONFIG_MEMALIGN_HACK 0
+%define CONFIG_LINUX_PERF 0
 %define CONFIG_MEMORY_POISONING 0
 %define CONFIG_NEON_CLOBBER_TEST 0
+%define CONFIG_OSSFUZZ 0
 %define CONFIG_PIC 1
-%define CONFIG_POD2MAN 1
-%define CONFIG_RAISE_MAJOR 0
 %define CONFIG_THUMB 0
 %define CONFIG_VALGRIND_BACKTRACE 0
 %define CONFIG_XMM_CLOBBER_TEST 0
+%define CONFIG_BSFS 1
+%define CONFIG_DECODERS 1
+%define CONFIG_ENCODERS 0
+%define CONFIG_HWACCELS 0
+%define CONFIG_PARSERS 1
+%define CONFIG_INDEVS 0
+%define CONFIG_OUTDEVS 0
+%define CONFIG_FILTERS 0
+%define CONFIG_DEMUXERS 0
+%define CONFIG_MUXERS 0
+%define CONFIG_PROTOCOLS 0
 %define CONFIG_AANDCTTABLES 0
 %define CONFIG_AC3DSP 0
 %define CONFIG_AUDIO_FRAME_QUEUE 0
 %define CONFIG_AUDIODSP 0
 %define CONFIG_BLOCKDSP 0
 %define CONFIG_BSWAPDSP 0
 %define CONFIG_CABAC 0
 %define CONFIG_DIRAC_PARSE 0
 %define CONFIG_DVPROFILE 0
 %define CONFIG_EXIF 0
 %define CONFIG_FAANDCT 0
 %define CONFIG_FAANIDCT 0
 %define CONFIG_FDCTDSP 0
 %define CONFIG_FLACDSP 1
 %define CONFIG_FMTCONVERT 0
+%define CONFIG_FRAME_THREAD_ENCODER 0
 %define CONFIG_G722DSP 0
-%define CONFIG_GOLOMB 1
+%define CONFIG_GOLOMB 0
 %define CONFIG_GPLV3 0
 %define CONFIG_H263DSP 0
 %define CONFIG_H264CHROMA 0
 %define CONFIG_H264DSP 0
+%define CONFIG_H264PARSE 0
 %define CONFIG_H264PRED 1
 %define CONFIG_H264QPEL 0
+%define CONFIG_HEVCPARSE 0
 %define CONFIG_HPELDSP 0
 %define CONFIG_HUFFMAN 0
 %define CONFIG_HUFFYUVDSP 0
 %define CONFIG_HUFFYUVENCDSP 0
 %define CONFIG_IDCTDSP 0
 %define CONFIG_IIRFILTER 0
-%define CONFIG_IMDCT15 0
+%define CONFIG_MDCT15 0
 %define CONFIG_INTRAX8 0
 %define CONFIG_ISO_MEDIA 0
 %define CONFIG_IVIDSP 0
 %define CONFIG_JPEGTABLES 0
 %define CONFIG_LGPLV3 0
 %define CONFIG_LIBX262 0
 %define CONFIG_LLAUDDSP 0
 %define CONFIG_LLVIDDSP 0
+%define CONFIG_LLVIDENCDSP 0
 %define CONFIG_LPC 0
 %define CONFIG_LZF 0
 %define CONFIG_ME_CMP 0
 %define CONFIG_MPEG_ER 0
 %define CONFIG_MPEGAUDIO 0
 %define CONFIG_MPEGAUDIODSP 0
+%define CONFIG_MPEGAUDIOHEADER 0
 %define CONFIG_MPEGVIDEO 0
 %define CONFIG_MPEGVIDEOENC 0
 %define CONFIG_MSS34DSP 0
 %define CONFIG_PIXBLOCKDSP 0
 %define CONFIG_QPELDSP 0
 %define CONFIG_QSV 0
 %define CONFIG_QSVDEC 0
 %define CONFIG_QSVENC 0
@@ -601,23 +627,23 @@
 %define CONFIG_RV34DSP 0
 %define CONFIG_SINEWIN 0
 %define CONFIG_SNAPPY 0
 %define CONFIG_SRTP 0
 %define CONFIG_STARTCODE 0
 %define CONFIG_TEXTUREDSP 0
 %define CONFIG_TEXTUREDSPENC 0
 %define CONFIG_TPELDSP 0
+%define CONFIG_VAAPI_1 0
 %define CONFIG_VAAPI_ENCODE 0
 %define CONFIG_VC1DSP 0
 %define CONFIG_VIDEODSP 1
 %define CONFIG_VP3DSP 0
 %define CONFIG_VP56DSP 0
 %define CONFIG_VP8DSP 1
-%define CONFIG_VT_BT2020 0
 %define CONFIG_WMA_FREQS 0
 %define CONFIG_WMV2DSP 0
 %define CONFIG_NULL_BSF 1
 %define CONFIG_VP8_DECODER 1
 %define CONFIG_VP9_DECODER 1
 %define CONFIG_FLAC_DECODER 1
 %define CONFIG_FLAC_PARSER 0
 %define CONFIG_VP8_PARSER 1
--- a/media/ffvpx/config_unix64.h
+++ b/media/ffvpx/config_unix64.h
@@ -1,17 +1,17 @@
 /* Automatically generated by configure - do not modify! */
 #ifndef FFMPEG_CONFIG_H
 #define FFMPEG_CONFIG_H
-#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-asm --enable-yasm --disable-avx2"
+#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-decoder=flac --enable-asm --enable-x86asm"
 #define FFMPEG_LICENSE "LGPL version 2.1 or later"
-#define CONFIG_THIS_YEAR 2016
+#define CONFIG_THIS_YEAR 2017
 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg"
 #define AVCONV_DATADIR "/usr/local/share/ffmpeg"
-#define CC_IDENT "gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)"
+#define CC_IDENT "gcc 6.3.0 (Ubuntu 6.3.0-12ubuntu2) 20170406"
 #define av_restrict restrict
 #define EXTERN_PREFIX ""
 #define EXTERN_ASM
 #define BUILDSUF ""
 #define SLIBSUF ".so"
 #define HAVE_MMX2 HAVE_MMXEXT
 #define SWS_MAX_FILTER_SIZE 256
 #define ARCH_AARCH64 0
@@ -74,18 +74,18 @@
 #define HAVE_MIPS32R2 0
 #define HAVE_MIPS32R5 0
 #define HAVE_MIPS64R2 0
 #define HAVE_MIPS32R6 0
 #define HAVE_MIPS64R6 0
 #define HAVE_MIPSDSP 0
 #define HAVE_MIPSDSPR2 0
 #define HAVE_MSA 0
-#define HAVE_LOONGSON2 1
-#define HAVE_LOONGSON3 1
+#define HAVE_LOONGSON2 0
+#define HAVE_LOONGSON3 0
 #define HAVE_MMI 0
 #define HAVE_ARMV5TE_EXTERNAL 0
 #define HAVE_ARMV6_EXTERNAL 0
 #define HAVE_ARMV6T2_EXTERNAL 0
 #define HAVE_ARMV8_EXTERNAL 0
 #define HAVE_NEON_EXTERNAL 0
 #define HAVE_VFP_EXTERNAL 0
 #define HAVE_VFPV3_EXTERNAL 0
@@ -178,61 +178,62 @@
 #define HAVE_LOCAL_ALIGNED_16 1
 #define HAVE_LOCAL_ALIGNED_32 1
 #define HAVE_SIMD_ALIGN_16 1
 #define HAVE_SIMD_ALIGN_32 1
 #define HAVE_ATOMICS_GCC 1
 #define HAVE_ATOMICS_SUNCC 0
 #define HAVE_ATOMICS_WIN32 0
 #define HAVE_ATOMIC_CAS_PTR 0
-#define HAVE_ATOMIC_COMPARE_EXCHANGE 0
 #define HAVE_MACHINE_RW_BARRIER 0
 #define HAVE_MEMORYBARRIER 0
 #define HAVE_MM_EMPTY 1
 #define HAVE_RDTSC 0
 #define HAVE_SARESTART 1
 #define HAVE_SEM_TIMEDWAIT 1
 #define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1
 #define HAVE_CABS 1
 #define HAVE_CEXP 1
 #define HAVE_INLINE_ASM 1
 #define HAVE_SYMVER 1
 #define HAVE_X86ASM 1
 #define HAVE_BIGENDIAN 0
 #define HAVE_FAST_UNALIGNED 1
-#define HAVE_ALSA_ASOUNDLIB_H 0
 #define HAVE_ALTIVEC_H 0
 #define HAVE_ARPA_INET_H 1
 #define HAVE_ASM_TYPES_H 1
 #define HAVE_CDIO_PARANOIA_H 0
 #define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+#define HAVE_CUDA_H 0
+#define HAVE_D3D11_H 0
 #define HAVE_DISPATCH_DISPATCH_H 0
 #define HAVE_DEV_BKTR_IOCTL_BT848_H 0
 #define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
 #define HAVE_DEV_IC_BT8XX_H 0
 #define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0
 #define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0
 #define HAVE_DIRECT_H 0
 #define HAVE_DIRENT_H 1
 #define HAVE_DLFCN_H 1
-#define HAVE_D3D11_H 0
+#define HAVE_DXGIDEBUG_H 0
 #define HAVE_DXVA_H 0
 #define HAVE_ES2_GL_H 0
 #define HAVE_GSM_H 0
 #define HAVE_IO_H 0
 #define HAVE_MACH_MACH_TIME_H 0
 #define HAVE_MACHINE_IOCTL_BT848_H 0
 #define HAVE_MACHINE_IOCTL_METEOR_H 0
 #define HAVE_OPENCV2_CORE_CORE_C_H 0
+#define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+#define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
 #define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
 #define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
 #define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
 #define HAVE_OPENGL_GL3_H 0
 #define HAVE_POLL_H 1
-#define HAVE_SNDIO_H 0
 #define HAVE_SOUNDCARD_H 0
 #define HAVE_STDATOMIC_H 1
 #define HAVE_SYS_MMAN_H 1
 #define HAVE_SYS_PARAM_H 1
 #define HAVE_SYS_RESOURCE_H 1
 #define HAVE_SYS_SELECT_H 1
 #define HAVE_SYS_SOUNDCARD_H 1
 #define HAVE_SYS_TIME_H 1
@@ -276,17 +277,16 @@
 #define HAVE_TRUNCF 1
 #define HAVE_ACCESS 1
 #define HAVE_ALIGNED_MALLOC 0
 #define HAVE_CLOCK_GETTIME 1
 #define HAVE_CLOSESOCKET 0
 #define HAVE_COMMANDLINETOARGVW 0
 #define HAVE_COTASKMEMFREE 0
 #define HAVE_CRYPTGENRANDOM 0
-#define HAVE_DLOPEN 1
 #define HAVE_FCNTL 1
 #define HAVE_FLT_LIM 1
 #define HAVE_FORK 1
 #define HAVE_GETADDRINFO 1
 #define HAVE_GETHRTIME 0
 #define HAVE_GETOPT 1
 #define HAVE_GETPROCESSAFFINITYMASK 0
 #define HAVE_GETPROCESSMEMORYINFO 0
@@ -315,205 +315,215 @@
 #define HAVE_SCHED_GETAFFINITY 1
 #define HAVE_SETCONSOLETEXTATTRIBUTE 0
 #define HAVE_SETCONSOLECTRLHANDLER 0
 #define HAVE_SETMODE 0
 #define HAVE_SETRLIMIT 1
 #define HAVE_SLEEP 0
 #define HAVE_STRERROR_R 1
 #define HAVE_SYSCONF 1
+#define HAVE_SYSCTL 0
 #define HAVE_USLEEP 1
 #define HAVE_UTGETOSTYPEFROMSTRING 0
 #define HAVE_VIRTUALALLOC 0
 #define HAVE_WGLGETPROCADDRESS 0
 #define HAVE_PTHREADS 1
 #define HAVE_OS2THREADS 0
 #define HAVE_W32THREADS 0
 #define HAVE_AS_DN_DIRECTIVE 0
+#define HAVE_AS_FPU_DIRECTIVE 0
 #define HAVE_AS_FUNC 0
 #define HAVE_AS_OBJECT_ARCH 0
 #define HAVE_ASM_MOD_Q 0
 #define HAVE_ATTRIBUTE_MAY_ALIAS 1
 #define HAVE_ATTRIBUTE_PACKED 1
+#define HAVE_BLOCKS_EXTENSION 0
 #define HAVE_EBP_AVAILABLE 1
 #define HAVE_EBX_AVAILABLE 1
 #define HAVE_GNU_AS 0
 #define HAVE_GNU_WINDRES 0
 #define HAVE_IBM_ASM 0
 #define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1
 #define HAVE_INLINE_ASM_LABELS 1
 #define HAVE_INLINE_ASM_NONLOCAL_LABELS 1
 #define HAVE_PRAGMA_DEPRECATED 1
 #define HAVE_RSYNC_CONTIMEOUT 1
 #define HAVE_SYMVER_ASM_LABEL 0
 #define HAVE_SYMVER_GNU_ASM 1
 #define HAVE_VFP_ARGS 0
 #define HAVE_XFORM_ASM 0
 #define HAVE_XMM_CLOBBERS 1
 #define HAVE_CONDITION_VARIABLE_PTR 0
+#define HAVE_KCMVIDEOCODECTYPE_HEVC 0
 #define HAVE_SOCKLEN_T 1
 #define HAVE_STRUCT_ADDRINFO 1
 #define HAVE_STRUCT_GROUP_SOURCE_REQ 1
 #define HAVE_STRUCT_IP_MREQ_SOURCE 1
 #define HAVE_STRUCT_IPV6_MREQ 1
 #define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1
 #define HAVE_STRUCT_POLLFD 1
 #define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1
 #define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
 #define HAVE_STRUCT_SOCKADDR_IN6 1
 #define HAVE_STRUCT_SOCKADDR_SA_LEN 0
 #define HAVE_STRUCT_SOCKADDR_STORAGE 1
 #define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
 #define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 1
 #define HAVE_ATOMICS_NATIVE 1
 #define HAVE_DOS_PATHS 0
-#define HAVE_DXVA2_LIB 0
-#define HAVE_DXVA2API_COBJ 0
 #define HAVE_LIBC_MSVCRT 0
-#define HAVE_LIBDC1394_1 0
-#define HAVE_LIBDC1394_2 0
 #define HAVE_MAKEINFO 0
 #define HAVE_MAKEINFO_HTML 0
 #define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
 #define HAVE_PERL 1
 #define HAVE_POD2MAN 1
-#define HAVE_SDL2 0
 #define HAVE_SECTION_DATA_REL_RO 1
 #define HAVE_TEXI2HTML 0
 #define HAVE_THREADS 1
+#define HAVE_UWP 0
 #define HAVE_VAAPI_DRM 0
 #define HAVE_VAAPI_X11 0
 #define HAVE_VDPAU_X11 0
 #define HAVE_WINRT 0
-#define HAVE_XLIB 0
-#define CONFIG_BSFS 0
-#define CONFIG_DECODERS 1
-#define CONFIG_PARSERS 1
 #define CONFIG_DOC 0
 #define CONFIG_HTMLPAGES 0
 #define CONFIG_MANPAGES 1
 #define CONFIG_PODPAGES 1
 #define CONFIG_TXTPAGES 0
 #define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
 #define CONFIG_AVIO_READING_EXAMPLE 1
-#define CONFIG_DECODING_ENCODING_EXAMPLE 0
+#define CONFIG_DECODE_AUDIO_EXAMPLE 1
+#define CONFIG_DECODE_VIDEO_EXAMPLE 1
 #define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+#define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+#define CONFIG_ENCODE_VIDEO_EXAMPLE 1
 #define CONFIG_EXTRACT_MVS_EXAMPLE 0
 #define CONFIG_FILTER_AUDIO_EXAMPLE 0
 #define CONFIG_FILTERING_AUDIO_EXAMPLE 0
 #define CONFIG_FILTERING_VIDEO_EXAMPLE 0
 #define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+#define CONFIG_HW_DECODE_EXAMPLE 0
 #define CONFIG_METADATA_EXAMPLE 0
 #define CONFIG_MUXING_EXAMPLE 0
 #define CONFIG_QSVDEC_EXAMPLE 0
 #define CONFIG_REMUXING_EXAMPLE 0
 #define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0
 #define CONFIG_SCALING_VIDEO_EXAMPLE 0
 #define CONFIG_TRANSCODE_AAC_EXAMPLE 0
 #define CONFIG_TRANSCODING_EXAMPLE 0
-#define CONFIG_AVISYNTH 0
+#define CONFIG_ALSA 1
+#define CONFIG_APPKIT 0
+#define CONFIG_AVFOUNDATION 0
 #define CONFIG_BZLIB 0
-#define CONFIG_CHROMAPRINT 0
-#define CONFIG_CRYSTALHD 0
+#define CONFIG_COREIMAGE 0
+#define CONFIG_ICONV 0
+#define CONFIG_JACK 0
+#define CONFIG_LIBXCB 0
+#define CONFIG_LIBXCB_SHM 0
+#define CONFIG_LIBXCB_SHAPE 0
+#define CONFIG_LIBXCB_XFIXES 0
+#define CONFIG_LZMA 1
+#define CONFIG_SCHANNEL 0
+#define CONFIG_SDL2 0
+#define CONFIG_SECURETRANSPORT 0
+#define CONFIG_SNDIO 0
+#define CONFIG_XLIB 1
+#define CONFIG_ZLIB 1
+#define CONFIG_AVISYNTH 0
+#define CONFIG_FREI0R 0
+#define CONFIG_LIBCDIO 0
+#define CONFIG_LIBRUBBERBAND 0
+#define CONFIG_LIBVIDSTAB 0
+#define CONFIG_LIBX264 0
+#define CONFIG_LIBX265 0
+#define CONFIG_LIBXAVS 0
+#define CONFIG_LIBXVID 0
 #define CONFIG_DECKLINK 0
-#define CONFIG_FREI0R 0
-#define CONFIG_GCRYPT 0
+#define CONFIG_LIBNDI_NEWTEK 0
+#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_OPENSSL 0
 #define CONFIG_GMP 0
+#define CONFIG_LIBOPENCORE_AMRNB 0
+#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_RKMPP 0
+#define CONFIG_LIBSMBCLIENT 0
+#define CONFIG_CHROMAPRINT 0
+#define CONFIG_GCRYPT 0
 #define CONFIG_GNUTLS 0
-#define CONFIG_ICONV 0
 #define CONFIG_JNI 0
 #define CONFIG_LADSPA 0
 #define CONFIG_LIBASS 0
 #define CONFIG_LIBBLURAY 0
 #define CONFIG_LIBBS2B 0
 #define CONFIG_LIBCACA 0
-#define CONFIG_LIBCDIO 0
 #define CONFIG_LIBCELT 0
 #define CONFIG_LIBDC1394 0
-#define CONFIG_LIBEBUR128 0
-#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_LIBDRM 0
 #define CONFIG_LIBFLITE 0
 #define CONFIG_LIBFONTCONFIG 0
 #define CONFIG_LIBFREETYPE 0
 #define CONFIG_LIBFRIBIDI 0
 #define CONFIG_LIBGME 0
 #define CONFIG_LIBGSM 0
 #define CONFIG_LIBIEC61883 0
 #define CONFIG_LIBILBC 0
 #define CONFIG_LIBKVAZAAR 0
 #define CONFIG_LIBMODPLUG 0
 #define CONFIG_LIBMP3LAME 0
-#define CONFIG_LIBNUT 0
-#define CONFIG_LIBOPENCORE_AMRNB 0
-#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBMYSOFA 0
 #define CONFIG_LIBOPENCV 0
 #define CONFIG_LIBOPENH264 0
 #define CONFIG_LIBOPENJPEG 0
 #define CONFIG_LIBOPENMPT 0
 #define CONFIG_LIBOPUS 0
 #define CONFIG_LIBPULSE 0
+#define CONFIG_LIBRSVG 0
 #define CONFIG_LIBRTMP 0
-#define CONFIG_LIBRUBBERBAND 0
-#define CONFIG_LIBSCHROEDINGER 0
 #define CONFIG_LIBSHINE 0
 #define CONFIG_LIBSMBCLIENT 0
 #define CONFIG_LIBSNAPPY 0
 #define CONFIG_LIBSOXR 0
 #define CONFIG_LIBSPEEX 0
 #define CONFIG_LIBSSH 0
 #define CONFIG_LIBTESSERACT 0
 #define CONFIG_LIBTHEORA 0
 #define CONFIG_LIBTWOLAME 0
 #define CONFIG_LIBV4L2 0
-#define CONFIG_LIBVIDSTAB 0
-#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_LIBVMAF 0
 #define CONFIG_LIBVORBIS 0
 #define CONFIG_LIBVPX 0
 #define CONFIG_LIBWAVPACK 0
 #define CONFIG_LIBWEBP 0
-#define CONFIG_LIBX264 0
-#define CONFIG_LIBX265 0
-#define CONFIG_LIBXAVS 0
-#define CONFIG_LIBXCB 0
-#define CONFIG_LIBXCB_SHM 0
-#define CONFIG_LIBXCB_SHAPE 0
-#define CONFIG_LIBXCB_XFIXES 0
-#define CONFIG_LIBXVID 0
+#define CONFIG_LIBXML2 0
 #define CONFIG_LIBZIMG 0
 #define CONFIG_LIBZMQ 0
 #define CONFIG_LIBZVBI 0
-#define CONFIG_LZMA 0
 #define CONFIG_MEDIACODEC 0
-#define CONFIG_NETCDF 0
 #define CONFIG_OPENAL 0
 #define CONFIG_OPENCL 0
 #define CONFIG_OPENGL 0
-#define CONFIG_OPENSSL 0
-#define CONFIG_SCHANNEL 0
-#define CONFIG_SDL 0
-#define CONFIG_SDL2 0
-#define CONFIG_SECURETRANSPORT 0
-#define CONFIG_VIDEOTOOLBOX 0
-#define CONFIG_X11GRAB 0
-#define CONFIG_XLIB 0
-#define CONFIG_ZLIB 0
 #define CONFIG_AUDIOTOOLBOX 0
-#define CONFIG_CUDA 0
-#define CONFIG_CUVID 0
+#define CONFIG_CRYSTALHD 0
+#define CONFIG_CUDA 1
+#define CONFIG_CUVID 1
 #define CONFIG_D3D11VA 0
 #define CONFIG_DXVA2 0
-#define CONFIG_LIBMFX 0
-#define CONFIG_LIBNPP 0
-#define CONFIG_MMAL 0
-#define CONFIG_NVENC 0
-#define CONFIG_OMX 0
+#define CONFIG_NVENC 1
 #define CONFIG_VAAPI 0
 #define CONFIG_VDA 0
 #define CONFIG_VDPAU 0
+#define CONFIG_VIDEOTOOLBOX 0
+#define CONFIG_V4L2_M2M 1
 #define CONFIG_XVMC 0
+#define CONFIG_CUDA_SDK 0
+#define CONFIG_LIBNPP 0
+#define CONFIG_LIBMFX 0
+#define CONFIG_MMAL 0
+#define CONFIG_OMX 0
 #define CONFIG_FTRAPV 0
 #define CONFIG_GRAY 0
 #define CONFIG_HARDCODED_TABLES 0
 #define CONFIG_OMX_RPI 0
 #define CONFIG_RUNTIME_CPUDETECT 1
 #define CONFIG_SAFE_BITSTREAM_READER 1
 #define CONFIG_SHARED 1
 #define CONFIG_SMALL 0
@@ -542,70 +552,86 @@
 #define CONFIG_FAST_UNALIGNED 1
 #define CONFIG_FFT 0
 #define CONFIG_LSP 0
 #define CONFIG_LZO 0
 #define CONFIG_MDCT 0
 #define CONFIG_PIXELUTILS 0
 #define CONFIG_NETWORK 0
 #define CONFIG_RDFT 0
+#define CONFIG_AUTODETECT 0
 #define CONFIG_FONTCONFIG 0
-#define CONFIG_MEMALIGN_HACK 0
+#define CONFIG_LINUX_PERF 0
 #define CONFIG_MEMORY_POISONING 0
 #define CONFIG_NEON_CLOBBER_TEST 0
+#define CONFIG_OSSFUZZ 0
 #define CONFIG_PIC 1
-#define CONFIG_POD2MAN 1
-#define CONFIG_RAISE_MAJOR 0
 #define CONFIG_THUMB 0
 #define CONFIG_VALGRIND_BACKTRACE 0
 #define CONFIG_XMM_CLOBBER_TEST 0
+#define CONFIG_BSFS 1
+#define CONFIG_DECODERS 1
+#define CONFIG_ENCODERS 0
+#define CONFIG_HWACCELS 0
+#define CONFIG_PARSERS 1
+#define CONFIG_INDEVS 0
+#define CONFIG_OUTDEVS 0
+#define CONFIG_FILTERS 0
+#define CONFIG_DEMUXERS 0
+#define CONFIG_MUXERS 0
+#define CONFIG_PROTOCOLS 0
 #define CONFIG_AANDCTTABLES 0
 #define CONFIG_AC3DSP 0
 #define CONFIG_AUDIO_FRAME_QUEUE 0
 #define CONFIG_AUDIODSP 0
 #define CONFIG_BLOCKDSP 0
 #define CONFIG_BSWAPDSP 0
 #define CONFIG_CABAC 0
 #define CONFIG_DIRAC_PARSE 0
 #define CONFIG_DVPROFILE 0
 #define CONFIG_EXIF 0
 #define CONFIG_FAANDCT 0
 #define CONFIG_FAANIDCT 0
 #define CONFIG_FDCTDSP 0
 #define CONFIG_FLACDSP 1
 #define CONFIG_FMTCONVERT 0
+#define CONFIG_FRAME_THREAD_ENCODER 0
 #define CONFIG_G722DSP 0
-#define CONFIG_GOLOMB 1
+#define CONFIG_GOLOMB 0
 #define CONFIG_GPLV3 0
 #define CONFIG_H263DSP 0
 #define CONFIG_H264CHROMA 0
 #define CONFIG_H264DSP 0
+#define CONFIG_H264PARSE 0
 #define CONFIG_H264PRED 1
 #define CONFIG_H264QPEL 0
+#define CONFIG_HEVCPARSE 0
 #define CONFIG_HPELDSP 0
 #define CONFIG_HUFFMAN 0
 #define CONFIG_HUFFYUVDSP 0
 #define CONFIG_HUFFYUVENCDSP 0
 #define CONFIG_IDCTDSP 0
 #define CONFIG_IIRFILTER 0
-#define CONFIG_IMDCT15 0
+#define CONFIG_MDCT15 0
 #define CONFIG_INTRAX8 0
 #define CONFIG_ISO_MEDIA 0
 #define CONFIG_IVIDSP 0
 #define CONFIG_JPEGTABLES 0
 #define CONFIG_LGPLV3 0
 #define CONFIG_LIBX262 0
 #define CONFIG_LLAUDDSP 0
 #define CONFIG_LLVIDDSP 0
+#define CONFIG_LLVIDENCDSP 0
 #define CONFIG_LPC 0
 #define CONFIG_LZF 0
 #define CONFIG_ME_CMP 0
 #define CONFIG_MPEG_ER 0
 #define CONFIG_MPEGAUDIO 0
 #define CONFIG_MPEGAUDIODSP 0
+#define CONFIG_MPEGAUDIOHEADER 0
 #define CONFIG_MPEGVIDEO 0
 #define CONFIG_MPEGVIDEOENC 0
 #define CONFIG_MSS34DSP 0
 #define CONFIG_PIXBLOCKDSP 0
 #define CONFIG_QPELDSP 0
 #define CONFIG_QSV 0
 #define CONFIG_QSVDEC 0
 #define CONFIG_QSVENC 0
@@ -617,23 +643,23 @@
 #define CONFIG_RV34DSP 0
 #define CONFIG_SINEWIN 0
 #define CONFIG_SNAPPY 0
 #define CONFIG_SRTP 0
 #define CONFIG_STARTCODE 0
 #define CONFIG_TEXTUREDSP 0
 #define CONFIG_TEXTUREDSPENC 0
 #define CONFIG_TPELDSP 0
+#define CONFIG_VAAPI_1 0
 #define CONFIG_VAAPI_ENCODE 0
 #define CONFIG_VC1DSP 0
 #define CONFIG_VIDEODSP 1
 #define CONFIG_VP3DSP 0
 #define CONFIG_VP56DSP 0
 #define CONFIG_VP8DSP 1
-#define CONFIG_VT_BT2020 0
 #define CONFIG_WMA_FREQS 0
 #define CONFIG_WMV2DSP 0
 #define CONFIG_NULL_BSF 1
 #define CONFIG_VP8_DECODER 1
 #define CONFIG_VP9_DECODER 1
 #define CONFIG_FLAC_DECODER 1
 #define CONFIG_FLAC_PARSER 0
 #define CONFIG_VP8_PARSER 1
--- a/media/ffvpx/config_win32.asm
+++ b/media/ffvpx/config_win32.asm
@@ -58,18 +58,18 @@
 %define HAVE_MIPS32R2 0
 %define HAVE_MIPS32R5 0
 %define HAVE_MIPS64R2 0
 %define HAVE_MIPS32R6 0
 %define HAVE_MIPS64R6 0
 %define HAVE_MIPSDSP 0
 %define HAVE_MIPSDSPR2 0
 %define HAVE_MSA 0
-%define HAVE_LOONGSON2 1
-%define HAVE_LOONGSON3 1
+%define HAVE_LOONGSON2 0
+%define HAVE_LOONGSON3 0
 %define HAVE_MMI 0
 %define HAVE_ARMV5TE_EXTERNAL 0
 %define HAVE_ARMV6_EXTERNAL 0
 %define HAVE_ARMV6T2_EXTERNAL 0
 %define HAVE_ARMV8_EXTERNAL 0
 %define HAVE_NEON_EXTERNAL 0
 %define HAVE_VFP_EXTERNAL 0
 %define HAVE_VFPV3_EXTERNAL 0
@@ -151,71 +151,73 @@
 %define HAVE_MIPSDSP_INLINE 0
 %define HAVE_MIPSDSPR2_INLINE 0
 %define HAVE_MSA_INLINE 0
 %define HAVE_LOONGSON2_INLINE 0
 %define HAVE_LOONGSON3_INLINE 0
 %define HAVE_MMI_INLINE 0
 %define HAVE_ALIGNED_STACK 0
 %define HAVE_FAST_64BIT 0
-%define HAVE_FAST_CLZ 0
+%define HAVE_FAST_CLZ 1
 %define HAVE_FAST_CMOV 0
 %define HAVE_LOCAL_ALIGNED_8 1
 %define HAVE_LOCAL_ALIGNED_16 1
 %define HAVE_LOCAL_ALIGNED_32 1
 %define HAVE_SIMD_ALIGN_16 1
+%define HAVE_SIMD_ALIGN_32 1
 %define HAVE_ATOMICS_GCC 0
 %define HAVE_ATOMICS_SUNCC 0
 %define HAVE_ATOMICS_WIN32 1
 %define HAVE_ATOMIC_CAS_PTR 0
-%define HAVE_ATOMIC_COMPARE_EXCHANGE 0
 %define HAVE_MACHINE_RW_BARRIER 0
 %define HAVE_MEMORYBARRIER 1
 %define HAVE_MM_EMPTY 1
 %define HAVE_RDTSC 1
 %define HAVE_SARESTART 0
-%define HAVE_SEM_TIMEDWAIT 1
+%define HAVE_SEM_TIMEDWAIT 0
 %define HAVE_SYNC_VAL_COMPARE_AND_SWAP 0
 %define HAVE_CABS 0
 %define HAVE_CEXP 0
 %define HAVE_INLINE_ASM 0
 %define HAVE_SYMVER 0
-%define HAVE_YASM 1
+%define HAVE_X86ASM 1
 %define HAVE_BIGENDIAN 0
 %define HAVE_FAST_UNALIGNED 1
-%define HAVE_ALSA_ASOUNDLIB_H 0
 %define HAVE_ALTIVEC_H 0
 %define HAVE_ARPA_INET_H 0
 %define HAVE_ASM_TYPES_H 0
 %define HAVE_CDIO_PARANOIA_H 0
 %define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+%define HAVE_CUDA_H 0
+%define HAVE_D3D11_H 1
 %define HAVE_DISPATCH_DISPATCH_H 0
 %define HAVE_DEV_BKTR_IOCTL_BT848_H 0
 %define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
 %define HAVE_DEV_IC_BT8XX_H 0
 %define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0
 %define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0
 %define HAVE_DIRECT_H 1
 %define HAVE_DIRENT_H 0
 %define HAVE_DLFCN_H 0
-%define HAVE_D3D11_H 1
+%define HAVE_DXGIDEBUG_H 1
 %define HAVE_DXVA_H 1
 %define HAVE_ES2_GL_H 0
 %define HAVE_GSM_H 0
 %define HAVE_IO_H 1
 %define HAVE_MACH_MACH_TIME_H 0
 %define HAVE_MACHINE_IOCTL_BT848_H 0
 %define HAVE_MACHINE_IOCTL_METEOR_H 0
 %define HAVE_OPENCV2_CORE_CORE_C_H 0
+%define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+%define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
 %define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
 %define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
 %define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
 %define HAVE_OPENGL_GL3_H 0
 %define HAVE_POLL_H 0
-%define HAVE_SNDIO_H 0
 %define HAVE_SOUNDCARD_H 0
 %define HAVE_STDATOMIC_H 0
 %define HAVE_SYS_MMAN_H 0
 %define HAVE_SYS_PARAM_H 0
 %define HAVE_SYS_RESOURCE_H 0
 %define HAVE_SYS_SELECT_H 0
 %define HAVE_SYS_SOUNDCARD_H 0
 %define HAVE_SYS_TIME_H 0
@@ -259,17 +261,16 @@
 %define HAVE_TRUNCF 1
 %define HAVE_ACCESS 1
 %define HAVE_ALIGNED_MALLOC 1
 %define HAVE_CLOCK_GETTIME 0
 %define HAVE_CLOSESOCKET 1
 %define HAVE_COMMANDLINETOARGVW 1
 %define HAVE_COTASKMEMFREE 1
 %define HAVE_CRYPTGENRANDOM 1
-%define HAVE_DLOPEN 0
 %define HAVE_FCNTL 0
 %define HAVE_FLT_LIM 1
 %define HAVE_FORK 0
 %define HAVE_GETADDRINFO 1
 %define HAVE_GETHRTIME 0
 %define HAVE_GETOPT 0
 %define HAVE_GETPROCESSAFFINITYMASK 1
 %define HAVE_GETPROCESSMEMORYINFO 1
@@ -279,17 +280,17 @@
 %define HAVE_GETTIMEOFDAY 0
 %define HAVE_GLOB 0
 %define HAVE_GLXGETPROCADDRESS 0
 %define HAVE_GMTIME_R 0
 %define HAVE_INET_ATON 0
 %define HAVE_ISATTY 1
 %define HAVE_JACK_PORT_GET_LATENCY_RANGE 0
 %define HAVE_KBHIT 1
-%define HAVE_LOADLIBRARY 0
+%define HAVE_LOADLIBRARY 1
 %define HAVE_LSTAT 0
 %define HAVE_LZO1X_999_COMPRESS 0
 %define HAVE_MACH_ABSOLUTE_TIME 0
 %define HAVE_MAPVIEWOFFILE 1
 %define HAVE_MKSTEMP 0
 %define HAVE_MMAP 0
 %define HAVE_MPROTECT 0
 %define HAVE_NANOSLEEP 0
@@ -307,197 +308,206 @@
 %define HAVE_USLEEP 0
 %define HAVE_UTGETOSTYPEFROMSTRING 0
 %define HAVE_VIRTUALALLOC 1
 %define HAVE_WGLGETPROCADDRESS 0
 %define HAVE_PTHREADS 0
 %define HAVE_OS2THREADS 0
 %define HAVE_W32THREADS 1
 %define HAVE_AS_DN_DIRECTIVE 0
+%define HAVE_AS_FPU_DIRECTIVE 0
 %define HAVE_AS_FUNC 0
 %define HAVE_AS_OBJECT_ARCH 0
 %define HAVE_ASM_MOD_Q 0
 %define HAVE_ATTRIBUTE_MAY_ALIAS 0
 %define HAVE_ATTRIBUTE_PACKED 0
+%define HAVE_BLOCKS_EXTENSION 0
 %define HAVE_EBP_AVAILABLE 0
 %define HAVE_EBX_AVAILABLE 0
 %define HAVE_GNU_AS 0
 %define HAVE_GNU_WINDRES 0
 %define HAVE_IBM_ASM 0
 %define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 0
 %define HAVE_INLINE_ASM_LABELS 0
 %define HAVE_INLINE_ASM_NONLOCAL_LABELS 0
 %define HAVE_PRAGMA_DEPRECATED 1
 %define HAVE_RSYNC_CONTIMEOUT 0
 %define HAVE_SYMVER_ASM_LABEL 0
 %define HAVE_SYMVER_GNU_ASM 0
 %define HAVE_VFP_ARGS 0
 %define HAVE_XFORM_ASM 0
 %define HAVE_XMM_CLOBBERS 0
 %define HAVE_CONDITION_VARIABLE_PTR 1
+%define HAVE_KCMVIDEOCODECTYPE_HEVC 0
 %define HAVE_SOCKLEN_T 1
 %define HAVE_STRUCT_ADDRINFO 1
 %define HAVE_STRUCT_GROUP_SOURCE_REQ 1
 %define HAVE_STRUCT_IP_MREQ_SOURCE 1
 %define HAVE_STRUCT_IPV6_MREQ 1
-%define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1
+%define HAVE_STRUCT_MSGHDR_MSG_FLAGS 0
 %define HAVE_STRUCT_POLLFD 0
 %define HAVE_STRUCT_RUSAGE_RU_MAXRSS 0
 %define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
 %define HAVE_STRUCT_SOCKADDR_IN6 1
 %define HAVE_STRUCT_SOCKADDR_SA_LEN 0
 %define HAVE_STRUCT_SOCKADDR_STORAGE 1
 %define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0
 %define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0
 %define HAVE_ATOMICS_NATIVE 1
 %define HAVE_DOS_PATHS 1
-%define HAVE_DXVA2_LIB 0
-%define HAVE_DXVA2API_COBJ 1
 %define HAVE_LIBC_MSVCRT 1
-%define HAVE_LIBDC1394_1 0
-%define HAVE_LIBDC1394_2 0
 %define HAVE_MAKEINFO 1
 %define HAVE_MAKEINFO_HTML 0
 %define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
 %define HAVE_PERL 1
 %define HAVE_POD2MAN 1
-%define HAVE_SDL2 0
 %define HAVE_SECTION_DATA_REL_RO 0
 %define HAVE_TEXI2HTML 0
 %define HAVE_THREADS 1
+%define HAVE_UWP 0
 %define HAVE_VAAPI_DRM 0
 %define HAVE_VAAPI_X11 0
 %define HAVE_VDPAU_X11 0
 %define HAVE_WINRT 0
-%define HAVE_XLIB 0
-%define CONFIG_BSFS 0
-%define CONFIG_DECODERS 1
-%define CONFIG_PARSERS 1
 %define CONFIG_DOC 0
 %define CONFIG_HTMLPAGES 0
 %define CONFIG_MANPAGES 1
 %define CONFIG_PODPAGES 1
 %define CONFIG_TXTPAGES 1
 %define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
 %define CONFIG_AVIO_READING_EXAMPLE 1
-%define CONFIG_DECODING_ENCODING_EXAMPLE 0
+%define CONFIG_DECODE_AUDIO_EXAMPLE 1
+%define CONFIG_DECODE_VIDEO_EXAMPLE 1
 %define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+%define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+%define CONFIG_ENCODE_VIDEO_EXAMPLE 1
 %define CONFIG_EXTRACT_MVS_EXAMPLE 0
 %define CONFIG_FILTER_AUDIO_EXAMPLE 0
 %define CONFIG_FILTERING_AUDIO_EXAMPLE 0
 %define CONFIG_FILTERING_VIDEO_EXAMPLE 0
 %define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+%define CONFIG_HW_DECODE_EXAMPLE 0
 %define CONFIG_METADATA_EXAMPLE 0
 %define CONFIG_MUXING_EXAMPLE 0
 %define CONFIG_QSVDEC_EXAMPLE 0
 %define CONFIG_REMUXING_EXAMPLE 0
 %define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0
 %define CONFIG_SCALING_VIDEO_EXAMPLE 0
 %define CONFIG_TRANSCODE_AAC_EXAMPLE 0
 %define CONFIG_TRANSCODING_EXAMPLE 0
-%define CONFIG_AVISYNTH 0
+%define CONFIG_ALSA 0
+%define CONFIG_APPKIT 0
+%define CONFIG_AVFOUNDATION 0
 %define CONFIG_BZLIB 0
-%define CONFIG_CHROMAPRINT 0
-%define CONFIG_CRYSTALHD 0
+%define CONFIG_COREIMAGE 0
+%define CONFIG_ICONV 0
+%define CONFIG_JACK 0
+%define CONFIG_LIBXCB 0
+%define CONFIG_LIBXCB_SHM 0
+%define CONFIG_LIBXCB_SHAPE 0
+%define CONFIG_LIBXCB_XFIXES 0
+%define CONFIG_LZMA 0
+%define CONFIG_SCHANNEL 1
+%define CONFIG_SDL2 0
+%define CONFIG_SECURETRANSPORT 0
+%define CONFIG_SNDIO 0
+%define CONFIG_XLIB 1
+%define CONFIG_ZLIB 0
+%define CONFIG_AVISYNTH 0
+%define CONFIG_FREI0R 0
+%define CONFIG_LIBCDIO 0
+%define CONFIG_LIBRUBBERBAND 0
+%define CONFIG_LIBVIDSTAB 0
+%define CONFIG_LIBX264 0
+%define CONFIG_LIBX265 0
+%define CONFIG_LIBXAVS 0
+%define CONFIG_LIBXVID 0
 %define CONFIG_DECKLINK 0
-%define CONFIG_FREI0R 0
-%define CONFIG_GCRYPT 0
+%define CONFIG_LIBNDI_NEWTEK 0
+%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_OPENSSL 0
 %define CONFIG_GMP 0
+%define CONFIG_LIBOPENCORE_AMRNB 0
+%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_RKMPP 0
+%define CONFIG_LIBSMBCLIENT 0
+%define CONFIG_CHROMAPRINT 0
+%define CONFIG_GCRYPT 0
 %define CONFIG_GNUTLS 0
-%define CONFIG_ICONV 0
 %define CONFIG_JNI 0
 %define CONFIG_LADSPA 0
 %define CONFIG_LIBASS 0
 %define CONFIG_LIBBLURAY 0
 %define CONFIG_LIBBS2B 0
 %define CONFIG_LIBCACA 0
-%define CONFIG_LIBCDIO 0
 %define CONFIG_LIBCELT 0
 %define CONFIG_LIBDC1394 0
-%define CONFIG_LIBEBUR128 0
-%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_LIBDRM 0
 %define CONFIG_LIBFLITE 0
 %define CONFIG_LIBFONTCONFIG 0
 %define CONFIG_LIBFREETYPE 0
 %define CONFIG_LIBFRIBIDI 0
 %define CONFIG_LIBGME 0
 %define CONFIG_LIBGSM 0
 %define CONFIG_LIBIEC61883 0
 %define CONFIG_LIBILBC 0
 %define CONFIG_LIBKVAZAAR 0
 %define CONFIG_LIBMODPLUG 0
 %define CONFIG_LIBMP3LAME 0
-%define CONFIG_LIBNUT 0
-%define CONFIG_LIBOPENCORE_AMRNB 0
-%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBMYSOFA 0
 %define CONFIG_LIBOPENCV 0
 %define CONFIG_LIBOPENH264 0
 %define CONFIG_LIBOPENJPEG 0
 %define CONFIG_LIBOPENMPT 0
 %define CONFIG_LIBOPUS 0
 %define CONFIG_LIBPULSE 0
+%define CONFIG_LIBRSVG 0
 %define CONFIG_LIBRTMP 0
-%define CONFIG_LIBRUBBERBAND 0
-%define CONFIG_LIBSCHROEDINGER 0
 %define CONFIG_LIBSHINE 0
 %define CONFIG_LIBSMBCLIENT 0
 %define CONFIG_LIBSNAPPY 0
 %define CONFIG_LIBSOXR 0
 %define CONFIG_LIBSPEEX 0
 %define CONFIG_LIBSSH 0
 %define CONFIG_LIBTESSERACT 0
 %define CONFIG_LIBTHEORA 0
 %define CONFIG_LIBTWOLAME 0
 %define CONFIG_LIBV4L2 0
-%define CONFIG_LIBVIDSTAB 0
-%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_LIBVMAF 0
 %define CONFIG_LIBVORBIS 0
 %define CONFIG_LIBVPX 0
 %define CONFIG_LIBWAVPACK 0
 %define CONFIG_LIBWEBP 0
-%define CONFIG_LIBX264 0
-%define CONFIG_LIBX265 0
-%define CONFIG_LIBXAVS 0
-%define CONFIG_LIBXCB 0
-%define CONFIG_LIBXCB_SHM 0
-%define CONFIG_LIBXCB_SHAPE 0
-%define CONFIG_LIBXCB_XFIXES 0
-%define CONFIG_LIBXVID 0
+%define CONFIG_LIBXML2 0
 %define CONFIG_LIBZIMG 0
 %define CONFIG_LIBZMQ 0
 %define CONFIG_LIBZVBI 0
-%define CONFIG_LZMA 0
 %define CONFIG_MEDIACODEC 0
-%define CONFIG_NETCDF 0
 %define CONFIG_OPENAL 0
 %define CONFIG_OPENCL 0
 %define CONFIG_OPENGL 0
-%define CONFIG_OPENSSL 0
-%define CONFIG_SCHANNEL 1
-%define CONFIG_SDL 0
-%define CONFIG_SDL2 0
-%define CONFIG_SECURETRANSPORT 0
-%define CONFIG_VIDEOTOOLBOX 0
-%define CONFIG_X11GRAB 0
-%define CONFIG_XLIB 0
-%define CONFIG_ZLIB 0
 %define CONFIG_AUDIOTOOLBOX 0
-%define CONFIG_CUDA 0
-%define CONFIG_CUVID 0
+%define CONFIG_CRYSTALHD 0
+%define CONFIG_CUDA 1
+%define CONFIG_CUVID 1
 %define CONFIG_D3D11VA 0
 %define CONFIG_DXVA2 0
-%define CONFIG_LIBMFX 0
-%define CONFIG_LIBNPP 0
-%define CONFIG_MMAL 0
-%define CONFIG_NVENC 0
-%define CONFIG_OMX 0
+%define CONFIG_NVENC 1
 %define CONFIG_VAAPI 0
 %define CONFIG_VDA 0
 %define CONFIG_VDPAU 0
+%define CONFIG_VIDEOTOOLBOX 0
+%define CONFIG_V4L2_M2M 0
 %define CONFIG_XVMC 0
+%define CONFIG_CUDA_SDK 0
+%define CONFIG_LIBNPP 0
+%define CONFIG_LIBMFX 0
+%define CONFIG_MMAL 0
+%define CONFIG_OMX 0
 %define CONFIG_FTRAPV 0
 %define CONFIG_GRAY 0
 %define CONFIG_HARDCODED_TABLES 0
 %define CONFIG_OMX_RPI 0
 %define CONFIG_RUNTIME_CPUDETECT 1
 %define CONFIG_SAFE_BITSTREAM_READER 1
 %define CONFIG_SHARED 1
 %define CONFIG_SMALL 0
@@ -526,70 +536,86 @@
 %define CONFIG_FAST_UNALIGNED 1
 %define CONFIG_FFT 0
 %define CONFIG_LSP 0
 %define CONFIG_LZO 0
 %define CONFIG_MDCT 0
 %define CONFIG_PIXELUTILS 0
 %define CONFIG_NETWORK 0
 %define CONFIG_RDFT 0
+%define CONFIG_AUTODETECT 0
 %define CONFIG_FONTCONFIG 0
-%define CONFIG_MEMALIGN_HACK 0
+%define CONFIG_LINUX_PERF 0
 %define CONFIG_MEMORY_POISONING 0
 %define CONFIG_NEON_CLOBBER_TEST 0
+%define CONFIG_OSSFUZZ 0
 %define CONFIG_PIC 0
-%define CONFIG_POD2MAN 1
-%define CONFIG_RAISE_MAJOR 0
 %define CONFIG_THUMB 0
 %define CONFIG_VALGRIND_BACKTRACE 0
 %define CONFIG_XMM_CLOBBER_TEST 0
+%define CONFIG_BSFS 1
+%define CONFIG_DECODERS 1
+%define CONFIG_ENCODERS 0
+%define CONFIG_HWACCELS 0
+%define CONFIG_PARSERS 1
+%define CONFIG_INDEVS 0
+%define CONFIG_OUTDEVS 0
+%define CONFIG_FILTERS 0
+%define CONFIG_DEMUXERS 0
+%define CONFIG_MUXERS 0
+%define CONFIG_PROTOCOLS 0
 %define CONFIG_AANDCTTABLES 0
 %define CONFIG_AC3DSP 0
 %define CONFIG_AUDIO_FRAME_QUEUE 0
 %define CONFIG_AUDIODSP 0
 %define CONFIG_BLOCKDSP 0
 %define CONFIG_BSWAPDSP 0
 %define CONFIG_CABAC 0
 %define CONFIG_DIRAC_PARSE 0
 %define CONFIG_DVPROFILE 0
 %define CONFIG_EXIF 0
 %define CONFIG_FAANDCT 0
 %define CONFIG_FAANIDCT 0
 %define CONFIG_FDCTDSP 0
 %define CONFIG_FLACDSP 1
 %define CONFIG_FMTCONVERT 0
+%define CONFIG_FRAME_THREAD_ENCODER 0
 %define CONFIG_G722DSP 0
-%define CONFIG_GOLOMB 1
+%define CONFIG_GOLOMB 0
 %define CONFIG_GPLV3 0
 %define CONFIG_H263DSP 0
 %define CONFIG_H264CHROMA 0
 %define CONFIG_H264DSP 0
+%define CONFIG_H264PARSE 0
 %define CONFIG_H264PRED 1
 %define CONFIG_H264QPEL 0
+%define CONFIG_HEVCPARSE 0
 %define CONFIG_HPELDSP 0
 %define CONFIG_HUFFMAN 0
 %define CONFIG_HUFFYUVDSP 0
 %define CONFIG_HUFFYUVENCDSP 0
 %define CONFIG_IDCTDSP 0
 %define CONFIG_IIRFILTER 0
-%define CONFIG_IMDCT15 0
+%define CONFIG_MDCT15 0
 %define CONFIG_INTRAX8 0
 %define CONFIG_ISO_MEDIA 0
 %define CONFIG_IVIDSP 0
 %define CONFIG_JPEGTABLES 0
 %define CONFIG_LGPLV3 0
 %define CONFIG_LIBX262 0
 %define CONFIG_LLAUDDSP 0
 %define CONFIG_LLVIDDSP 0
+%define CONFIG_LLVIDENCDSP 0
 %define CONFIG_LPC 0
 %define CONFIG_LZF 0
 %define CONFIG_ME_CMP 0
 %define CONFIG_MPEG_ER 0
 %define CONFIG_MPEGAUDIO 0
 %define CONFIG_MPEGAUDIODSP 0
+%define CONFIG_MPEGAUDIOHEADER 0
 %define CONFIG_MPEGVIDEO 0
 %define CONFIG_MPEGVIDEOENC 0
 %define CONFIG_MSS34DSP 0
 %define CONFIG_PIXBLOCKDSP 0
 %define CONFIG_QPELDSP 0
 %define CONFIG_QSV 0
 %define CONFIG_QSVDEC 0
 %define CONFIG_QSVENC 0
@@ -601,23 +627,23 @@
 %define CONFIG_RV34DSP 0
 %define CONFIG_SINEWIN 0
 %define CONFIG_SNAPPY 0
 %define CONFIG_SRTP 0
 %define CONFIG_STARTCODE 0
 %define CONFIG_TEXTUREDSP 0
 %define CONFIG_TEXTUREDSPENC 0
 %define CONFIG_TPELDSP 0
+%define CONFIG_VAAPI_1 0
 %define CONFIG_VAAPI_ENCODE 0
 %define CONFIG_VC1DSP 0
 %define CONFIG_VIDEODSP 1
 %define CONFIG_VP3DSP 0
 %define CONFIG_VP56DSP 0
 %define CONFIG_VP8DSP 1
-%define CONFIG_VT_BT2020 0
 %define CONFIG_WMA_FREQS 0
 %define CONFIG_WMV2DSP 0
 %define CONFIG_NULL_BSF 1
 %define CONFIG_VP8_DECODER 1
 %define CONFIG_VP9_DECODER 1
 %define CONFIG_FLAC_DECODER 1
 %define CONFIG_FLAC_PARSER 0
 %define CONFIG_VP8_PARSER 1
--- a/media/ffvpx/config_win32.h
+++ b/media/ffvpx/config_win32.h
@@ -1,17 +1,17 @@
 /* Automatically generated by configure - do not modify! */
 #ifndef FFMPEG_CONFIG_H
 #define FFMPEG_CONFIG_H
-#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-asm --enable-yasm --toolchain=msvc"
+#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --disable-videotoolbox --enable-decoder=flac --enable-asm --enable-x86asm --toolchain=msvc"
 #define FFMPEG_LICENSE "LGPL version 2.1 or later"
-#define CONFIG_THIS_YEAR 2016
+#define CONFIG_THIS_YEAR 2017
 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg"
 #define AVCONV_DATADIR "/usr/local/share/ffmpeg"
-#define CC_IDENT "Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x86"
+#define CC_IDENT "Microsoft (R) C/C++ Optimizing Compiler Version 19.11.25508.2 for x86"
 #define av_restrict __restrict
 #define EXTERN_PREFIX "_"
 #define EXTERN_ASM _
 #define BUILDSUF ""
 #define SLIBSUF ".dll"
 #define HAVE_MMX2 HAVE_MMXEXT
 #define SWS_MAX_FILTER_SIZE 256
 #define ARCH_AARCH64 0
@@ -74,18 +74,18 @@
 #define HAVE_MIPS32R2 0
 #define HAVE_MIPS32R5 0
 #define HAVE_MIPS64R2 0
 #define HAVE_MIPS32R6 0
 #define HAVE_MIPS64R6 0
 #define HAVE_MIPSDSP 0
 #define HAVE_MIPSDSPR2 0
 #define HAVE_MSA 0
-#define HAVE_LOONGSON2 1
-#define HAVE_LOONGSON3 1
+#define HAVE_LOONGSON2 0
+#define HAVE_LOONGSON3 0
 #define HAVE_MMI 0
 #define HAVE_ARMV5TE_EXTERNAL 0
 #define HAVE_ARMV6_EXTERNAL 0
 #define HAVE_ARMV6T2_EXTERNAL 0
 #define HAVE_ARMV8_EXTERNAL 0
 #define HAVE_NEON_EXTERNAL 0
 #define HAVE_VFP_EXTERNAL 0
 #define HAVE_VFPV3_EXTERNAL 0
@@ -173,65 +173,67 @@
 #define HAVE_ALIGNED_STACK 0
 #define HAVE_FAST_64BIT 0
 #define HAVE_FAST_CLZ 0
 #define HAVE_FAST_CMOV 0
 #define HAVE_LOCAL_ALIGNED_8 1
 #define HAVE_LOCAL_ALIGNED_16 1
 #define HAVE_LOCAL_ALIGNED_32 1
 #define HAVE_SIMD_ALIGN_16 1
+#define HAVE_SIMD_ALIGN_32 1
 #define HAVE_ATOMICS_GCC 0
 #define HAVE_ATOMICS_SUNCC 0
 #define HAVE_ATOMICS_WIN32 1
 #define HAVE_ATOMIC_CAS_PTR 0
-#define HAVE_ATOMIC_COMPARE_EXCHANGE 0
 #define HAVE_MACHINE_RW_BARRIER 0
 #define HAVE_MEMORYBARRIER 1
 #define HAVE_MM_EMPTY 1
 #define HAVE_RDTSC 1
 #define HAVE_SARESTART 0
-#define HAVE_SEM_TIMEDWAIT 1
+#define HAVE_SEM_TIMEDWAIT 0
 #define HAVE_SYNC_VAL_COMPARE_AND_SWAP 0
 #define HAVE_CABS 0
 #define HAVE_CEXP 0
 #define HAVE_INLINE_ASM 0
 #define HAVE_SYMVER 0
-#define HAVE_YASM 1
+#define HAVE_X86ASM 1
 #define HAVE_BIGENDIAN 0
 #define HAVE_FAST_UNALIGNED 1
-#define HAVE_ALSA_ASOUNDLIB_H 0
 #define HAVE_ALTIVEC_H 0
 #define HAVE_ARPA_INET_H 0
 #define HAVE_ASM_TYPES_H 0
 #define HAVE_CDIO_PARANOIA_H 0
 #define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+#define HAVE_CUDA_H 0
+#define HAVE_D3D11_H 1
 #define HAVE_DISPATCH_DISPATCH_H 0
 #define HAVE_DEV_BKTR_IOCTL_BT848_H 0
 #define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
 #define HAVE_DEV_IC_BT8XX_H 0
 #define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0
 #define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0
 #define HAVE_DIRECT_H 1
 #define HAVE_DIRENT_H 0
 #define HAVE_DLFCN_H 0
-#define HAVE_D3D11_H 1
+#define HAVE_DXGIDEBUG_H 1
 #define HAVE_DXVA_H 1
 #define HAVE_ES2_GL_H 0
 #define HAVE_GSM_H 0
 #define HAVE_IO_H 1
 #define HAVE_MACH_MACH_TIME_H 0
 #define HAVE_MACHINE_IOCTL_BT848_H 0
 #define HAVE_MACHINE_IOCTL_METEOR_H 0
 #define HAVE_OPENCV2_CORE_CORE_C_H 0
+#define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+#define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
 #define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
 #define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
 #define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
 #define HAVE_OPENGL_GL3_H 0
 #define HAVE_POLL_H 0
-#define HAVE_SNDIO_H 0
 #define HAVE_SOUNDCARD_H 0
 #define HAVE_STDATOMIC_H 0
 #define HAVE_SYS_MMAN_H 0
 #define HAVE_SYS_PARAM_H 0
 #define HAVE_SYS_RESOURCE_H 0
 #define HAVE_SYS_SELECT_H 0
 #define HAVE_SYS_SOUNDCARD_H 0
 #define HAVE_SYS_TIME_H 0
@@ -275,17 +277,16 @@
 #define HAVE_TRUNCF 1
 #define HAVE_ACCESS 1
 #define HAVE_ALIGNED_MALLOC 1
 #define HAVE_CLOCK_GETTIME 0
 #define HAVE_CLOSESOCKET 1
 #define HAVE_COMMANDLINETOARGVW 1
 #define HAVE_COTASKMEMFREE 1
 #define HAVE_CRYPTGENRANDOM 1
-#define HAVE_DLOPEN 0
 #define HAVE_FCNTL 0
 #define HAVE_FLT_LIM 1
 #define HAVE_FORK 0
 #define HAVE_GETADDRINFO 1
 #define HAVE_GETHRTIME 0
 #define HAVE_GETOPT 0
 #define HAVE_GETPROCESSAFFINITYMASK 1
 #define HAVE_GETPROCESSMEMORYINFO 1
@@ -295,17 +296,17 @@
 #define HAVE_GETTIMEOFDAY 0
 #define HAVE_GLOB 0
 #define HAVE_GLXGETPROCADDRESS 0
 #define HAVE_GMTIME_R 0
 #define HAVE_INET_ATON 0
 #define HAVE_ISATTY 1
 #define HAVE_JACK_PORT_GET_LATENCY_RANGE 0
 #define HAVE_KBHIT 1
-#define HAVE_LOADLIBRARY 0
+#define HAVE_LOADLIBRARY 1
 #define HAVE_LSTAT 0
 #define HAVE_LZO1X_999_COMPRESS 0
 #define HAVE_MACH_ABSOLUTE_TIME 0
 #define HAVE_MAPVIEWOFFILE 1
 #define HAVE_MKSTEMP 0
 #define HAVE_MMAP 0
 #define HAVE_MPROTECT 0
 #define HAVE_NANOSLEEP 0
@@ -314,205 +315,215 @@
 #define HAVE_SCHED_GETAFFINITY 0
 #define HAVE_SETCONSOLETEXTATTRIBUTE 1
 #define HAVE_SETCONSOLECTRLHANDLER 1
 #define HAVE_SETMODE 1
 #define HAVE_SETRLIMIT 0
 #define HAVE_SLEEP 1
 #define HAVE_STRERROR_R 0
 #define HAVE_SYSCONF 0
+#define HAVE_SYSCTL 0
 #define HAVE_USLEEP 0
 #define HAVE_UTGETOSTYPEFROMSTRING 0
 #define HAVE_VIRTUALALLOC 1
 #define HAVE_WGLGETPROCADDRESS 0
 #define HAVE_PTHREADS 0
 #define HAVE_OS2THREADS 0
 #define HAVE_W32THREADS 1
 #define HAVE_AS_DN_DIRECTIVE 0
+#define HAVE_AS_FPU_DIRECTIVE 0
 #define HAVE_AS_FUNC 0
 #define HAVE_AS_OBJECT_ARCH 0
 #define HAVE_ASM_MOD_Q 0
 #define HAVE_ATTRIBUTE_MAY_ALIAS 0
 #define HAVE_ATTRIBUTE_PACKED 0
+#define HAVE_BLOCKS_EXTENSION 0
 #define HAVE_EBP_AVAILABLE 0
 #define HAVE_EBX_AVAILABLE 0
 #define HAVE_GNU_AS 0
 #define HAVE_GNU_WINDRES 0
 #define HAVE_IBM_ASM 0
 #define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 0
 #define HAVE_INLINE_ASM_LABELS 0
 #define HAVE_INLINE_ASM_NONLOCAL_LABELS 0
 #define HAVE_PRAGMA_DEPRECATED 1
 #define HAVE_RSYNC_CONTIMEOUT 0
 #define HAVE_SYMVER_ASM_LABEL 0
 #define HAVE_SYMVER_GNU_ASM 0
 #define HAVE_VFP_ARGS 0
 #define HAVE_XFORM_ASM 0
 #define HAVE_XMM_CLOBBERS 0
 #define HAVE_CONDITION_VARIABLE_PTR 1
+#define HAVE_KCMVIDEOCODECTYPE_HEVC 0
 #define HAVE_SOCKLEN_T 1
 #define HAVE_STRUCT_ADDRINFO 1
 #define HAVE_STRUCT_GROUP_SOURCE_REQ 1
 #define HAVE_STRUCT_IP_MREQ_SOURCE 1
 #define HAVE_STRUCT_IPV6_MREQ 1
-#define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1
+#define HAVE_STRUCT_MSGHDR_MSG_FLAGS 0
 #define HAVE_STRUCT_POLLFD 0
 #define HAVE_STRUCT_RUSAGE_RU_MAXRSS 0
 #define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
 #define HAVE_STRUCT_SOCKADDR_IN6 1
 #define HAVE_STRUCT_SOCKADDR_SA_LEN 0
 #define HAVE_STRUCT_SOCKADDR_STORAGE 1
 #define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0
 #define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0
 #define HAVE_ATOMICS_NATIVE 1
 #define HAVE_DOS_PATHS 1
-#define HAVE_DXVA2_LIB 0
-#define HAVE_DXVA2API_COBJ 1
 #define HAVE_LIBC_MSVCRT 1
-#define HAVE_LIBDC1394_1 0
-#define HAVE_LIBDC1394_2 0
 #define HAVE_MAKEINFO 1
 #define HAVE_MAKEINFO_HTML 0
 #define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
 #define HAVE_PERL 1
 #define HAVE_POD2MAN 1
-#define HAVE_SDL2 0
 #define HAVE_SECTION_DATA_REL_RO 0
 #define HAVE_TEXI2HTML 0
 #define HAVE_THREADS 1
+#define HAVE_UWP 0
 #define HAVE_VAAPI_DRM 0
 #define HAVE_VAAPI_X11 0
 #define HAVE_VDPAU_X11 0
 #define HAVE_WINRT 0
-#define HAVE_XLIB 0
-#define CONFIG_BSFS 0
-#define CONFIG_DECODERS 1
-#define CONFIG_PARSERS 1
 #define CONFIG_DOC 0
 #define CONFIG_HTMLPAGES 0
 #define CONFIG_MANPAGES 1
 #define CONFIG_PODPAGES 1
 #define CONFIG_TXTPAGES 1
 #define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
 #define CONFIG_AVIO_READING_EXAMPLE 1
-#define CONFIG_DECODING_ENCODING_EXAMPLE 0
+#define CONFIG_DECODE_AUDIO_EXAMPLE 1
+#define CONFIG_DECODE_VIDEO_EXAMPLE 1
 #define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+#define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+#define CONFIG_ENCODE_VIDEO_EXAMPLE 1
 #define CONFIG_EXTRACT_MVS_EXAMPLE 0
 #define CONFIG_FILTER_AUDIO_EXAMPLE 0
 #define CONFIG_FILTERING_AUDIO_EXAMPLE 0
 #define CONFIG_FILTERING_VIDEO_EXAMPLE 0
 #define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+#define CONFIG_HW_DECODE_EXAMPLE 0
 #define CONFIG_METADATA_EXAMPLE 0
 #define CONFIG_MUXING_EXAMPLE 0
 #define CONFIG_QSVDEC_EXAMPLE 0
 #define CONFIG_REMUXING_EXAMPLE 0
 #define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0
 #define CONFIG_SCALING_VIDEO_EXAMPLE 0
 #define CONFIG_TRANSCODE_AAC_EXAMPLE 0
 #define CONFIG_TRANSCODING_EXAMPLE 0
-#define CONFIG_AVISYNTH 0
+#define CONFIG_ALSA 0
+#define CONFIG_APPKIT 0
+#define CONFIG_AVFOUNDATION 0
 #define CONFIG_BZLIB 0
-#define CONFIG_CHROMAPRINT 0
-#define CONFIG_CRYSTALHD 0
+#define CONFIG_COREIMAGE 0
+#define CONFIG_ICONV 0
+#define CONFIG_JACK 0
+#define CONFIG_LIBXCB 0
+#define CONFIG_LIBXCB_SHM 0
+#define CONFIG_LIBXCB_SHAPE 0
+#define CONFIG_LIBXCB_XFIXES 0
+#define CONFIG_LZMA 0
+#define CONFIG_SCHANNEL 1
+#define CONFIG_SDL2 0
+#define CONFIG_SECURETRANSPORT 0
+#define CONFIG_SNDIO 0
+#define CONFIG_XLIB 1
+#define CONFIG_ZLIB 0
+#define CONFIG_AVISYNTH 0
+#define CONFIG_FREI0R 0
+#define CONFIG_LIBCDIO 0
+#define CONFIG_LIBRUBBERBAND 0
+#define CONFIG_LIBVIDSTAB 0
+#define CONFIG_LIBX264 0
+#define CONFIG_LIBX265 0
+#define CONFIG_LIBXAVS 0
+#define CONFIG_LIBXVID 0
 #define CONFIG_DECKLINK 0
-#define CONFIG_FREI0R 0
-#define CONFIG_GCRYPT 0
+#define CONFIG_LIBNDI_NEWTEK 0
+#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_OPENSSL 0
 #define CONFIG_GMP 0
+#define CONFIG_LIBOPENCORE_AMRNB 0
+#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_RKMPP 0
+#define CONFIG_LIBSMBCLIENT 0
+#define CONFIG_CHROMAPRINT 0
+#define CONFIG_GCRYPT 0
 #define CONFIG_GNUTLS 0
-#define CONFIG_ICONV 0
 #define CONFIG_JNI 0
 #define CONFIG_LADSPA 0
 #define CONFIG_LIBASS 0
 #define CONFIG_LIBBLURAY 0
 #define CONFIG_LIBBS2B 0
 #define CONFIG_LIBCACA 0
-#define CONFIG_LIBCDIO 0
 #define CONFIG_LIBCELT 0
 #define CONFIG_LIBDC1394 0
-#define CONFIG_LIBEBUR128 0
-#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_LIBDRM 0
 #define CONFIG_LIBFLITE 0
 #define CONFIG_LIBFONTCONFIG 0
 #define CONFIG_LIBFREETYPE 0
 #define CONFIG_LIBFRIBIDI 0
 #define CONFIG_LIBGME 0
 #define CONFIG_LIBGSM 0
 #define CONFIG_LIBIEC61883 0
 #define CONFIG_LIBILBC 0
 #define CONFIG_LIBKVAZAAR 0
 #define CONFIG_LIBMODPLUG 0
 #define CONFIG_LIBMP3LAME 0
-#define CONFIG_LIBNUT 0
-#define CONFIG_LIBOPENCORE_AMRNB 0
-#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBMYSOFA 0
 #define CONFIG_LIBOPENCV 0
 #define CONFIG_LIBOPENH264 0
 #define CONFIG_LIBOPENJPEG 0
 #define CONFIG_LIBOPENMPT 0
 #define CONFIG_LIBOPUS 0
 #define CONFIG_LIBPULSE 0
+#define CONFIG_LIBRSVG 0
 #define CONFIG_LIBRTMP 0
-#define CONFIG_LIBRUBBERBAND 0
-#define CONFIG_LIBSCHROEDINGER 0
 #define CONFIG_LIBSHINE 0
 #define CONFIG_LIBSMBCLIENT 0
 #define CONFIG_LIBSNAPPY 0
 #define CONFIG_LIBSOXR 0
 #define CONFIG_LIBSPEEX 0
 #define CONFIG_LIBSSH 0
 #define CONFIG_LIBTESSERACT 0
 #define CONFIG_LIBTHEORA 0
 #define CONFIG_LIBTWOLAME 0
 #define CONFIG_LIBV4L2 0
-#define CONFIG_LIBVIDSTAB 0
-#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_LIBVMAF 0
 #define CONFIG_LIBVORBIS 0
 #define CONFIG_LIBVPX 0
 #define CONFIG_LIBWAVPACK 0
 #define CONFIG_LIBWEBP 0
-#define CONFIG_LIBX264 0
-#define CONFIG_LIBX265 0
-#define CONFIG_LIBXAVS 0
-#define CONFIG_LIBXCB 0
-#define CONFIG_LIBXCB_SHM 0
-#define CONFIG_LIBXCB_SHAPE 0
-#define CONFIG_LIBXCB_XFIXES 0
-#define CONFIG_LIBXVID 0
+#define CONFIG_LIBXML2 0
 #define CONFIG_LIBZIMG 0
 #define CONFIG_LIBZMQ 0
 #define CONFIG_LIBZVBI 0
-#define CONFIG_LZMA 0
 #define CONFIG_MEDIACODEC 0
-#define CONFIG_NETCDF 0
 #define CONFIG_OPENAL 0
 #define CONFIG_OPENCL 0
 #define CONFIG_OPENGL 0
-#define CONFIG_OPENSSL 0
-#define CONFIG_SCHANNEL 1
-#define CONFIG_SDL 0
-#define CONFIG_SDL2 0
-#define CONFIG_SECURETRANSPORT 0
-#define CONFIG_VIDEOTOOLBOX 0
-#define CONFIG_X11GRAB 0
-#define CONFIG_XLIB 0
-#define CONFIG_ZLIB 0
 #define CONFIG_AUDIOTOOLBOX 0
-#define CONFIG_CUDA 0
-#define CONFIG_CUVID 0
+#define CONFIG_CRYSTALHD 0
+#define CONFIG_CUDA 1
+#define CONFIG_CUVID 1
 #define CONFIG_D3D11VA 0
 #define CONFIG_DXVA2 0
-#define CONFIG_LIBMFX 0
-#define CONFIG_LIBNPP 0
-#define CONFIG_MMAL 0
-#define CONFIG_NVENC 0
-#define CONFIG_OMX 0
+#define CONFIG_NVENC 1
 #define CONFIG_VAAPI 0
 #define CONFIG_VDA 0
 #define CONFIG_VDPAU 0
+#define CONFIG_VIDEOTOOLBOX 0
+#define CONFIG_V4L2_M2M 0
 #define CONFIG_XVMC 0
+#define CONFIG_CUDA_SDK 0
+#define CONFIG_LIBNPP 0
+#define CONFIG_LIBMFX 0
+#define CONFIG_MMAL 0
+#define CONFIG_OMX 0
 #define CONFIG_FTRAPV 0
 #define CONFIG_GRAY 0
 #define CONFIG_HARDCODED_TABLES 0
 #define CONFIG_OMX_RPI 0
 #define CONFIG_RUNTIME_CPUDETECT 1
 #define CONFIG_SAFE_BITSTREAM_READER 1
 #define CONFIG_SHARED 1
 #define CONFIG_SMALL 0
@@ -541,70 +552,86 @@
 #define CONFIG_FAST_UNALIGNED 1
 #define CONFIG_FFT 0
 #define CONFIG_LSP 0
 #define CONFIG_LZO 0
 #define CONFIG_MDCT 0
 #define CONFIG_PIXELUTILS 0
 #define CONFIG_NETWORK 0
 #define CONFIG_RDFT 0
+#define CONFIG_AUTODETECT 0
 #define CONFIG_FONTCONFIG 0
-#define CONFIG_MEMALIGN_HACK 0
+#define CONFIG_LINUX_PERF 0
 #define CONFIG_MEMORY_POISONING 0
 #define CONFIG_NEON_CLOBBER_TEST 0
+#define CONFIG_OSSFUZZ 0
 #define CONFIG_PIC 0
-#define CONFIG_POD2MAN 1
-#define CONFIG_RAISE_MAJOR 0
 #define CONFIG_THUMB 0
 #define CONFIG_VALGRIND_BACKTRACE 0
 #define CONFIG_XMM_CLOBBER_TEST 0
+#define CONFIG_BSFS 1
+#define CONFIG_DECODERS 1
+#define CONFIG_ENCODERS 0
+#define CONFIG_HWACCELS 0
+#define CONFIG_PARSERS 1
+#define CONFIG_INDEVS 0
+#define CONFIG_OUTDEVS 0
+#define CONFIG_FILTERS 0
+#define CONFIG_DEMUXERS 0
+#define CONFIG_MUXERS 0
+#define CONFIG_PROTOCOLS 0
 #define CONFIG_AANDCTTABLES 0
 #define CONFIG_AC3DSP 0
 #define CONFIG_AUDIO_FRAME_QUEUE 0
 #define CONFIG_AUDIODSP 0
 #define CONFIG_BLOCKDSP 0
 #define CONFIG_BSWAPDSP 0
 #define CONFIG_CABAC 0
 #define CONFIG_DIRAC_PARSE 0
 #define CONFIG_DVPROFILE 0
 #define CONFIG_EXIF 0
 #define CONFIG_FAANDCT 0
 #define CONFIG_FAANIDCT 0
 #define CONFIG_FDCTDSP 0
 #define CONFIG_FLACDSP 1
 #define CONFIG_FMTCONVERT 0
+#define CONFIG_FRAME_THREAD_ENCODER 0
 #define CONFIG_G722DSP 0
-#define CONFIG_GOLOMB 1
+#define CONFIG_GOLOMB 0
 #define CONFIG_GPLV3 0
 #define CONFIG_H263DSP 0
 #define CONFIG_H264CHROMA 0
 #define CONFIG_H264DSP 0
+#define CONFIG_H264PARSE 0
 #define CONFIG_H264PRED 1
 #define CONFIG_H264QPEL 0
+#define CONFIG_HEVCPARSE 0
 #define CONFIG_HPELDSP 0
 #define CONFIG_HUFFMAN 0
 #define CONFIG_HUFFYUVDSP 0
 #define CONFIG_HUFFYUVENCDSP 0
 #define CONFIG_IDCTDSP 0
 #define CONFIG_IIRFILTER 0
-#define CONFIG_IMDCT15 0
+#define CONFIG_MDCT15 0
 #define CONFIG_INTRAX8 0
 #define CONFIG_ISO_MEDIA 0
 #define CONFIG_IVIDSP 0
 #define CONFIG_JPEGTABLES 0
 #define CONFIG_LGPLV3 0
 #define CONFIG_LIBX262 0
 #define CONFIG_LLAUDDSP 0
 #define CONFIG_LLVIDDSP 0
+#define CONFIG_LLVIDENCDSP 0
 #define CONFIG_LPC 0
 #define CONFIG_LZF 0
 #define CONFIG_ME_CMP 0
 #define CONFIG_MPEG_ER 0
 #define CONFIG_MPEGAUDIO 0
 #define CONFIG_MPEGAUDIODSP 0
+#define CONFIG_MPEGAUDIOHEADER 0
 #define CONFIG_MPEGVIDEO 0
 #define CONFIG_MPEGVIDEOENC 0
 #define CONFIG_MSS34DSP 0
 #define CONFIG_PIXBLOCKDSP 0
 #define CONFIG_QPELDSP 0
 #define CONFIG_QSV 0
 #define CONFIG_QSVDEC 0
 #define CONFIG_QSVENC 0
@@ -616,23 +643,23 @@
 #define CONFIG_RV34DSP 0
 #define CONFIG_SINEWIN 0
 #define CONFIG_SNAPPY 0
 #define CONFIG_SRTP 0
 #define CONFIG_STARTCODE 0
 #define CONFIG_TEXTUREDSP 0
 #define CONFIG_TEXTUREDSPENC 0
 #define CONFIG_TPELDSP 0
+#define CONFIG_VAAPI_1 0
 #define CONFIG_VAAPI_ENCODE 0
 #define CONFIG_VC1DSP 0
 #define CONFIG_VIDEODSP 1
 #define CONFIG_VP3DSP 0
 #define CONFIG_VP56DSP 0
 #define CONFIG_VP8DSP 1
-#define CONFIG_VT_BT2020 0
 #define CONFIG_WMA_FREQS 0
 #define CONFIG_WMV2DSP 0
 #define CONFIG_NULL_BSF 1
 #define CONFIG_VP8_DECODER 1
 #define CONFIG_VP9_DECODER 1
 #define CONFIG_FLAC_DECODER 1
 #define CONFIG_FLAC_PARSER 0
 #define CONFIG_VP8_PARSER 1
--- a/media/ffvpx/config_win64.asm
+++ b/media/ffvpx/config_win64.asm
@@ -58,18 +58,18 @@
 %define HAVE_MIPS32R2 0
 %define HAVE_MIPS32R5 0
 %define HAVE_MIPS64R2 0
 %define HAVE_MIPS32R6 0
 %define HAVE_MIPS64R6 0
 %define HAVE_MIPSDSP 0
 %define HAVE_MIPSDSPR2 0
 %define HAVE_MSA 0
-%define HAVE_LOONGSON2 1
-%define HAVE_LOONGSON3 1
+%define HAVE_LOONGSON2 0
+%define HAVE_LOONGSON3 0
 %define HAVE_MMI 0
 %define HAVE_ARMV5TE_EXTERNAL 0
 %define HAVE_ARMV6_EXTERNAL 0
 %define HAVE_ARMV6T2_EXTERNAL 0
 %define HAVE_ARMV8_EXTERNAL 0
 %define HAVE_NEON_EXTERNAL 0
 %define HAVE_VFP_EXTERNAL 0
 %define HAVE_VFPV3_EXTERNAL 0
@@ -157,65 +157,67 @@
 %define HAVE_ALIGNED_STACK 1
 %define HAVE_FAST_64BIT 1
 %define HAVE_FAST_CLZ 0
 %define HAVE_FAST_CMOV 1
 %define HAVE_LOCAL_ALIGNED_8 1
 %define HAVE_LOCAL_ALIGNED_16 1
 %define HAVE_LOCAL_ALIGNED_32 1
 %define HAVE_SIMD_ALIGN_16 1
+%define HAVE_SIMD_ALIGN_32 1
 %define HAVE_ATOMICS_GCC 0
 %define HAVE_ATOMICS_SUNCC 0
 %define HAVE_ATOMICS_WIN32 1
 %define HAVE_ATOMIC_CAS_PTR 0
-%define HAVE_ATOMIC_COMPARE_EXCHANGE 0
 %define HAVE_MACHINE_RW_BARRIER 0
 %define HAVE_MEMORYBARRIER 1
 %define HAVE_MM_EMPTY 0
 %define HAVE_RDTSC 1
 %define HAVE_SARESTART 0
-%define HAVE_SEM_TIMEDWAIT 1
+%define HAVE_SEM_TIMEDWAIT 0
 %define HAVE_SYNC_VAL_COMPARE_AND_SWAP 0
 %define HAVE_CABS 0
 %define HAVE_CEXP 0
 %define HAVE_INLINE_ASM 0
 %define HAVE_SYMVER 0
-%define HAVE_YASM 1
+%define HAVE_X86ASM 1
 %define HAVE_BIGENDIAN 0
 %define HAVE_FAST_UNALIGNED 1
-%define HAVE_ALSA_ASOUNDLIB_H 0
 %define HAVE_ALTIVEC_H 0
 %define HAVE_ARPA_INET_H 0
 %define HAVE_ASM_TYPES_H 0
 %define HAVE_CDIO_PARANOIA_H 0
 %define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+%define HAVE_CUDA_H 0
+%define HAVE_D3D11_H 1
 %define HAVE_DISPATCH_DISPATCH_H 0
 %define HAVE_DEV_BKTR_IOCTL_BT848_H 0
 %define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
 %define HAVE_DEV_IC_BT8XX_H 0
 %define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0
 %define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0
 %define HAVE_DIRECT_H 1
 %define HAVE_DIRENT_H 0
 %define HAVE_DLFCN_H 0
-%define HAVE_D3D11_H 1
+%define HAVE_DXGIDEBUG_H 1
 %define HAVE_DXVA_H 1
 %define HAVE_ES2_GL_H 0
 %define HAVE_GSM_H 0
 %define HAVE_IO_H 1
 %define HAVE_MACH_MACH_TIME_H 0
 %define HAVE_MACHINE_IOCTL_BT848_H 0
 %define HAVE_MACHINE_IOCTL_METEOR_H 0
 %define HAVE_OPENCV2_CORE_CORE_C_H 0
+%define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+%define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
 %define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
 %define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
 %define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
 %define HAVE_OPENGL_GL3_H 0
 %define HAVE_POLL_H 0
-%define HAVE_SNDIO_H 0
 %define HAVE_SOUNDCARD_H 0
 %define HAVE_STDATOMIC_H 0
 %define HAVE_SYS_MMAN_H 0
 %define HAVE_SYS_PARAM_H 0
 %define HAVE_SYS_RESOURCE_H 0
 %define HAVE_SYS_SELECT_H 0
 %define HAVE_SYS_SOUNDCARD_H 0
 %define HAVE_SYS_TIME_H 0
@@ -259,17 +261,16 @@
 %define HAVE_TRUNCF 1
 %define HAVE_ACCESS 1
 %define HAVE_ALIGNED_MALLOC 1
 %define HAVE_CLOCK_GETTIME 0
 %define HAVE_CLOSESOCKET 1
 %define HAVE_COMMANDLINETOARGVW 1
 %define HAVE_COTASKMEMFREE 1
 %define HAVE_CRYPTGENRANDOM 1
-%define HAVE_DLOPEN 0
 %define HAVE_FCNTL 0
 %define HAVE_FLT_LIM 1
 %define HAVE_FORK 0
 %define HAVE_GETADDRINFO 1
 %define HAVE_GETHRTIME 0
 %define HAVE_GETOPT 0
 %define HAVE_GETPROCESSAFFINITYMASK 1
 %define HAVE_GETPROCESSMEMORYINFO 1
@@ -279,17 +280,17 @@
 %define HAVE_GETTIMEOFDAY 0
 %define HAVE_GLOB 0
 %define HAVE_GLXGETPROCADDRESS 0
 %define HAVE_GMTIME_R 0
 %define HAVE_INET_ATON 0
 %define HAVE_ISATTY 1
 %define HAVE_JACK_PORT_GET_LATENCY_RANGE 0
 %define HAVE_KBHIT 1
-%define HAVE_LOADLIBRARY 0
+%define HAVE_LOADLIBRARY 1
 %define HAVE_LSTAT 0
 %define HAVE_LZO1X_999_COMPRESS 0
 %define HAVE_MACH_ABSOLUTE_TIME 0
 %define HAVE_MAPVIEWOFFILE 1
 %define HAVE_MKSTEMP 0
 %define HAVE_MMAP 0
 %define HAVE_MPROTECT 0
 %define HAVE_NANOSLEEP 0
@@ -307,197 +308,206 @@
 %define HAVE_USLEEP 0
 %define HAVE_UTGETOSTYPEFROMSTRING 0
 %define HAVE_VIRTUALALLOC 1
 %define HAVE_WGLGETPROCADDRESS 0
 %define HAVE_PTHREADS 0
 %define HAVE_OS2THREADS 0
 %define HAVE_W32THREADS 1
 %define HAVE_AS_DN_DIRECTIVE 0
+%define HAVE_AS_FPU_DIRECTIVE 0
 %define HAVE_AS_FUNC 0
 %define HAVE_AS_OBJECT_ARCH 0
 %define HAVE_ASM_MOD_Q 0
 %define HAVE_ATTRIBUTE_MAY_ALIAS 0
 %define HAVE_ATTRIBUTE_PACKED 0
+%define HAVE_BLOCKS_EXTENSION 0
 %define HAVE_EBP_AVAILABLE 0
 %define HAVE_EBX_AVAILABLE 0
 %define HAVE_GNU_AS 0
 %define HAVE_GNU_WINDRES 0
 %define HAVE_IBM_ASM 0
 %define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 0
 %define HAVE_INLINE_ASM_LABELS 0
 %define HAVE_INLINE_ASM_NONLOCAL_LABELS 0
 %define HAVE_PRAGMA_DEPRECATED 1
 %define HAVE_RSYNC_CONTIMEOUT 0
 %define HAVE_SYMVER_ASM_LABEL 0
 %define HAVE_SYMVER_GNU_ASM 0
 %define HAVE_VFP_ARGS 0
 %define HAVE_XFORM_ASM 0
 %define HAVE_XMM_CLOBBERS 0
 %define HAVE_CONDITION_VARIABLE_PTR 1
+%define HAVE_KCMVIDEOCODECTYPE_HEVC 0
 %define HAVE_SOCKLEN_T 1
 %define HAVE_STRUCT_ADDRINFO 1
 %define HAVE_STRUCT_GROUP_SOURCE_REQ 1
 %define HAVE_STRUCT_IP_MREQ_SOURCE 1
 %define HAVE_STRUCT_IPV6_MREQ 1
-%define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1
+%define HAVE_STRUCT_MSGHDR_MSG_FLAGS 0
 %define HAVE_STRUCT_POLLFD 0
 %define HAVE_STRUCT_RUSAGE_RU_MAXRSS 0
 %define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
 %define HAVE_STRUCT_SOCKADDR_IN6 1
 %define HAVE_STRUCT_SOCKADDR_SA_LEN 0
 %define HAVE_STRUCT_SOCKADDR_STORAGE 1
 %define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0
 %define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0
 %define HAVE_ATOMICS_NATIVE 1
 %define HAVE_DOS_PATHS 1
-%define HAVE_DXVA2_LIB 0
-%define HAVE_DXVA2API_COBJ 1
 %define HAVE_LIBC_MSVCRT 1
-%define HAVE_LIBDC1394_1 0
-%define HAVE_LIBDC1394_2 0
 %define HAVE_MAKEINFO 1
 %define HAVE_MAKEINFO_HTML 0
 %define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
 %define HAVE_PERL 1
 %define HAVE_POD2MAN 1
-%define HAVE_SDL2 0
 %define HAVE_SECTION_DATA_REL_RO 0
 %define HAVE_TEXI2HTML 0
 %define HAVE_THREADS 1
+%define HAVE_UWP 0
 %define HAVE_VAAPI_DRM 0
 %define HAVE_VAAPI_X11 0
 %define HAVE_VDPAU_X11 0
 %define HAVE_WINRT 0
-%define HAVE_XLIB 0
-%define CONFIG_BSFS 0
-%define CONFIG_DECODERS 1
-%define CONFIG_PARSERS 1
 %define CONFIG_DOC 0
 %define CONFIG_HTMLPAGES 0
 %define CONFIG_MANPAGES 1
 %define CONFIG_PODPAGES 1
 %define CONFIG_TXTPAGES 1
 %define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
 %define CONFIG_AVIO_READING_EXAMPLE 1
-%define CONFIG_DECODING_ENCODING_EXAMPLE 0
+%define CONFIG_DECODE_AUDIO_EXAMPLE 1
+%define CONFIG_DECODE_VIDEO_EXAMPLE 1
 %define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+%define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+%define CONFIG_ENCODE_VIDEO_EXAMPLE 1
 %define CONFIG_EXTRACT_MVS_EXAMPLE 0
 %define CONFIG_FILTER_AUDIO_EXAMPLE 0
 %define CONFIG_FILTERING_AUDIO_EXAMPLE 0
 %define CONFIG_FILTERING_VIDEO_EXAMPLE 0
 %define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+%define CONFIG_HW_DECODE_EXAMPLE 0
 %define CONFIG_METADATA_EXAMPLE 0
 %define CONFIG_MUXING_EXAMPLE 0
 %define CONFIG_QSVDEC_EXAMPLE 0
 %define CONFIG_REMUXING_EXAMPLE 0
 %define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0
 %define CONFIG_SCALING_VIDEO_EXAMPLE 0
 %define CONFIG_TRANSCODE_AAC_EXAMPLE 0
 %define CONFIG_TRANSCODING_EXAMPLE 0
-%define CONFIG_AVISYNTH 0
+%define CONFIG_ALSA 0
+%define CONFIG_APPKIT 0
+%define CONFIG_AVFOUNDATION 0
 %define CONFIG_BZLIB 0
-%define CONFIG_CHROMAPRINT 0
-%define CONFIG_CRYSTALHD 0
+%define CONFIG_COREIMAGE 0
+%define CONFIG_ICONV 0
+%define CONFIG_JACK 0
+%define CONFIG_LIBXCB 0
+%define CONFIG_LIBXCB_SHM 0
+%define CONFIG_LIBXCB_SHAPE 0
+%define CONFIG_LIBXCB_XFIXES 0
+%define CONFIG_LZMA 0
+%define CONFIG_SCHANNEL 1
+%define CONFIG_SDL2 0
+%define CONFIG_SECURETRANSPORT 0
+%define CONFIG_SNDIO 0
+%define CONFIG_XLIB 1
+%define CONFIG_ZLIB 0
+%define CONFIG_AVISYNTH 0
+%define CONFIG_FREI0R 0
+%define CONFIG_LIBCDIO 0
+%define CONFIG_LIBRUBBERBAND 0
+%define CONFIG_LIBVIDSTAB 0
+%define CONFIG_LIBX264 0
+%define CONFIG_LIBX265 0
+%define CONFIG_LIBXAVS 0
+%define CONFIG_LIBXVID 0
 %define CONFIG_DECKLINK 0
-%define CONFIG_FREI0R 0
-%define CONFIG_GCRYPT 0
+%define CONFIG_LIBNDI_NEWTEK 0
+%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_OPENSSL 0
 %define CONFIG_GMP 0
+%define CONFIG_LIBOPENCORE_AMRNB 0
+%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_RKMPP 0
+%define CONFIG_LIBSMBCLIENT 0
+%define CONFIG_CHROMAPRINT 0
+%define CONFIG_GCRYPT 0
 %define CONFIG_GNUTLS 0
-%define CONFIG_ICONV 0
 %define CONFIG_JNI 0
 %define CONFIG_LADSPA 0
 %define CONFIG_LIBASS 0
 %define CONFIG_LIBBLURAY 0
 %define CONFIG_LIBBS2B 0
 %define CONFIG_LIBCACA 0
-%define CONFIG_LIBCDIO 0
 %define CONFIG_LIBCELT 0
 %define CONFIG_LIBDC1394 0
-%define CONFIG_LIBEBUR128 0
-%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_LIBDRM 0
 %define CONFIG_LIBFLITE 0
 %define CONFIG_LIBFONTCONFIG 0
 %define CONFIG_LIBFREETYPE 0
 %define CONFIG_LIBFRIBIDI 0
 %define CONFIG_LIBGME 0
 %define CONFIG_LIBGSM 0
 %define CONFIG_LIBIEC61883 0
 %define CONFIG_LIBILBC 0
 %define CONFIG_LIBKVAZAAR 0
 %define CONFIG_LIBMODPLUG 0
 %define CONFIG_LIBMP3LAME 0
-%define CONFIG_LIBNUT 0
-%define CONFIG_LIBOPENCORE_AMRNB 0
-%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBMYSOFA 0
 %define CONFIG_LIBOPENCV 0
 %define CONFIG_LIBOPENH264 0
 %define CONFIG_LIBOPENJPEG 0
 %define CONFIG_LIBOPENMPT 0
 %define CONFIG_LIBOPUS 0
 %define CONFIG_LIBPULSE 0
+%define CONFIG_LIBRSVG 0
 %define CONFIG_LIBRTMP 0
-%define CONFIG_LIBRUBBERBAND 0
-%define CONFIG_LIBSCHROEDINGER 0
 %define CONFIG_LIBSHINE 0
 %define CONFIG_LIBSMBCLIENT 0
 %define CONFIG_LIBSNAPPY 0
 %define CONFIG_LIBSOXR 0
 %define CONFIG_LIBSPEEX 0
 %define CONFIG_LIBSSH 0
 %define CONFIG_LIBTESSERACT 0
 %define CONFIG_LIBTHEORA 0
 %define CONFIG_LIBTWOLAME 0
 %define CONFIG_LIBV4L2 0
-%define CONFIG_LIBVIDSTAB 0
-%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_LIBVMAF 0
 %define CONFIG_LIBVORBIS 0
 %define CONFIG_LIBVPX 0
 %define CONFIG_LIBWAVPACK 0
 %define CONFIG_LIBWEBP 0
-%define CONFIG_LIBX264 0
-%define CONFIG_LIBX265 0
-%define CONFIG_LIBXAVS 0
-%define CONFIG_LIBXCB 0
-%define CONFIG_LIBXCB_SHM 0
-%define CONFIG_LIBXCB_SHAPE 0
-%define CONFIG_LIBXCB_XFIXES 0
-%define CONFIG_LIBXVID 0
+%define CONFIG_LIBXML2 0
 %define CONFIG_LIBZIMG 0
 %define CONFIG_LIBZMQ 0
 %define CONFIG_LIBZVBI 0
-%define CONFIG_LZMA 0
 %define CONFIG_MEDIACODEC 0
-%define CONFIG_NETCDF 0
 %define CONFIG_OPENAL 0
 %define CONFIG_OPENCL 0
 %define CONFIG_OPENGL 0
-%define CONFIG_OPENSSL 0
-%define CONFIG_SCHANNEL 1
-%define CONFIG_SDL 0
-%define CONFIG_SDL2 0
-%define CONFIG_SECURETRANSPORT 0
-%define CONFIG_VIDEOTOOLBOX 0
-%define CONFIG_X11GRAB 0
-%define CONFIG_XLIB 0
-%define CONFIG_ZLIB 0
 %define CONFIG_AUDIOTOOLBOX 0
-%define CONFIG_CUDA 0
-%define CONFIG_CUVID 0
+%define CONFIG_CRYSTALHD 0
+%define CONFIG_CUDA 1
+%define CONFIG_CUVID 1
 %define CONFIG_D3D11VA 0
 %define CONFIG_DXVA2 0
-%define CONFIG_LIBMFX 0
-%define CONFIG_LIBNPP 0
-%define CONFIG_MMAL 0
-%define CONFIG_NVENC 0
-%define CONFIG_OMX 0
+%define CONFIG_NVENC 1
 %define CONFIG_VAAPI 0
 %define CONFIG_VDA 0
 %define CONFIG_VDPAU 0
+%define CONFIG_VIDEOTOOLBOX 0
+%define CONFIG_V4L2_M2M 0
 %define CONFIG_XVMC 0
+%define CONFIG_CUDA_SDK 0
+%define CONFIG_LIBNPP 0
+%define CONFIG_LIBMFX 0
+%define CONFIG_MMAL 0
+%define CONFIG_OMX 0
 %define CONFIG_FTRAPV 0
 %define CONFIG_GRAY 0
 %define CONFIG_HARDCODED_TABLES 0
 %define CONFIG_OMX_RPI 0
 %define CONFIG_RUNTIME_CPUDETECT 1
 %define CONFIG_SAFE_BITSTREAM_READER 1
 %define CONFIG_SHARED 1
 %define CONFIG_SMALL 0
@@ -526,70 +536,86 @@
 %define CONFIG_FAST_UNALIGNED 1
 %define CONFIG_FFT 0
 %define CONFIG_LSP 0
 %define CONFIG_LZO 0
 %define CONFIG_MDCT 0
 %define CONFIG_PIXELUTILS 0
 %define CONFIG_NETWORK 0
 %define CONFIG_RDFT 0
+%define CONFIG_AUTODETECT 0
 %define CONFIG_FONTCONFIG 0
-%define CONFIG_MEMALIGN_HACK 0
+%define CONFIG_LINUX_PERF 0
 %define CONFIG_MEMORY_POISONING 0
 %define CONFIG_NEON_CLOBBER_TEST 0
+%define CONFIG_OSSFUZZ 0
 %define CONFIG_PIC 1
-%define CONFIG_POD2MAN 1
-%define CONFIG_RAISE_MAJOR 0
 %define CONFIG_THUMB 0
 %define CONFIG_VALGRIND_BACKTRACE 0
 %define CONFIG_XMM_CLOBBER_TEST 0
+%define CONFIG_BSFS 1
+%define CONFIG_DECODERS 1
+%define CONFIG_ENCODERS 0
+%define CONFIG_HWACCELS 0
+%define CONFIG_PARSERS 1
+%define CONFIG_INDEVS 0
+%define CONFIG_OUTDEVS 0
+%define CONFIG_FILTERS 0
+%define CONFIG_DEMUXERS 0
+%define CONFIG_MUXERS 0
+%define CONFIG_PROTOCOLS 0
 %define CONFIG_AANDCTTABLES 0
 %define CONFIG_AC3DSP 0
 %define CONFIG_AUDIO_FRAME_QUEUE 0
 %define CONFIG_AUDIODSP 0
 %define CONFIG_BLOCKDSP 0
 %define CONFIG_BSWAPDSP 0
 %define CONFIG_CABAC 0
 %define CONFIG_DIRAC_PARSE 0
 %define CONFIG_DVPROFILE 0
 %define CONFIG_EXIF 0
 %define CONFIG_FAANDCT 0
 %define CONFIG_FAANIDCT 0
 %define CONFIG_FDCTDSP 0
 %define CONFIG_FLACDSP 1
 %define CONFIG_FMTCONVERT 0
+%define CONFIG_FRAME_THREAD_ENCODER 0
 %define CONFIG_G722DSP 0
-%define CONFIG_GOLOMB 1
+%define CONFIG_GOLOMB 0
 %define CONFIG_GPLV3 0
 %define CONFIG_H263DSP 0
 %define CONFIG_H264CHROMA 0
 %define CONFIG_H264DSP 0
+%define CONFIG_H264PARSE 0
 %define CONFIG_H264PRED 1
 %define CONFIG_H264QPEL 0
+%define CONFIG_HEVCPARSE 0
 %define CONFIG_HPELDSP 0
 %define CONFIG_HUFFMAN 0
 %define CONFIG_HUFFYUVDSP 0
 %define CONFIG_HUFFYUVENCDSP 0
 %define CONFIG_IDCTDSP 0
 %define CONFIG_IIRFILTER 0
-%define CONFIG_IMDCT15 0
+%define CONFIG_MDCT15 0
 %define CONFIG_INTRAX8 0
 %define CONFIG_ISO_MEDIA 0
 %define CONFIG_IVIDSP 0
 %define CONFIG_JPEGTABLES 0
 %define CONFIG_LGPLV3 0
 %define CONFIG_LIBX262 0
 %define CONFIG_LLAUDDSP 0
 %define CONFIG_LLVIDDSP 0
+%define CONFIG_LLVIDENCDSP 0
 %define CONFIG_LPC 0
 %define CONFIG_LZF 0
 %define CONFIG_ME_CMP 0
 %define CONFIG_MPEG_ER 0
 %define CONFIG_MPEGAUDIO 0
 %define CONFIG_MPEGAUDIODSP 0
+%define CONFIG_MPEGAUDIOHEADER 0
 %define CONFIG_MPEGVIDEO 0
 %define CONFIG_MPEGVIDEOENC 0
 %define CONFIG_MSS34DSP 0
 %define CONFIG_PIXBLOCKDSP 0
 %define CONFIG_QPELDSP 0
 %define CONFIG_QSV 0
 %define CONFIG_QSVDEC 0
 %define CONFIG_QSVENC 0
@@ -601,23 +627,23 @@
 %define CONFIG_RV34DSP 0
 %define CONFIG_SINEWIN 0
 %define CONFIG_SNAPPY 0
 %define CONFIG_SRTP 0
 %define CONFIG_STARTCODE 0
 %define CONFIG_TEXTUREDSP 0
 %define CONFIG_TEXTUREDSPENC 0
 %define CONFIG_TPELDSP 0
+%define CONFIG_VAAPI_1 0
 %define CONFIG_VAAPI_ENCODE 0
 %define CONFIG_VC1DSP 0
 %define CONFIG_VIDEODSP 1
 %define CONFIG_VP3DSP 0
 %define CONFIG_VP56DSP 0
 %define CONFIG_VP8DSP 1
-%define CONFIG_VT_BT2020 0
 %define CONFIG_WMA_FREQS 0
 %define CONFIG_WMV2DSP 0
 %define CONFIG_NULL_BSF 1
 %define CONFIG_VP8_DECODER 1
 %define CONFIG_VP9_DECODER 1
 %define CONFIG_FLAC_DECODER 1
 %define CONFIG_FLAC_PARSER 0
 %define CONFIG_VP8_PARSER 1
--- a/media/ffvpx/config_win64.h
+++ b/media/ffvpx/config_win64.h
@@ -1,17 +1,17 @@
 /* Automatically generated by configure - do not modify! */
 #ifndef FFMPEG_CONFIG_H
 #define FFMPEG_CONFIG_H
-#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-asm --enable-yasm --toolchain=msvc"
+#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --disable-videotoolbox --enable-decoder=flac --enable-asm --enable-yasm --toolchain=msvc"
 #define FFMPEG_LICENSE "LGPL version 2.1 or later"
-#define CONFIG_THIS_YEAR 2016
+#define CONFIG_THIS_YEAR 2017
 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg"
 #define AVCONV_DATADIR "/usr/local/share/ffmpeg"
-#define CC_IDENT "Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64"
+#define CC_IDENT "Microsoft (R) C/C++ Optimizing Compiler Version 19.11.25508.2 for x64"
 #define av_restrict __restrict
 #define EXTERN_PREFIX ""
 #define EXTERN_ASM
 #define BUILDSUF ""
 #define SLIBSUF ".dll"
 #define HAVE_MMX2 HAVE_MMXEXT
 #define SWS_MAX_FILTER_SIZE 256
 #define ARCH_AARCH64 0
@@ -74,18 +74,18 @@
 #define HAVE_MIPS32R2 0
 #define HAVE_MIPS32R5 0
 #define HAVE_MIPS64R2 0
 #define HAVE_MIPS32R6 0
 #define HAVE_MIPS64R6 0
 #define HAVE_MIPSDSP 0
 #define HAVE_MIPSDSPR2 0
 #define HAVE_MSA 0
-#define HAVE_LOONGSON2 1
-#define HAVE_LOONGSON3 1
+#define HAVE_LOONGSON2 0
+#define HAVE_LOONGSON3 0
 #define HAVE_MMI 0
 #define HAVE_ARMV5TE_EXTERNAL 0
 #define HAVE_ARMV6_EXTERNAL 0
 #define HAVE_ARMV6T2_EXTERNAL 0
 #define HAVE_ARMV8_EXTERNAL 0
 #define HAVE_NEON_EXTERNAL 0
 #define HAVE_VFP_EXTERNAL 0
 #define HAVE_VFPV3_EXTERNAL 0
@@ -173,65 +173,67 @@
 #define HAVE_ALIGNED_STACK 1
 #define HAVE_FAST_64BIT 1
 #define HAVE_FAST_CLZ 0
 #define HAVE_FAST_CMOV 1
 #define HAVE_LOCAL_ALIGNED_8 1
 #define HAVE_LOCAL_ALIGNED_16 1
 #define HAVE_LOCAL_ALIGNED_32 1
 #define HAVE_SIMD_ALIGN_16 1
+#define HAVE_SIMD_ALIGN_32 1
 #define HAVE_ATOMICS_GCC 0
 #define HAVE_ATOMICS_SUNCC 0
 #define HAVE_ATOMICS_WIN32 1
 #define HAVE_ATOMIC_CAS_PTR 0
-#define HAVE_ATOMIC_COMPARE_EXCHANGE 0
 #define HAVE_MACHINE_RW_BARRIER 0
 #define HAVE_MEMORYBARRIER 1
 #define HAVE_MM_EMPTY 0
 #define HAVE_RDTSC 1
 #define HAVE_SARESTART 0
-#define HAVE_SEM_TIMEDWAIT 1
+#define HAVE_SEM_TIMEDWAIT 0
 #define HAVE_SYNC_VAL_COMPARE_AND_SWAP 0
 #define HAVE_CABS 0
 #define HAVE_CEXP 0
 #define HAVE_INLINE_ASM 0
 #define HAVE_SYMVER 0
-#define HAVE_YASM 1
+#define HAVE_X86ASM 1
 #define HAVE_BIGENDIAN 0
 #define HAVE_FAST_UNALIGNED 1
-#define HAVE_ALSA_ASOUNDLIB_H 0
 #define HAVE_ALTIVEC_H 0
 #define HAVE_ARPA_INET_H 0
 #define HAVE_ASM_TYPES_H 0
 #define HAVE_CDIO_PARANOIA_H 0
 #define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+#define HAVE_CUDA_H 0
+#define HAVE_D3D11_H 1
 #define HAVE_DISPATCH_DISPATCH_H 0
 #define HAVE_DEV_BKTR_IOCTL_BT848_H 0
 #define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
 #define HAVE_DEV_IC_BT8XX_H 0
 #define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0
 #define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0
 #define HAVE_DIRECT_H 1
 #define HAVE_DIRENT_H 0
 #define HAVE_DLFCN_H 0
-#define HAVE_D3D11_H 1
+#define HAVE_DXGIDEBUG_H 1
 #define HAVE_DXVA_H 1
 #define HAVE_ES2_GL_H 0
 #define HAVE_GSM_H 0
 #define HAVE_IO_H 1
 #define HAVE_MACH_MACH_TIME_H 0
 #define HAVE_MACHINE_IOCTL_BT848_H 0
 #define HAVE_MACHINE_IOCTL_METEOR_H 0
 #define HAVE_OPENCV2_CORE_CORE_C_H 0
+#define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+#define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
 #define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
 #define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
 #define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
 #define HAVE_OPENGL_GL3_H 0
 #define HAVE_POLL_H 0
-#define HAVE_SNDIO_H 0
 #define HAVE_SOUNDCARD_H 0
 #define HAVE_STDATOMIC_H 0
 #define HAVE_SYS_MMAN_H 0
 #define HAVE_SYS_PARAM_H 0
 #define HAVE_SYS_RESOURCE_H 0
 #define HAVE_SYS_SELECT_H 0
 #define HAVE_SYS_SOUNDCARD_H 0
 #define HAVE_SYS_TIME_H 0
@@ -275,17 +277,16 @@
 #define HAVE_TRUNCF 1
 #define HAVE_ACCESS 1
 #define HAVE_ALIGNED_MALLOC 1
 #define HAVE_CLOCK_GETTIME 0
 #define HAVE_CLOSESOCKET 1
 #define HAVE_COMMANDLINETOARGVW 1
 #define HAVE_COTASKMEMFREE 1
 #define HAVE_CRYPTGENRANDOM 1
-#define HAVE_DLOPEN 0
 #define HAVE_FCNTL 0
 #define HAVE_FLT_LIM 1
 #define HAVE_FORK 0
 #define HAVE_GETADDRINFO 1
 #define HAVE_GETHRTIME 0
 #define HAVE_GETOPT 0
 #define HAVE_GETPROCESSAFFINITYMASK 1
 #define HAVE_GETPROCESSMEMORYINFO 1
@@ -295,17 +296,17 @@
 #define HAVE_GETTIMEOFDAY 0
 #define HAVE_GLOB 0
 #define HAVE_GLXGETPROCADDRESS 0
 #define HAVE_GMTIME_R 0
 #define HAVE_INET_ATON 0
 #define HAVE_ISATTY 1
 #define HAVE_JACK_PORT_GET_LATENCY_RANGE 0
 #define HAVE_KBHIT 1
-#define HAVE_LOADLIBRARY 0
+#define HAVE_LOADLIBRARY 1
 #define HAVE_LSTAT 0
 #define HAVE_LZO1X_999_COMPRESS 0
 #define HAVE_MACH_ABSOLUTE_TIME 0
 #define HAVE_MAPVIEWOFFILE 1
 #define HAVE_MKSTEMP 0
 #define HAVE_MMAP 0
 #define HAVE_MPROTECT 0
 #define HAVE_NANOSLEEP 0
@@ -322,197 +323,206 @@
 #define HAVE_USLEEP 0
 #define HAVE_UTGETOSTYPEFROMSTRING 0
 #define HAVE_VIRTUALALLOC 1
 #define HAVE_WGLGETPROCADDRESS 0
 #define HAVE_PTHREADS 0
 #define HAVE_OS2THREADS 0
 #define HAVE_W32THREADS 1
 #define HAVE_AS_DN_DIRECTIVE 0
+#define HAVE_AS_FPU_DIRECTIVE 0
 #define HAVE_AS_FUNC 0
 #define HAVE_AS_OBJECT_ARCH 0
 #define HAVE_ASM_MOD_Q 0
 #define HAVE_ATTRIBUTE_MAY_ALIAS 0
 #define HAVE_ATTRIBUTE_PACKED 0
+#define HAVE_BLOCKS_EXTENSION 0
 #define HAVE_EBP_AVAILABLE 0
 #define HAVE_EBX_AVAILABLE 0
 #define HAVE_GNU_AS 0
 #define HAVE_GNU_WINDRES 0
 #define HAVE_IBM_ASM 0
 #define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 0
 #define HAVE_INLINE_ASM_LABELS 0
 #define HAVE_INLINE_ASM_NONLOCAL_LABELS 0
 #define HAVE_PRAGMA_DEPRECATED 1
 #define HAVE_RSYNC_CONTIMEOUT 0
 #define HAVE_SYMVER_ASM_LABEL 0
 #define HAVE_SYMVER_GNU_ASM 0
 #define HAVE_VFP_ARGS 0
 #define HAVE_XFORM_ASM 0
 #define HAVE_XMM_CLOBBERS 0
 #define HAVE_CONDITION_VARIABLE_PTR 1
+#define HAVE_KCMVIDEOCODECTYPE_HEVC 0
 #define HAVE_SOCKLEN_T 1
 #define HAVE_STRUCT_ADDRINFO 1
 #define HAVE_STRUCT_GROUP_SOURCE_REQ 1
 #define HAVE_STRUCT_IP_MREQ_SOURCE 1
 #define HAVE_STRUCT_IPV6_MREQ 1
-#define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1
+#define HAVE_STRUCT_MSGHDR_MSG_FLAGS 0
 #define HAVE_STRUCT_POLLFD 0
 #define HAVE_STRUCT_RUSAGE_RU_MAXRSS 0
 #define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
 #define HAVE_STRUCT_SOCKADDR_IN6 1
 #define HAVE_STRUCT_SOCKADDR_SA_LEN 0
 #define HAVE_STRUCT_SOCKADDR_STORAGE 1
 #define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0
 #define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0
 #define HAVE_ATOMICS_NATIVE 1
 #define HAVE_DOS_PATHS 1
-#define HAVE_DXVA2_LIB 0
-#define HAVE_DXVA2API_COBJ 1
 #define HAVE_LIBC_MSVCRT 1
-#define HAVE_LIBDC1394_1 0
-#define HAVE_LIBDC1394_2 0
 #define HAVE_MAKEINFO 1
 #define HAVE_MAKEINFO_HTML 0
 #define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
 #define HAVE_PERL 1
 #define HAVE_POD2MAN 1
-#define HAVE_SDL2 0
 #define HAVE_SECTION_DATA_REL_RO 0
 #define HAVE_TEXI2HTML 0
 #define HAVE_THREADS 1
+#define HAVE_UWP 0
 #define HAVE_VAAPI_DRM 0
 #define HAVE_VAAPI_X11 0
 #define HAVE_VDPAU_X11 0
 #define HAVE_WINRT 0
-#define HAVE_XLIB 0
-#define CONFIG_BSFS 0
-#define CONFIG_DECODERS 1
-#define CONFIG_PARSERS 1
 #define CONFIG_DOC 0
 #define CONFIG_HTMLPAGES 0
 #define CONFIG_MANPAGES 1
 #define CONFIG_PODPAGES 1
 #define CONFIG_TXTPAGES 1
 #define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
 #define CONFIG_AVIO_READING_EXAMPLE 1
-#define CONFIG_DECODING_ENCODING_EXAMPLE 0
+#define CONFIG_DECODE_AUDIO_EXAMPLE 1
+#define CONFIG_DECODE_VIDEO_EXAMPLE 1
 #define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+#define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+#define CONFIG_ENCODE_VIDEO_EXAMPLE 1
 #define CONFIG_EXTRACT_MVS_EXAMPLE 0
 #define CONFIG_FILTER_AUDIO_EXAMPLE 0
 #define CONFIG_FILTERING_AUDIO_EXAMPLE 0
 #define CONFIG_FILTERING_VIDEO_EXAMPLE 0
 #define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0