diff -Naur a/media/ffvpx/libavcodec/moz.build b/media/ffvpx/libavcodec/moz.build
--- a/media/ffvpx/libavcodec/moz.build	2023-08-01 09:34:20.242044722 +0300
+++ b/media/ffvpx/libavcodec/moz.build	2023-08-01 09:36:01.445808739 +0300
@@ -109,10 +109,14 @@
         'vp9recon.c',
         'vpx_rac.c',
     ]
-    USE_LIBS += [
-        'dav1d',
-        'media_libdav1d_asm',
-    ]
+    if CONFIG["MOZ_SYSTEM_AV1"]:
+      CFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
+      OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
+    else:
+      USE_LIBS += [
+          'dav1d',
+          'media_libdav1d_asm',
+      ]
     if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
         LOCAL_INCLUDES += ['/media/mozva']
         SOURCES += [
