Bug 1864008 - Move libvpx to libgkcodecs, part 1 r=media-playback-reviewers,glandium,alwu,padenot

This patch is the first part that moves libvpx from libgkmedias to
libgkcodecs.

When `ac_add_options --with-system-libvpx` (and `--without-sysroot` if
needed) is set in mozconfig (MOZ_SYSTEM_LIBVPX case), the libvpx
installed in the system will be used and the media/libvpx won't be
built, so the libvpx APIs shouldn't be exposed via gkcodecs' symbols in
this case.

With the changes, the "vpx/..." headers `#include`d in the VPX
encoders should be replaced with system headers like `<vpx/...>`
instead. While the VPX headers under dom/media are updated in this
patch, those headers under third_party/libwebrtc are set in a different
way in the following patches.

Since libpixman needs android_getCpuFeatures and _getCpuFamily APIs,
which were built by libvpx previously, cpu-features.c now is required to
be included in its moz.build to get the API it needs.

Differential Revision: https://phabricator.services.mozilla.com/D193599
This commit is contained in:
Chun-Min Chang 2023-12-05 20:08:22 +00:00
Родитель 1e299fce9f
Коммит 958a88c0ed
9 изменённых файлов: 56 добавлений и 22 удалений

25
config/external/gkcodecs/gkcodecs.symbols поставляемый
Просмотреть файл

@ -74,3 +74,28 @@ vorbis_synthesis_init
vorbis_synthesis_pcmout
vorbis_synthesis_read
vorbis_synthesis_restart
#ifndef MOZ_SYSTEM_LIBVPX
vpx_codec_control_
vpx_codec_dec_init_ver
vpx_codec_decode
vpx_codec_destroy
vpx_codec_enc_config_default
vpx_codec_enc_config_set
vpx_codec_enc_init_multi_ver
vpx_codec_enc_init_ver
vpx_codec_encode
vpx_codec_err_to_string
vpx_codec_error
vpx_codec_error_detail
vpx_codec_get_caps
vpx_codec_get_cx_data
vpx_codec_get_frame
vpx_codec_set_frame_buffer_functions
vpx_codec_vp8_cx
vpx_codec_vp8_dx
vpx_codec_vp9_cx
vpx_codec_vp9_dx
vpx_img_alloc
vpx_img_free
vpx_img_wrap
#endif

6
config/external/gkcodecs/moz.build поставляемый
Просмотреть файл

@ -5,12 +5,14 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# The gkcodecs library contains code from third-party libraries implementing
# encoding an decoding for particular audio codecs.
# encoding an decoding for particular audio and video codecs.
#
# They are compiled in a separate shared library to be able to be available
# both from libxul (when decoding using the codec integration layer Gecko
# provides) and from ffmpeg (when decoding trough ffmpeg).
# provides) and from ffmpeg (when decoding and encoding through ffmpeg).
GeckoSharedLibrary("gkcodecs", linkage=None)
SHARED_LIBRARY_NAME = "gkcodecs"
SYMBOLS_FILE = "gkcodecs.symbols"
if CONFIG["MOZ_SYSTEM_LIBVPX"]:
DEFINES["MOZ_SYSTEM_LIBVPX"] = True

Просмотреть файл

@ -1014,7 +1014,17 @@ system_headers = [
'opus/opus.h',
'opus/opus_multistream.h',
'ogg/ogg.h',
'theora/theoradec.h'
'theora/theoradec.h',
'vpx/svc_context.h',
'vpx/vp8.h',
'vpx/vp8cx.h',
'vpx/vp8dx.h',
'vpx/vpx_codec.h',
'vpx/vpx_decoder.h',
'vpx/vpx_encoder.h',
'vpx/vpx_frame_buffer.h',
'vpx/vpx_image.h',
'vpx_mem/vpx_mem.h'
]
if CONFIG['MOZ_X11']:
@ -1294,17 +1304,6 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
'proxy.h',
]
if CONFIG['MOZ_SYSTEM_LIBVPX']:
system_headers += [
'vpx_mem/vpx_mem.h',
'vpx/svc_context.h',
'vpx/vp8cx.h',
'vpx/vp8dx.h',
'vpx/vpx_codec.h',
'vpx/vpx_decoder.h',
'vpx/vpx_encoder.h',
]
if CONFIG['MOZ_SYSTEM_ICU']:
system_headers += [
'unicode/calendar.h',

Просмотреть файл

@ -5,14 +5,15 @@
#include "VP8TrackEncoder.h"
#include <vpx/vp8cx.h>
#include <vpx/vpx_encoder.h>
#include "DriftCompensation.h"
#include "ImageToI420.h"
#include "mozilla/gfx/2D.h"
#include "prsystem.h"
#include "VideoSegment.h"
#include "VideoUtils.h"
#include "vpx/vp8cx.h"
#include "vpx/vpx_encoder.h"
#include "WebMWriter.h"
#include "mozilla/media/MediaUtils.h"
#include "mozilla/dom/ImageUtils.h"

Просмотреть файл

@ -8,9 +8,10 @@
#include "TrackEncoder.h"
#include <vpx/vpx_codec.h>
#include "mozilla/RollingMean.h"
#include "TimeUnits.h"
#include "vpx/vpx_codec.h"
namespace mozilla {

Просмотреть файл

@ -7,6 +7,7 @@
#include "VPXDecoder.h"
#include <algorithm>
#include <vpx/vpx_image.h>
#include "BitReader.h"
#include "BitWriter.h"
@ -22,7 +23,6 @@
#include "PerformanceRecorder.h"
#include "prsystem.h"
#include "VideoUtils.h"
#include "vpx/vpx_image.h"
#undef LOG
#define LOG(arg, ...) \

Просмотреть файл

@ -7,13 +7,13 @@
# define VPXDecoder_h_
# include <stdint.h>
# include <vpx/vp8dx.h>
# include <vpx/vpx_codec.h>
# include <vpx/vpx_decoder.h>
# include "PlatformDecoderModule.h"
# include "mozilla/Span.h"
# include "mozilla/gfx/Types.h"
# include "vpx/vp8dx.h"
# include "vpx/vpx_codec.h"
# include "vpx/vpx_decoder.h"
namespace mozilla {

Просмотреть файл

@ -55,6 +55,11 @@ if CONFIG['ANDROID_NDK']:
'%%%s/sources/android/cpufeatures' % CONFIG['ANDROID_NDK']
]
if CONFIG['OS_TARGET'] == 'Android':
SOURCES += [
'%%%s/sources/android/cpufeatures/cpu-features.c' % CONFIG['ANDROID_NDK'],
]
if CONFIG['MOZ_USE_PTHREADS']:
DEFINES['HAVE_PTHREADS'] = True

Просмотреть файл

@ -93,7 +93,8 @@ else:
# We allow warnings for third-party code that can be updated from upstream.
AllowCompilerWarnings()
FINAL_LIBRARY = 'gkmedias'
FINAL_LIBRARY = 'gkcodecs'
NoVisibilityFlags()
DEFINES['HAVE_CONFIG_H'] = 'vpx_config.h'