812674
diff --git a/media/ffvpx/libavcodec/allcodecs.c b/media/ffvpx/libavcodec/allcodecs.c
812674
--- a/media/ffvpx/libavcodec/allcodecs.c
812674
+++ b/media/ffvpx/libavcodec/allcodecs.c
812674
@@ -755,12 +755,15 @@
812674
 extern FFCodec ff_libaom_av1_encoder;
812674
 extern const FFCodec ff_libaribb24_decoder;
812674
 extern const FFCodec ff_libcelt_decoder;
812674
 extern const FFCodec ff_libcodec2_encoder;
812674
 extern const FFCodec ff_libcodec2_decoder;
812674
+#if CONFIG_MOZ_AV1
812674
 extern const FFCodec ff_libdav1d_decoder;
812674
 extern const FFCodec ff_libdavs2_decoder;
812674
+extern const FFCodec ff_libuavs3d_decoder;
812674
+#endif
812674
 extern const FFCodec ff_libfdk_aac_encoder;
812674
 extern const FFCodec ff_libfdk_aac_decoder;
812674
 extern const FFCodec ff_libgsm_encoder;
812674
 extern const FFCodec ff_libgsm_decoder;
812674
 extern const FFCodec ff_libgsm_ms_encoder;
812674
@@ -783,11 +786,10 @@
812674
 extern const FFCodec ff_libspeex_encoder;
812674
 extern const FFCodec ff_libspeex_decoder;
812674
 extern const FFCodec ff_libsvtav1_encoder;
812674
 extern const FFCodec ff_libtheora_encoder;
812674
 extern const FFCodec ff_libtwolame_encoder;
812674
-extern const FFCodec ff_libuavs3d_decoder;
812674
 extern const FFCodec ff_libvo_amrwbenc_encoder;
812674
 extern const FFCodec ff_libvorbis_encoder;
812674
 extern const FFCodec ff_libvorbis_decoder;
812674
 extern const FFCodec ff_libvpx_vp8_encoder;
812674
 extern const FFCodec ff_libvpx_vp8_decoder;
812674
diff --git a/media/ffvpx/libavcodec/codec_list.c b/media/ffvpx/libavcodec/codec_list.c
812674
--- a/media/ffvpx/libavcodec/codec_list.c
812674
+++ b/media/ffvpx/libavcodec/codec_list.c
812674
@@ -9,12 +9,14 @@
812674
     &ff_flac_decoder,
812674
 #endif
812674
 #if CONFIG_MP3_DECODER
812674
     &ff_mp3_decoder,
812674
 #endif
812674
+#if CONFIG_MOZ_AV1
812674
 #if CONFIG_LIBDAV1D
812674
     &ff_libdav1d_decoder,
812674
 #endif
812674
 #if CONFIG_AV1_DECODER
812674
     &ff_av1_decoder,
812674
 #endif
812674
+#endif
812674
     NULL };
812674
diff --git a/media/ffvpx/libavcodec/moz.build b/media/ffvpx/libavcodec/moz.build
812674
--- a/media/ffvpx/libavcodec/moz.build
812674
+++ b/media/ffvpx/libavcodec/moz.build
812674
@@ -84,11 +84,10 @@
812674
         'cbs.c',
812674
         'cbs_av1.c',
812674
         'golomb.c',
812674
         'h264pred.c',
812674
         'imgconvert.c',
812674
-        'libdav1d.c',
812674
         'mathtables.c',
812674
         'qsv_api.c',
812674
         'raw.c',
812674
         'videodsp.c',
812674
         'vp8.c',
812674
@@ -107,14 +106,19 @@
812674
         'vp9mvs.c',
812674
         'vp9prob.c',
812674
         'vp9recon.c',
812674
         'vpx_rac.c',
812674
     ]
812674
-    USE_LIBS += [
812674
-        'dav1d',
812674
-        'media_libdav1d_asm',
812674
-    ]
812674
+    if CONFIG['MOZ_AV1']:
812674
+        USE_LIBS += [
812674
+            'dav1d',
812674
+            'media_libdav1d_asm',
812674
+        ]
812674
+        SOURCES += [
812674
+            'libdav1d.c',
812674
+        ]
812674
+
812674
     if CONFIG['MOZ_WAYLAND']:
812674
         LOCAL_INCLUDES += ['/media/mozva']
812674
         SOURCES += [
812674
             'vaapi_av1.c',
812674
             'vaapi_decode.c',
812674