From 1d43a2362cb8a5688c18af76acadb7554965adec Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 14 May 2021 12:05:52 +0200 Subject: [PATCH 1/3] 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" /> + + Date: Fri, 14 May 2021 12:15:48 +0200 Subject: [PATCH 2/3] Fixed checkstyle --- app/src/main/java/org/schabi/newpipe/player/Player.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 d319e99ad..03e061d1c 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -497,8 +497,8 @@ public final class Player implements // enable media tunneling 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"); + Log.d(TAG, "[" + Util.DEVICE_DEBUG_INFO + "] " + + "media tunneling disabled in debug preferences"); } else if (DeviceUtils.shouldSupportMediaTunneling()) { trackSelector.setParameters( trackSelector.buildUponParameters().setTunnelingEnabled(true)); From 4038617d59bf7fb41e58b9f7014e4457d70f0e64 Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 14 May 2021 12:25:07 +0200 Subject: [PATCH 3/3] removed _text_ from show_original_time_ago and disable_media_tunneling --- app/src/main/res/values/settings_keys.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 6973a72f2..fd6cc7251 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -171,8 +171,8 @@ allow_heap_dumping_key show_memory_leaks_key allow_disposed_exceptions_key - show_original_time_ago_text_key - disable_media_tunneling_text_key + show_original_time_ago_key + disable_media_tunneling_key crash_the_app_key