From 1d43a2362cb8a5688c18af76acadb7554965adec Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 14 May 2021 12:05:52 +0200 Subject: [PATCH] Add debug option to disable media tunneling --- app/src/main/java/org/schabi/newpipe/player/Player.java | 6 +++++- app/src/main/res/values/settings_keys.xml | 1 + app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/debug_settings.xml | 7 +++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index ba6521b91..d319e99ad 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -495,7 +495,11 @@ public final class Player implements simpleExoPlayer.addTextOutput(binding.subtitleView); // enable media tunneling - if (DeviceUtils.shouldSupportMediaTunneling()) { + if (DEBUG && PreferenceManager.getDefaultSharedPreferences(context) + .getBoolean(context.getString(R.string.disable_media_tunneling_key), false)) { + Log.d(TAG, "[" + Util.DEVICE_DEBUG_INFO + "] " + + "media tunneling disabled in debug preferences"); + } else if (DeviceUtils.shouldSupportMediaTunneling()) { trackSelector.setParameters( trackSelector.buildUponParameters().setTunnelingEnabled(true)); } else if (DEBUG) { diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 9a1fcba7d..6973a72f2 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -172,6 +172,7 @@ show_memory_leaks_key allow_disposed_exceptions_key show_original_time_ago_text_key + disable_media_tunneling_text_key crash_the_app_key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 247326b7a..5acb83e40 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -521,6 +521,8 @@ Force reporting of undeliverable Rx exceptions outside of fragment or activity lifecycle after disposal Show original time ago on items Original texts from services will be visible in stream items + Disable media tunneling + Disable media tunneling if you experience a black screen or stuttering on video playback Crash the app Import/export diff --git a/app/src/main/res/xml/debug_settings.xml b/app/src/main/res/xml/debug_settings.xml index 8dda516fe..d27d67aad 100644 --- a/app/src/main/res/xml/debug_settings.xml +++ b/app/src/main/res/xml/debug_settings.xml @@ -30,6 +30,13 @@ android:title="@string/show_original_time_ago_title" app:iconSpaceReserved="false" /> + +