fix(player): route Hi10 to software up front and drop to bilinear on GPUs without norm16
H.264 High 10 on Android TV boxes without a 10-bit hardware decoder (Amlogic S905X4 class: onn 4K Pro, Homatics Box R) started black for over ten seconds and then played choppy: mpv tried MediaCodec first, hit "Could not initialize video chain", and only then fell back to software decode on the GL vo, where the Mali-G31 driver has no GL_EXT_texture_norm16 and pays an integer-texture conversion pass plus lanczos scaling it cannot afford at 1080p. Decide the decoder before mpv creates it. An on_preloaded hook now carries both per-file policies (Dolby Vision P5 reshaping and this one): when the track's codec-profile is High 10 (published at demux by the fork, see the mpv-build pin) and MediaCodecList advertises no hardware AVCProfileHigh10, hwdec is held at `no` and the session goes to the GL vo directly. The hold parks any hwdec write from Dart and restores it for the next file, as the DV P5 hold already did. On a GL vo whose driver lacks norm16 (probed once through a pbuffer EGL context), scale/cscale/dscale drop to bilinear and dither to off for the session, restored when the vo goes back to the plane. Only options still at their mpv defaults are touched, so a user's mpv.conf wins. Paired with the fork's rg8-backed 16-bit plane emulation, the box goes from 13 drops/s and a 13.7 s first frame to 0.7 drops/s and 2.5 s. Devices with norm16 (Shield, Pixel 7) take neither the tier nor the emulation. The native pin moves to edde746/mpv-build@0601b034da, which also picks up the earlier android/linux/windows patch-series squash. close #2065
This commit is contained in:
@@ -69,6 +69,14 @@ static void sendLogMessageToJava(JNIEnv* env, mpv_event_log_message* msg) {
|
||||
if (jtext) env->DeleteLocalRef(jtext);
|
||||
}
|
||||
|
||||
// A hook holds mpv (playback does not proceed) until Kotlin answers with
|
||||
// nativeHookContinue(id); MpvPlayer guarantees that answer for every hook.
|
||||
static void sendHookToJava(JNIEnv* env, mpv_event_hook* hook) {
|
||||
jstring jname = new_java_string(env, hook->name);
|
||||
env->CallStaticVoidMethod(mpv_MpvPlayer, mpv_MpvPlayer_onHook, jname, (jlong)hook->id);
|
||||
if (jname) env->DeleteLocalRef(jname);
|
||||
}
|
||||
|
||||
void* event_thread(void* arg) {
|
||||
JNIEnv* env = NULL;
|
||||
acquire_jni_env(g_vm, &env);
|
||||
@@ -113,6 +121,9 @@ void* event_thread(void* arg) {
|
||||
ALOGV("event: %s\n", mpv_event_name(mp_event->event_id));
|
||||
sendEventToJava(env, mp_event->event_id, source_id, has_source_id);
|
||||
break;
|
||||
case MPV_EVENT_HOOK:
|
||||
sendHookToJava(env, (mpv_event_hook*)mp_event->data);
|
||||
break;
|
||||
case MPV_EVENT_PLAYBACK_RESTART: {
|
||||
double position_seconds = 0.0;
|
||||
const bool has_position_seconds =
|
||||
|
||||
Reference in New Issue
Block a user