mirror of https://github.com/FFmpeg/FFmpeg.git
Compare commits
No commits in common. "eccbbd528ef63f17575f11a644d549da80bf4b30" and "9e09be513d81d66cddcdd53827c850d13c2319b3" have entirely different histories.
eccbbd528e
...
9e09be513d
|
|
@ -1,114 +0,0 @@
|
|||
/*
|
||||
* Android Binder handler
|
||||
*
|
||||
* Copyright (c) 2025 Dmitrii Okunev
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libavutil/log.h"
|
||||
#include "binder.h"
|
||||
|
||||
#define THREAD_POOL_SIZE 1
|
||||
|
||||
static void *dlopen_libbinder_ndk(void)
|
||||
{
|
||||
/*
|
||||
* libbinder_ndk.so often does not contain the functions we need, so making
|
||||
* this dependency optional, thus using dlopen/dlsym instead of linking.
|
||||
*
|
||||
* See also: https://source.android.com/docs/core/architecture/aidl/aidl-backends
|
||||
*/
|
||||
|
||||
void *h = dlopen("libbinder_ndk.so", RTLD_NOW | RTLD_LOCAL);
|
||||
if (h != NULL)
|
||||
return h;
|
||||
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"android/binder: unable to load libbinder_ndk.so: '%s'; skipping binder threadpool init (MediaCodec likely won't work)\n",
|
||||
dlerror());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void android_binder_threadpool_init(void)
|
||||
{
|
||||
typedef int (*set_thread_pool_max_fn)(uint32_t);
|
||||
typedef void (*start_thread_pool_fn)(void);
|
||||
|
||||
set_thread_pool_max_fn set_thread_pool_max = NULL;
|
||||
start_thread_pool_fn start_thread_pool = NULL;
|
||||
|
||||
void *h = dlopen_libbinder_ndk();
|
||||
if (h == NULL)
|
||||
return;
|
||||
|
||||
unsigned thead_pool_size = THREAD_POOL_SIZE;
|
||||
|
||||
set_thread_pool_max =
|
||||
(set_thread_pool_max_fn) dlsym(h,
|
||||
"ABinderProcess_setThreadPoolMaxThreadCount");
|
||||
start_thread_pool =
|
||||
(start_thread_pool_fn) dlsym(h, "ABinderProcess_startThreadPool");
|
||||
|
||||
if (start_thread_pool == NULL) {
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"android/binder: ABinderProcess_startThreadPool not found; skipping threadpool init (MediaCodec likely won't work)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (set_thread_pool_max != NULL) {
|
||||
int ok = set_thread_pool_max(thead_pool_size);
|
||||
av_log(NULL, AV_LOG_DEBUG,
|
||||
"android/binder: ABinderProcess_setThreadPoolMaxThreadCount(%u) => %s\n",
|
||||
thead_pool_size, ok ? "ok" : "fail");
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_DEBUG,
|
||||
"android/binder: ABinderProcess_setThreadPoolMaxThreadCount is unavailable; using the library default\n");
|
||||
}
|
||||
|
||||
start_thread_pool();
|
||||
av_log(NULL, AV_LOG_DEBUG,
|
||||
"android/binder: ABinderProcess_startThreadPool() called\n");
|
||||
}
|
||||
|
||||
void android_binder_threadpool_init_if_required(void)
|
||||
{
|
||||
#if __ANDROID_API__ >= 24
|
||||
if (android_get_device_api_level() < 35) {
|
||||
// the issue with the thread pool was introduced in Android 15 (API 35)
|
||||
av_log(NULL, AV_LOG_DEBUG,
|
||||
"android/binder: API<35, thus no need to initialize a thread pool\n");
|
||||
return;
|
||||
}
|
||||
android_binder_threadpool_init();
|
||||
#else
|
||||
// android_get_device_api_level was introduced in API 24, so we cannot use it
|
||||
// to detect the API level in API<24. For simplicity we just assume
|
||||
// libbinder_ndk.so on the system running this code would have API level < 35;
|
||||
av_log(NULL, AV_LOG_DEBUG,
|
||||
"android/binder: is built with API<24, assuming this is not Android 15+\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __ANDROID__ */
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Android Binder handler
|
||||
*
|
||||
* Copyright (c) 2025 Dmitrii Okunev
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef COMPAT_ANDROID_BINDER_H
|
||||
#define COMPAT_ANDROID_BINDER_H
|
||||
|
||||
/**
|
||||
* Initialize Android Binder thread pool.
|
||||
*/
|
||||
void android_binder_threadpool_init_if_required(void);
|
||||
|
||||
#endif // COMPAT_ANDROID_BINDER_H
|
||||
|
|
@ -7312,8 +7312,7 @@ enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt
|
|||
check_pkg_config mbedtls mbedtls mbedtls/ssl.h mbedtls_ssl_init ||
|
||||
check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto ||
|
||||
die "ERROR: mbedTLS not found"; }
|
||||
enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; } &&
|
||||
add_compat android/binder.o
|
||||
enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; }
|
||||
enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
|
||||
{ ! enabled cross_compile &&
|
||||
add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline &&
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ OBJS-ffprobe += \
|
|||
fftools/textformat/tw_buffer.o \
|
||||
fftools/textformat/tw_stdout.o \
|
||||
|
||||
OBJS-ffmpeg += $(COMPAT_OBJS:%=compat/%)
|
||||
OBJS-ffplay += fftools/ffplay_renderer.o
|
||||
|
||||
define DOFFTOOL
|
||||
|
|
|
|||
|
|
@ -78,9 +78,6 @@
|
|||
#include "libavdevice/avdevice.h"
|
||||
|
||||
#include "cmdutils.h"
|
||||
#if CONFIG_MEDIACODEC
|
||||
#include "compat/android/binder.h"
|
||||
#endif
|
||||
#include "ffmpeg.h"
|
||||
#include "ffmpeg_sched.h"
|
||||
#include "ffmpeg_utils.h"
|
||||
|
|
@ -1022,10 +1019,6 @@ int main(int argc, char **argv)
|
|||
goto finish;
|
||||
}
|
||||
|
||||
#if CONFIG_MEDIACODEC
|
||||
android_binder_threadpool_init_if_required();
|
||||
#endif
|
||||
|
||||
current_time = ti = get_benchmark_time_stamps();
|
||||
ret = transcode(sch);
|
||||
if (ret >= 0 && do_benchmark) {
|
||||
|
|
|
|||
|
|
@ -1075,40 +1075,6 @@ fail:
|
|||
}
|
||||
#endif
|
||||
|
||||
static int mov_read_srat(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
{
|
||||
AVStream *st;
|
||||
int32_t sample_rate;
|
||||
|
||||
if (atom.size < 8 || c->fc->nb_streams < 1)
|
||||
return 0;
|
||||
|
||||
st = c->fc->streams[c->fc->nb_streams-1];
|
||||
if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
|
||||
av_log(c->fc, AV_LOG_WARNING, "'srat' within non-audio sample entry, skip\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!c->isom) {
|
||||
av_log(c->fc, AV_LOG_WARNING, "'srat' within non-isom, skip\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
avio_skip(pb, 4); // version+flags
|
||||
sample_rate = avio_rb32(pb);
|
||||
if (sample_rate > 0) {
|
||||
av_log(c->fc, AV_LOG_DEBUG,
|
||||
"overwrite sample rate from %d to %d by 'srat'\n",
|
||||
st->codecpar->sample_rate, sample_rate);
|
||||
st->codecpar->sample_rate = sample_rate;
|
||||
} else {
|
||||
av_log(c->fc, AV_LOG_WARNING,
|
||||
"ignore invalid sample rate %d in 'srat'\n", sample_rate);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
{
|
||||
AVStream *st;
|
||||
|
|
@ -2712,18 +2678,12 @@ static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb,
|
|||
* read in ff_mov_read_stsd_entries() */
|
||||
stsd_start = avio_tell(pb) - 16;
|
||||
|
||||
if (c->isom) {
|
||||
avio_skip(pb, 2); /* pre_defined */
|
||||
avio_skip(pb, 2); /* reserved */
|
||||
avio_skip(pb, 12); /* pre_defined */
|
||||
} else {
|
||||
avio_rb16(pb); /* version */
|
||||
avio_rb16(pb); /* revision level */
|
||||
id = avio_rl32(pb); /* vendor */
|
||||
av_dict_set(&st->metadata, "vendor_id", av_fourcc2str(id), 0);
|
||||
avio_rb32(pb); /* temporal quality */
|
||||
avio_rb32(pb); /* spatial quality */
|
||||
}
|
||||
|
||||
st->codecpar->width = avio_rb16(pb); /* width */
|
||||
st->codecpar->height = avio_rb16(pb); /* height */
|
||||
|
|
@ -2773,13 +2733,9 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb,
|
|||
AVDictionaryEntry *compatible_brands = av_dict_get(c->fc->metadata, "compatible_brands", NULL, AV_DICT_MATCH_CASE);
|
||||
int channel_count;
|
||||
|
||||
if (c->isom)
|
||||
avio_skip(pb, 6); /* reserved */
|
||||
else {
|
||||
avio_rb16(pb); /* revision level */
|
||||
id = avio_rl32(pb); /* vendor */
|
||||
av_dict_set(&st->metadata, "vendor_id", av_fourcc2str(id), 0);
|
||||
}
|
||||
|
||||
channel_count = avio_rb16(pb);
|
||||
|
||||
|
|
@ -9523,7 +9479,6 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
|
|||
#if CONFIG_IAMFDEC
|
||||
{ MKTAG('i','a','c','b'), mov_read_iacb },
|
||||
#endif
|
||||
{ MKTAG('s','r','a','t'), mov_read_srat },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
18c64ec6b4f0cc39c5f8f3564b372fef *tests/data/fate/h264-bsf-redundant-pps-side-data.nut
|
||||
596084 tests/data/fate/h264-bsf-redundant-pps-side-data.nut
|
||||
92fe70291f72acf94ba56b426bbaccb0 *tests/data/fate/h264-bsf-redundant-pps-side-data.nut
|
||||
596100 tests/data/fate/h264-bsf-redundant-pps-side-data.nut
|
||||
#extradata 0: 34, 0x850408e3
|
||||
#tb 0: 1/48000
|
||||
#media_type 0: video
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
f94ed2c25b6bbe63160743f08de33665 *tests/data/fate/h264-bsf-redundant-pps-side-data2.nut
|
||||
5138 tests/data/fate/h264-bsf-redundant-pps-side-data2.nut
|
||||
dd953f8d95d2927703ce9593a07fe2e7 *tests/data/fate/h264-bsf-redundant-pps-side-data2.nut
|
||||
5162 tests/data/fate/h264-bsf-redundant-pps-side-data2.nut
|
||||
#tb 0: 1/25
|
||||
#media_type 0: video
|
||||
#codec_id 0: rawvideo
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
6075eb35f53692596194f3b0175cb184 *tests/data/fate/matroska-alac-remux.matroska
|
||||
1293794 tests/data/fate/matroska-alac-remux.matroska
|
||||
90c54a00ad8662c3eb93150791fa8328 *tests/data/fate/matroska-alac-remux.matroska
|
||||
1293824 tests/data/fate/matroska-alac-remux.matroska
|
||||
#extradata 0: 36, 0x562b05d8
|
||||
#tb 0: 1/1000
|
||||
#media_type 0: audio
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
adafbb4d021db027f4ae4ef7ca1c56c2 *tests/data/fate/matroska-dovi-write-config7.matroska
|
||||
72640 tests/data/fate/matroska-dovi-write-config7.matroska
|
||||
7adef53df9e14358e0b99f8a829e2d97 *tests/data/fate/matroska-dovi-write-config7.matroska
|
||||
72700 tests/data/fate/matroska-dovi-write-config7.matroska
|
||||
#extradata 0: 116, 0x2b8d1669
|
||||
#extradata 1: 116, 0x2b8d1669
|
||||
#tb 0: 1/1000
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ DISPOSITION:still_image=0
|
|||
DISPOSITION:multilayer=0
|
||||
TAG:language=und
|
||||
TAG:handler_name=SoundHandler
|
||||
TAG:vendor_id=[0][0][0][0]
|
||||
[STREAM]
|
||||
index=0
|
||||
id=0x0
|
||||
|
|
@ -394,6 +395,7 @@ DISPOSITION:still_image=0
|
|||
DISPOSITION:multilayer=0
|
||||
TAG:language=und
|
||||
TAG:handler_name=SoundHandler
|
||||
TAG:vendor_id=[0][0][0][0]
|
||||
[STREAM]
|
||||
index=0
|
||||
id=0x0
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ DISPOSITION:still_image=0
|
|||
DISPOSITION:multilayer=0
|
||||
TAG:language=und
|
||||
TAG:handler_name=SoundHandler
|
||||
TAG:vendor_id=[0][0][0][0]
|
||||
[STREAM]
|
||||
index=1
|
||||
id=0x2
|
||||
|
|
@ -464,6 +465,7 @@ DISPOSITION:still_image=0
|
|||
DISPOSITION:multilayer=0
|
||||
TAG:language=und
|
||||
TAG:handler_name=SoundHandler
|
||||
TAG:vendor_id=[0][0][0][0]
|
||||
[STREAM]
|
||||
index=1
|
||||
id=0x2
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ DISPOSITION:still_image=0
|
|||
DISPOSITION:multilayer=0
|
||||
TAG:language=und
|
||||
TAG:handler_name=SoundHandler
|
||||
TAG:vendor_id=[0][0][0][0]
|
||||
[STREAM]
|
||||
index=0
|
||||
id=0x9
|
||||
|
|
@ -464,6 +465,7 @@ DISPOSITION:still_image=0
|
|||
DISPOSITION:multilayer=0
|
||||
TAG:language=und
|
||||
TAG:handler_name=SoundHandler
|
||||
TAG:vendor_id=[0][0][0][0]
|
||||
[STREAM]
|
||||
index=0
|
||||
id=0x9
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ DISPOSITION:still_image=0
|
|||
DISPOSITION:multilayer=0
|
||||
TAG:language=und
|
||||
TAG:handler_name=SoundHandler
|
||||
TAG:vendor_id=[0][0][0][0]
|
||||
[STREAM]
|
||||
index=0
|
||||
id=0x0
|
||||
|
|
@ -263,6 +264,7 @@ DISPOSITION:still_image=0
|
|||
DISPOSITION:multilayer=0
|
||||
TAG:language=und
|
||||
TAG:handler_name=SoundHandler
|
||||
TAG:vendor_id=[0][0][0][0]
|
||||
[STREAM]
|
||||
index=0
|
||||
id=0x0
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ DISPOSITION:still_image=0
|
|||
DISPOSITION:multilayer=0
|
||||
TAG:language=und
|
||||
TAG:handler_name=SoundHandler
|
||||
TAG:vendor_id=[0][0][0][0]
|
||||
[STREAM]
|
||||
index=0
|
||||
id=0x0
|
||||
|
|
@ -186,6 +187,7 @@ DISPOSITION:still_image=0
|
|||
DISPOSITION:multilayer=0
|
||||
TAG:language=und
|
||||
TAG:handler_name=SoundHandler
|
||||
TAG:vendor_id=[0][0][0][0]
|
||||
[STREAM]
|
||||
index=0
|
||||
id=0x0
|
||||
|
|
|
|||
Loading…
Reference in New Issue