add configure option '--enable-int-audio-sample' for speed and audio driver compatibility, and fixups in exports and webrtc.

This commit is contained in:
roytam1 2023-08-19 06:41:26 +08:00
commit ef5e4f06e0
4 changed files with 37 additions and 1 deletions

View file

@ -192,6 +192,7 @@ def old_configure_options(*options):
'--enable-hardware-aec-ns',
'--enable-icf',
'--enable-install-strip',
'--enable-int-audio-sample',
'--enable-ion',
'--enable-ios-target',
'--enable-jitspew',

View file

@ -97,7 +97,7 @@ JxlThreadParallelRunnerCreate
JxlThreadParallelRunnerDestroy
JxlThreadParallelRunnerDefaultNumWorkerThreads
#endif
#ifdef MOZ_VORBIS
#if defined(MOZ_VORBIS) || defined(MOZ_TREMOR)
ogg_page_bos
ogg_page_granulepos
ogg_page_serialno
@ -118,19 +118,25 @@ ogg_sync_init
ogg_sync_pageseek
ogg_sync_reset
ogg_sync_wrote
#ifdef MOZ_VORBIS
vorbis_analysis
vorbis_analysis_blockout
vorbis_analysis_buffer
vorbis_analysis_init
vorbis_analysis_headerout
vorbis_analysis_wrote
#endif
vorbis_block_clear
vorbis_block_init
#ifdef MOZ_VORBIS
vorbis_comment_add_tag
#endif
vorbis_comment_clear
vorbis_comment_init
vorbis_dsp_clear
#ifdef MOZ_VORBIS
vorbis_encode_init_vbr
#endif
vorbis_info_clear
vorbis_info_init
vorbis_packet_blocksize
@ -144,6 +150,7 @@ vorbis_synthesis_restart
#endif
moz_speex_resampler_init
moz_speex_resampler_destroy
moz_speex_resampler_process_int
moz_speex_resampler_process_float
moz_speex_resampler_process_interleaved_float
moz_speex_resampler_process_interleaved_int
@ -195,12 +202,16 @@ opus_decoder_destroy
opus_decoder_ctl
opus_decoder_get_nb_samples
opus_decode
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
opus_decode_float
#endif
opus_get_version_string
opus_multistream_decoder_create
opus_multistream_decoder_ctl
opus_multistream_decoder_destroy
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
opus_multistream_decode_float
#endif
opus_multistream_decode
opus_packet_get_nb_frames
opus_packet_get_samples_per_frame
@ -208,15 +219,19 @@ opus_encoder_create
opus_encoder_destroy
opus_encoder_ctl
opus_encode
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
opus_encode_float
#endif
#ifdef MOZ_WEBRTC
opus_custom_mode_create
opus_packet_parse
opus_packet_get_nb_channels
downmix_int
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
tonality_analysis_init
run_analysis
#endif
#endif
#ifndef MOZ_NATIVE_PNG
MOZ_APNG_get_first_frame_is_hidden
MOZ_APNG_get_next_frame_blend_op

View file

@ -32,7 +32,9 @@ AudioClassifier::AudioClassifier()
kDefaultFrameSizeSamples,
NULL)) {
assert(celt_mode_);
#ifndef MOZ_SAMPLE_TYPE_S16
tonality_analysis_init(&analysis_state_, kDefaultSampleRateHz);
#endif
}
AudioClassifier::~AudioClassifier() {}
@ -46,6 +48,7 @@ bool AudioClassifier::Analysis(const int16_t* input,
// Only mono or stereo are allowed.
assert(channels == 1 || channels == 2);
#ifndef MOZ_SAMPLE_TYPE_S16
// Call Opus' classifier, defined in
// "third_party/opus/src/src/analysis.h", with lsb_depth = 16.
// Also uses a down-mixing function downmix_int, defined in
@ -65,6 +68,9 @@ bool AudioClassifier::Analysis(const int16_t* input,
&analysis_info_);
music_probability_ = analysis_info_.music_prob;
is_music_ = music_probability_ > kDefaultThreshold;
#else
is_music_ = false;
#endif
return is_music_;
}

View file

@ -2782,11 +2782,25 @@ AC_SUBST(MOZ_SCTP)
AC_SUBST(MOZ_SRTP)
AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
dnl ========================================================
dnl Use integers over floats for audio
dnl ========================================================
MOZ_SAMPLE_USE_INT=
dnl Use integers over floats for audio on Android
dnl (regarless of the CPU architecture, because audio
dnl backends for those platforms don't support floats. We also
dnl use integers on ARM with other OS, because it's more efficient.
if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
MOZ_SAMPLE_USE_INT=1
fi
MOZ_ARG_ENABLE_BOOL(int-audio-sample,
[ --enable-int-audio-sample Use int audio output type instead of float type],
MOZ_SAMPLE_USE_INT=1,
MOZ_SAMPLE_USE_INT=)
if test "$MOZ_SAMPLE_USE_INT" = 1; then
MOZ_SAMPLE_TYPE_S16=1
AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
AC_SUBST(MOZ_SAMPLE_TYPE_S16)