From a4a9957a155ddb2564b6381002a759acb7a1ce61 Mon Sep 17 00:00:00 2001 From: AudricV <74829229+AudricV@users.noreply.github.com> Date: Thu, 18 Aug 2022 18:35:22 +0200 Subject: [PATCH 1/5] Add ExoPlayerSettingsFragment and move playback load interval size setting into it This fragment has been added into SettingsResourceRegistry, to allow searches in its options. It has been placed at the place of the previous playback load interval size setting (so in Video and Audio settings). --- .../settings/ExoPlayerSettingsFragment.java | 14 ++++++++++++++ .../settings/SettingsResourceRegistry.java | 1 + app/src/main/res/values/settings_keys.xml | 2 ++ app/src/main/res/values/strings.xml | 4 ++++ app/src/main/res/xml/exoplayer_settings.xml | 16 ++++++++++++++++ app/src/main/res/xml/video_audio_settings.xml | 12 +++++------- 6 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 app/src/main/java/org/schabi/newpipe/settings/ExoPlayerSettingsFragment.java create mode 100644 app/src/main/res/xml/exoplayer_settings.xml diff --git a/app/src/main/java/org/schabi/newpipe/settings/ExoPlayerSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/ExoPlayerSettingsFragment.java new file mode 100644 index 000000000..7e740f869 --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/settings/ExoPlayerSettingsFragment.java @@ -0,0 +1,14 @@ +package org.schabi.newpipe.settings; + +import android.os.Bundle; + +import androidx.annotation.Nullable; + +public class ExoPlayerSettingsFragment extends BasePreferenceFragment { + + @Override + public void onCreatePreferences(@Nullable final Bundle savedInstanceState, + @Nullable final String rootKey) { + addPreferencesFromResourceRegistry(); + } +} diff --git a/app/src/main/java/org/schabi/newpipe/settings/SettingsResourceRegistry.java b/app/src/main/java/org/schabi/newpipe/settings/SettingsResourceRegistry.java index 78ddb3786..b3d0741bb 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SettingsResourceRegistry.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SettingsResourceRegistry.java @@ -40,6 +40,7 @@ public final class SettingsResourceRegistry { add(PlayerNotificationSettingsFragment.class, R.xml.player_notification_settings); add(UpdateSettingsFragment.class, R.xml.update_settings); add(VideoAudioSettingsFragment.class, R.xml.video_audio_settings); + add(ExoPlayerSettingsFragment.class, R.xml.exoplayer_settings); } private SettingRegistryEntry add( diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 8f3e8e192..f00c25c8c 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -1366,4 +1366,6 @@ streams_notifications_channels player_notification_screen + + exoplayer_settings_key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 43705056b..1dad7c01d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -773,4 +773,8 @@ Partially watched Upcoming Sort + ExoPlayer settings + Manage some ExoPlayer settings. These changes require a player restart to take effect + Use ExoPlayer\'s decoder fallback feature + Enable this option if you have decoder initialization issues, which falls back to lower-priority decoders if primary decoders initialization fail. This may result in poor playback performance than when using primary decoders \ No newline at end of file diff --git a/app/src/main/res/xml/exoplayer_settings.xml b/app/src/main/res/xml/exoplayer_settings.xml new file mode 100644 index 000000000..fd5637115 --- /dev/null +++ b/app/src/main/res/xml/exoplayer_settings.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/video_audio_settings.xml b/app/src/main/res/xml/video_audio_settings.xml index e4485f154..75a925c65 100644 --- a/app/src/main/res/xml/video_audio_settings.xml +++ b/app/src/main/res/xml/video_audio_settings.xml @@ -61,13 +61,11 @@ app:iconSpaceReserved="false" app:useSimpleSummaryProvider="true" /> - From 41da8fc05faf744f7e9a57a1a6adf2225be6cfd4 Mon Sep 17 00:00:00 2001 From: AudricV <74829229+AudricV@users.noreply.github.com> Date: Thu, 18 Aug 2022 18:59:45 +0200 Subject: [PATCH 2/5] Add ability to use ExoPlayer's decoder fallback option This option could help to avoid decoder initialization issues, which falls back to lower-priority decoders if decoder initialization fails. This may result in poor playback performance than when using primary decoders. It is disabled by default, but can be enabled in ExoPlayer settings. --- app/src/main/java/org/schabi/newpipe/player/Player.java | 4 +++- app/src/main/res/values/settings_keys.xml | 2 ++ app/src/main/res/xml/exoplayer_settings.xml | 8 ++++++++ 3 files changed, 13 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 4243c233b..cc75a2c22 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -263,7 +263,9 @@ public final class Player implements PlaybackListener, Listener { final PlayerDataSource dataSource = new PlayerDataSource(context, new DefaultBandwidthMeter.Builder(context).build()); loadController = new LoadController(); - renderFactory = new DefaultRenderersFactory(context); + renderFactory = new DefaultRenderersFactory(context) + .setEnableDecoderFallback(prefs.getBoolean( + context.getString(R.string.use_exoplayer_decoder_fallback_key), false)); videoResolver = new VideoPlaybackResolver(context, dataSource, getQualityResolver()); audioResolver = new AudioPlaybackResolver(context, dataSource); diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index f00c25c8c..7d8c48bda 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -1367,5 +1367,7 @@ streams_notifications_channels player_notification_screen + exoplayer_settings_key + use_exoplayer_decoder_fallback_key diff --git a/app/src/main/res/xml/exoplayer_settings.xml b/app/src/main/res/xml/exoplayer_settings.xml index fd5637115..f5314182e 100644 --- a/app/src/main/res/xml/exoplayer_settings.xml +++ b/app/src/main/res/xml/exoplayer_settings.xml @@ -13,4 +13,12 @@ app:singleLineTitle="false" app:iconSpaceReserved="false" /> + + \ No newline at end of file From a6ff85a208ec174f48ea31f4487c66d490a1ae1c Mon Sep 17 00:00:00 2001 From: AudricV <74829229+AudricV@users.noreply.github.com> Date: Thu, 18 Aug 2022 19:21:29 +0200 Subject: [PATCH 3/5] Move media tunneling setting to ExoPlayer settings and make this setting available on release builds Media tunneling may be not supported by more devices than the ones we whitelisted before. As a matter of fact, the list of devices on which media tunneling is disabled could be not maintainable in the future, especially if the list of devices grows more and more. A preferable solution is to allow users to configure this setting themselves, allowing them to not wait for their device(s) to be whitelisted in a future NewPipe update. This solution has been applied in this commit and works on every build type. The corresponding preference in the debug settings has been of course removed and the code used to prevent media tunneling activation on specific devices has been removed. --- .../org/schabi/newpipe/player/Player.java | 11 ++------ .../org/schabi/newpipe/util/DeviceUtils.java | 28 ------------------- app/src/main/res/values/settings_keys.xml | 2 +- app/src/main/res/xml/debug_settings.xml | 8 ------ app/src/main/res/xml/exoplayer_settings.xml | 8 ++++++ 5 files changed, 11 insertions(+), 46 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 cc75a2c22..5dc9382e7 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -77,7 +77,6 @@ import com.google.android.exoplayer2.text.CueGroup; import com.google.android.exoplayer2.trackselection.DefaultTrackSelector; import com.google.android.exoplayer2.trackselection.MappingTrackSelector; import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; -import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.video.VideoSize; import com.squareup.picasso.Picasso; import com.squareup.picasso.Target; @@ -115,7 +114,6 @@ import org.schabi.newpipe.player.ui.PlayerUiList; import org.schabi.newpipe.player.ui.PopupPlayerUi; import org.schabi.newpipe.player.ui.VideoPlayerUi; import org.schabi.newpipe.util.DependentPreferenceHelper; -import org.schabi.newpipe.util.DeviceUtils; import org.schabi.newpipe.util.ListHelper; import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.PicassoHelper; @@ -522,16 +520,11 @@ public final class Player implements PlaybackListener, Listener { // Setup UIs UIs.call(PlayerUi::initPlayer); - // enable media tunneling - if (DEBUG && PreferenceManager.getDefaultSharedPreferences(context) + // Disable media tunneling if requested by the user from ExoPlayer settings + if (!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) { - Log.d(TAG, "[" + Util.DEVICE_DEBUG_INFO + "] does not support media tunneling"); } } //endregion diff --git a/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java b/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java index 4b08cfcb5..f656c6144 100644 --- a/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java +++ b/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java @@ -36,22 +36,6 @@ public final class DeviceUtils { private static Boolean isTV = null; private static Boolean isFireTV = null; - /* - * Devices that do not support media tunneling - */ - // Formuler Z8 Pro, Z8, CC, Z Alpha, Z+ Neo - private static final boolean HI3798MV200 = Build.VERSION.SDK_INT == 24 - && Build.DEVICE.equals("Hi3798MV200"); - // Zephir TS43UHD-2 - private static final boolean CVT_MT5886_EU_1G = Build.VERSION.SDK_INT == 24 - && Build.DEVICE.equals("cvt_mt5886_eu_1g"); - // Hilife TV - private static final boolean REALTEKATV = Build.VERSION.SDK_INT == 25 - && Build.DEVICE.equals("RealtekATV"); - // Philips QM16XE - private static final boolean QM16XE_U = Build.VERSION.SDK_INT == 23 - && Build.DEVICE.equals("QM16XE_U"); - private DeviceUtils() { } @@ -211,18 +195,6 @@ public final class DeviceUtils { context.getResources().getDisplayMetrics()); } - /** - * Some devices have broken tunneled video playback but claim to support it. - * See https://github.com/TeamNewPipe/NewPipe/issues/5911 - * @return false if affected device - */ - public static boolean shouldSupportMediaTunneling() { - return !HI3798MV200 - && !CVT_MT5886_EU_1G - && !REALTEKATV - && !QM16XE_U; - } - public static boolean isLandscape(final Context context) { return context.getResources().getDisplayMetrics().heightPixels < context.getResources() .getDisplayMetrics().widthPixels; diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 7d8c48bda..8ff617172 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -227,7 +227,6 @@ show_memory_leaks_key allow_disposed_exceptions_key show_original_time_ago_key - disable_media_tunneling_key show_image_indicators_key show_crash_the_player_key check_new_streams @@ -1369,5 +1368,6 @@ exoplayer_settings_key + disable_media_tunneling_key use_exoplayer_decoder_fallback_key diff --git a/app/src/main/res/xml/debug_settings.xml b/app/src/main/res/xml/debug_settings.xml index 7405e47ac..84bb281f3 100644 --- a/app/src/main/res/xml/debug_settings.xml +++ b/app/src/main/res/xml/debug_settings.xml @@ -34,14 +34,6 @@ app:singleLineTitle="false" app:iconSpaceReserved="false" /> - - + + \ No newline at end of file From a02b92fd59ad7585c42fc5839c0d4b360150a4d0 Mon Sep 17 00:00:00 2001 From: AudricV <74829229+AudricV@users.noreply.github.com> Date: Sun, 21 Aug 2022 22:20:29 +0200 Subject: [PATCH 4/5] Update playback load interval size setting description - Remove redundant player restart requirement note, as it is written on the ExoPlayer settings description page; - Add precision about the setting effect/limitation, as it only applies on progressive contents/media sources and not on every content/media source; - Remove translations of this description, to ensure that they will be updated by translators. --- app/src/main/res/values-ar/strings.xml | 1 - app/src/main/res/values-az/strings.xml | 1 - app/src/main/res/values-bs/strings.xml | 1 - app/src/main/res/values-ckb/strings.xml | 1 - app/src/main/res/values-cs/strings.xml | 1 - app/src/main/res/values-da/strings.xml | 3 +-- app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values-el/strings.xml | 1 - app/src/main/res/values-es/strings.xml | 1 - app/src/main/res/values-et/strings.xml | 1 - app/src/main/res/values-eu/strings.xml | 1 - app/src/main/res/values-fa/strings.xml | 1 - app/src/main/res/values-fil/strings.xml | 1 - app/src/main/res/values-fr/strings.xml | 1 - app/src/main/res/values-gl/strings.xml | 1 - app/src/main/res/values-he/strings.xml | 1 - app/src/main/res/values-in/strings.xml | 1 - app/src/main/res/values-it/strings.xml | 1 - app/src/main/res/values-ja/strings.xml | 1 - app/src/main/res/values-lv/strings.xml | 1 - app/src/main/res/values-ml/strings.xml | 1 - app/src/main/res/values-nl-rBE/strings.xml | 1 - app/src/main/res/values-nl/strings.xml | 1 - app/src/main/res/values-pl/strings.xml | 1 - app/src/main/res/values-pt-rBR/strings.xml | 1 - app/src/main/res/values-pt-rPT/strings.xml | 1 - app/src/main/res/values-pt/strings.xml | 1 - app/src/main/res/values-ro/strings.xml | 1 - app/src/main/res/values-ru/strings.xml | 3 +-- app/src/main/res/values-sc/strings.xml | 1 - app/src/main/res/values-sk/strings.xml | 1 - app/src/main/res/values-sv/strings.xml | 1 - app/src/main/res/values-te/strings.xml | 1 - app/src/main/res/values-tr/strings.xml | 1 - app/src/main/res/values-uk/strings.xml | 1 - app/src/main/res/values-vi/strings.xml | 1 - app/src/main/res/values-zh-rCN/strings.xml | 1 - app/src/main/res/values-zh-rHK/strings.xml | 1 - app/src/main/res/values-zh-rTW/strings.xml | 1 - app/src/main/res/values/strings.xml | 2 +- 40 files changed, 3 insertions(+), 42 deletions(-) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 95e620ad8..977177996 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -729,7 +729,6 @@ تعليق مثبت LeakCanary غير متوفر الافتراضي ExoPlayer - تغيير حجم الفاصل الزمني للتحميل (حاليا %s). قد تؤدي القيمة الأقل إلى تسريع تحميل الفيديو الأولي. تتطلب التغييرات إعادة تشغيل المشغل تكوين إشعار مشغل البث الحالي الإشعارات تحميل تفاصيل البث… diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index 8779fb867..14e915a9e 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -496,7 +496,6 @@ Video fayl xülasəsi prosesi üçün bildirişlər Miniatürü 1:1 görünüş nisbətinə kəs - Yükləmə intervalı həcmini dəyişdir (hazırda %s). Daha aşağı dəyər ilkin video yükləməni sürətləndirə bilər. Dəyişikliklər oynadıcını yenidən başlatmağı tələb edir Yayım yaradıcısı, məzmunu və ya axtarış sorğusu haqqında əlavə məlumat olan üst məlumat qutularını gizlətmək üçün söndür Əlaqəli yayımı əlavə etməklə (təkrarlanmayan) sonlanacaq oynatma növbəsini davam etdir Kənar axtarış təklifləri diff --git a/app/src/main/res/values-bs/strings.xml b/app/src/main/res/values-bs/strings.xml index 855c577a6..8654715a6 100644 --- a/app/src/main/res/values-bs/strings.xml +++ b/app/src/main/res/values-bs/strings.xml @@ -70,7 +70,6 @@ Zapamtite posljednju veličinu i položaj iskočnog prozora Koristite brzo neprecizno premotavanje Neprecizno premotavanje dozvoljava pokretaču brže premotavanje s gorom preciznošću. Premotavanje za 5, 15 ili 25 sekundi ne radi s ovim - Promijenite veličinu intervala za učitavanje (trenutačno %s). Niža vrijednost bi vam moglo ubrzat učitavanje videa. Trebate te ponovno učitati pokretač za promjenu. Prebacivanje sa jednog pokretača na drugi bi van moglo zamijeniti pokretni red Isključite da sakrijete komentare Pitajte za potvrdu prije isčišćavanja reda diff --git a/app/src/main/res/values-ckb/strings.xml b/app/src/main/res/values-ckb/strings.xml index 53d32cd93..239740e59 100644 --- a/app/src/main/res/values-ckb/strings.xml +++ b/app/src/main/res/values-ckb/strings.xml @@ -700,7 +700,6 @@ هەموو فایلە دابەزێنراوەکان لە دیسک بسڕدرێتەوە؟ پەیامەکان ناکاراکراون پەیامم بکە - "قەبارەی نێوان بارکردنەکە بگۆڕە (لە ئێستادا %s) . بەهایەکی کەمتر لەوانەیە بارکردنی ڤیدیۆی سەرەتایی خێراتر بکات. گۆڕانکارییەکان پێویستیان بە داگیرساندنەوەی لێدەر هەیە" لەسەدا نیمچەتەن بنەڕەتی ExoPlayer diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index eda30eb11..68fa32c3c 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -691,7 +691,6 @@ Zobrazit krátké oznámení o chybě Připnutý komentář Shodit přehrávač - Změnit interval načítání (aktuálně %s). Menší hodnota může zrychlit počáteční načítání videa. Změna vyžaduje restart přehrávače LeakCanary není dostupné Výchozí ExoPlayer Nastavit oznámení o právě přehrávaném streamu diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 6b16e6eae..3322590e8 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -462,7 +462,6 @@ Download fuldført %s downloads fuldført - Ændr indlæsningsintervallets størrelse (som nu er på %s). En lavere værdi kan øge videoindlæsningshastigheden. Ændringer kræver en genstart af afspiller Den aktive spilleliste bliver udskiftet Hvis du skifter fra en spiller til en anden, kan din kø blive erstattet Vis metainformation @@ -731,4 +730,4 @@ Playlists der er grået ud, indeholder allerede dette objekt. Inaktiver permanent thumbnail Fejlede at kopiere til udklipsholderen - \ No newline at end of file + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 369410508..14fbbc057 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -682,7 +682,6 @@ \nBitte installiere einen Storage Access Framework kompatiblen Dateimanager Angehefteter Kommentar LeakCanary ist nicht verfügbar - Ändern der Größe des Ladeintervalls (derzeit %s). Ein niedrigerer Wert kann das anfängliche Laden des Videos beschleunigen. Änderungen erfordern einen Neustart des Players ExoPlayer Standard Benachrichtigungen Benachrichtigen über neue abonnierbare Streams diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 0a42d5d0f..83df4f5a4 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -681,7 +681,6 @@ Καρφιτσωμένο σχόλιο Το LeakCanary δεν είναι διαθέσιμο Εξ\' ορισμού ExoPlayer - Αλλάξτε το μέγεθος του διαστήματος φόρτωσης (επί του παρόντος είναι %s). Μια χαμηλότερη τιμή μπορεί να επιταχύνει την αρχική φόρτωση βίντεο. Οι αλλαγές απαιτούν επανεκκίνηση της εφαρμογής Ειδοποιήσεις %s νέα ροή diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 91ba5b654..239bfa81c 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -696,7 +696,6 @@ Comentario fijado LeakCanary no está disponible ExoPlayer valor por defecto - Cambie el tamaño del intervalo de carga (actualmente %s). Un valor más bajo puede acelerar la carga inicial de video. Los cambios requieren un reinicio del reproductor Notificaciones Nuevos streams Notificación del reproductor diff --git a/app/src/main/res/values-et/strings.xml b/app/src/main/res/values-et/strings.xml index 9ec65ce99..07b52d9d2 100644 --- a/app/src/main/res/values-et/strings.xml +++ b/app/src/main/res/values-et/strings.xml @@ -681,7 +681,6 @@ Esiletõstetud kommentaar LeakCanary pole saadaval ExoPlayer\'i vaikimisi väärtused - Muuda video laadimise välpa (hetkel %s). Väiksemast väärtusest võib abi olla, kui tahad et video esitamine algaks varem. Muudatuste jõustamine eeldab rakenduse uuesti käivitamist Meediamängija teavitused Teavitused pole kasutusel Kontrollimise sagedus diff --git a/app/src/main/res/values-eu/strings.xml b/app/src/main/res/values-eu/strings.xml index 946de5363..5900031ef 100644 --- a/app/src/main/res/values-eu/strings.xml +++ b/app/src/main/res/values-eu/strings.xml @@ -690,7 +690,6 @@ Kanal honetara harpidetu zara , Txandakatu denak - Aldatu karga maiztasun tamaina (unean %s). Balio txikiago batek bideoaren hasierako karga azkartu dezake. Erreproduzigailuaren berrabiaraztea behar du Harpidetzen jario berriei buruz jakinarazi Ezabatu deskargatutako fitxategi guztiak biltegitik\? Harpidetzentzako jario berrien jakinarazpenak diff --git a/app/src/main/res/values-fa/strings.xml b/app/src/main/res/values-fa/strings.xml index fe5750dd9..22a7956fa 100644 --- a/app/src/main/res/values-fa/strings.xml +++ b/app/src/main/res/values-fa/strings.xml @@ -680,7 +680,6 @@ خطایی رخ داد. آگاهی را ببینید نظر سنجاق شده لیک‌کاناری موجود نیست - تغییر اندازهٔ بازهٔ بار (هم‌اکنون %s). مقداری پایین‌تر، می‌تواند بار کردن نخستین ویدیو را سرعت بخشد. تغییرها نیاز به یک آغاز دوبارهٔ پخش‌کننده دارند پیش‌گزیدهٔ اگزوپلیر آگاهی‌ها بار کردن جزییات جریان… diff --git a/app/src/main/res/values-fil/strings.xml b/app/src/main/res/values-fil/strings.xml index c66d1db75..38719e960 100644 --- a/app/src/main/res/values-fil/strings.xml +++ b/app/src/main/res/values-fil/strings.xml @@ -48,7 +48,6 @@ Pangalawang action button Pangatlong action button Pinapayagan ng di-saktong seek ang player na mag-seek sa mga posisyon nang mabilis ngunit na may pinababang kasaktuhan. Di ito gagana sa pag-seek nang 5, 15, o 25 segundo. - Baguhin ang laki ng pagitan na ilo-load (kasalukuyang %s). Maaaring mapabilis ang unang pag-load sa video kung mababa ito. Kailangang i-restart ang player para gumana ang pagbabago. Patayin para mapigilan ang pag-load sa mga thumbnail, para makatipid ng data at paggamit sa memory. Lilinisin ang parehong image cache na nasa memory at nasa disk Piliin ang mga mungkahing ipapakita habang naghahanap Patayin para itago ang paglalarawan ng video at karagdagang impormasyon diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index ea891723b..496a23b65 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -694,7 +694,6 @@ \nVeuillez installer un gestionnaire de fichiers ou essayez de désactiver « %s » dans les paramètres de téléchargement Commentaire épinglé LeakCanary n\'est pas disponible - Modifie la taille de l\'intervalle de chargement (actuellement %s). Une valeur plus faible peut accélérer le chargement initial des vidéos. Changer cette valeur nécessite de redémarrer le lecteur Valeur par défaut d’ExoPlayer Nouveaux flux Configurer la notification du flux en cours de lecture diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 7aafe4e7e..20ceff5fa 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -671,7 +671,6 @@ Procurar manualmente novas versións A procurar actualizacións… A partir do Android 10, só o \'Sistema de Acceso ao Almacenamento\' está soportado - Cambial dimensión do intervalo de carga (actualmente %s). Un valor máis baixo pode alixeirala carga inicial do vídeo. Os cambios requiren un reinicio da aplicacion Procesando... Pode devagar un momento Crear unha notificación de erro Amosar fitas coloridas de Picasso na cima das imaxes que indican a súa fonte: vermello para a rede, azul para o disco e verde para a memoria diff --git a/app/src/main/res/values-he/strings.xml b/app/src/main/res/values-he/strings.xml index ffd65b736..b1989b842 100644 --- a/app/src/main/res/values-he/strings.xml +++ b/app/src/main/res/values-he/strings.xml @@ -705,7 +705,6 @@ הערה ננעצה LeakCanary אינה זמינה ברירת מחדל של ExoPlayer - שינוי גודל מרווח הטעינה (כרגע %s). ערך נמוך יותר עשוי להאיץ את טעינת הווידאו הראשונית. שינויים דורשים את הפעלת הנגן מחדש התראות על תזרימים חדשים להרשמה תדירות בדיקה נדרש חיבור לרשת diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index 06df20082..985544fe4 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -669,7 +669,6 @@ Komentar dipin LeakCanary tidak tersedia Default ExoPlayer - Ubah ukuran interval pemuatan (saat ini %s). Nilai yang rendah mungkin dapat membuat pemuatan video awal lebih cepat. Perubahan membutuhkan pemutar dimulai ulang Memuat detail stream… Frekuensi pemeriksaan Dibutuhkan koneksi jaringan diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index cac9b0d2a..aff0b3bee 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -693,7 +693,6 @@ Commento in primo piano LeakCanary non è disponibile Predefinito ExoPlayer - Cambia la dimensione dell\'intervallo da caricare (attualmente %s). Un valore basso può velocizzare il caricamento iniziale del video. La modifica richiede il riavvio del lettore Notifiche di nuovi contenuti dalle iscrizioni Frequenza controllo Connessione di rete richiesta diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index e9b0798bb..fafbf91f9 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -688,7 +688,6 @@ 新しいストリーム 通知 現在再生しているストリームの通知を構成 - 読み込み間隔を変更します (現在 %s)。小さくすると再生開始までの時間が短くなります。変更を適用するには再起動が必要です 必要なネットワークの種類 パーセント 半音 diff --git a/app/src/main/res/values-lv/strings.xml b/app/src/main/res/values-lv/strings.xml index 5c5c7ba42..d54d043db 100644 --- a/app/src/main/res/values-lv/strings.xml +++ b/app/src/main/res/values-lv/strings.xml @@ -677,7 +677,6 @@ Tagad varat atlasīt tekstu video aprakstā. Notifikācijas - Izmainīt ielādēšanas intervāla izmēru (pašlaik %s). Zemāka vērtība var paātrināt sākotnējo video ielādi. Izmainot vērtību, nepieciešams restartēt atskaņotāju. Avarēt atskaņotāju Pielāgojiet pašlaik atskaņotās plūsmas notifikāciju Atskaņotāja notifikācija diff --git a/app/src/main/res/values-ml/strings.xml b/app/src/main/res/values-ml/strings.xml index 2a61f4b0a..286e68bc3 100644 --- a/app/src/main/res/values-ml/strings.xml +++ b/app/src/main/res/values-ml/strings.xml @@ -653,6 +653,5 @@ അറിയിപ്പുകൾ പ്ലേയർ അറിയിപ്പ് പുതിയ സ്ട്രീമുകൾ - ലോഡ് ഇടവേള മാറ്റുക (ഇപ്പൊൾ %s). കുറഞ്ഞ മൂല്യം വീഡിയോ വേഗത്തിൽ ലോഡ് ചെയ്യാൻ ഇടയാക്കാം. മാറ്റങ്ങൾ പ്രാഭല്യതിൽ വരുത്താൻ പ്ലേയർ പുനരാരംഭിക്കണം. പ്ലേയർ തകർക്കുക \ No newline at end of file diff --git a/app/src/main/res/values-nl-rBE/strings.xml b/app/src/main/res/values-nl-rBE/strings.xml index 490b75bb8..4c4b5c95d 100644 --- a/app/src/main/res/values-nl-rBE/strings.xml +++ b/app/src/main/res/values-nl-rBE/strings.xml @@ -625,7 +625,6 @@ Nieuwe streams Meldingen over nieuwe streams voor abonnementen NewPipe meldt een fout, tik om te rapporteren - Verander het laadinterval (momenteel %s). Een lagere waarde kan het laden van video versnellen. Vereist een herstart van de speler. %s nieuwe stream %s nieuwe streams diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index bd901a26f..f6d8ccffa 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -680,7 +680,6 @@ \nInstalleer een bestandsbeheerder die compatibel is met het Storage Access Framework Vastgemaakt commentaar LeakCanary is niet beschikbaar - Verander de laad interval tijd (nu %s). Een lagere waarde kan het initiële laden van de video versnellen. De wijziging vereist een herstart van de speler ExoPlayer standaard Speler melding Configureer meldingen van de huidige spelende stream diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 109accb82..895b1a935 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -700,7 +700,6 @@ Przypięty komentarz LeakCanary jest niedostępne Rozmiar interwału ładowania odtwarzania - Zmień rozmiar interwału ładowania (aktualnie %s). Niższa wartość może przyspieszyć początkowe ładowanie wideo. Zmiany wymagają ponownego uruchomienia odtwarzacza domyślny ExoPlayera Powiadomienie odtwarzacza Skonfiguruj powiadomienie aktualnie odtwarzanego strumienia diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 91be57038..bfa888d6b 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -692,7 +692,6 @@ \nInstale um gerenciador de arquivos ou tente desativar \'%s\' nas configurações de download Comentário fixado O LeakCanary não está disponível - Altere o tamanho do intervalo de carregamento (atualmente %s). Um valor menor pode acelerar o carregamento inicial do vídeo. As alterações exigem que o player seja reiniciado ExoPlayer padrão Notificação do reprodutor Configurar a notificação do fluxo da reprodução atual diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 9c3958ba3..f38a4180d 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -692,7 +692,6 @@ \nPor favor, instale um gestor de ficheiros compatível com o Storage Access Framework Comentário fixado LeakCanary não está disponível - Altere o tamanho do intervalo de carregamento (atualmente %s). Um valor menor pode acelerar o carregamento inicial do vídeo. As alterações exigem que o player seja reiniciado Predefinido do ExoPlayer Notificações A carregar detalhes do fluxo… diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 0d71e00b8..9719292ec 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -693,7 +693,6 @@ Comentário fixado LeakCanary não está disponível Predefinido do ExoPlayer - Altere o tamanho do intervalo de carregamento (atualmente %s). Um valor menor pode acelerar o carregamento inicial do vídeo. Se fizer alterações é necessário reiniciar Notificação do reprodutor Configurar a notificação da reprodução do vídeo atual Notificações diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 84eed26ec..bb3ef6665 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -705,7 +705,6 @@ Procent Semiton Implicit ExoPlayer - Modificați dimensiunea intervalului de încărcare (în prezent %s). O valoare mai mică poate accelera încărcarea inițială a videoclipului. Modificările necesită o repornire a playerului Dați crash player-ului LeakCanary nu este disponibil Notificări diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 2f9ca0f4e..687d83549 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -715,7 +715,6 @@ Закреплённый комментарий LeakCanary недоступна Стандартное значение ExoPlayer - Изменить интервал загрузки (сейчас %s). Меньшее значение может ускорить запуск видео. Нужен перезапуск плеера Загрузка сведений о трансляции… Проверить наличие новых трансляций Удалить все загруженные файлы\? @@ -758,4 +757,4 @@ Удалить дубликаты\? Частично просмотрено Вы хотите удалить все повторяющиеся потоки в этом плейлисте\? - \ No newline at end of file + diff --git a/app/src/main/res/values-sc/strings.xml b/app/src/main/res/values-sc/strings.xml index d2af26930..676a8dd07 100644 --- a/app/src/main/res/values-sc/strings.xml +++ b/app/src/main/res/values-sc/strings.xml @@ -681,7 +681,6 @@ Cummentu apicadu LeakCanary no est a disponimentu Valore ExoPlayer predefinidu - Muda sa mannària de s\'intervallu de carrigamentu (in custu momentu %s). Unu valore prus bassu diat pòdere allestrare su carrigamentu de incumintzu de su vìdeu. Sas modìficas tenent bisòngiu de torrare a allùghere su riproduidore Cunfigura sa notìfica de su flussu in cursu de riprodutzione Notìficas de flussos noos dae sas iscritziones diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 05f9c70b9..a21b2dfac 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -693,7 +693,6 @@ Zobraziť krátke oznámenie chyby Oznámte chybu ExoPlayer preddefinovaný - Zmeniť interval načítania (aktuálne %s). Menšia hodnota môže zvýšiť rýchlosť prvotného načítania videa. Zmena vyžaduje reštart Upozornenia Frekvencia kontroly Vymazať všetky stiahnuté súbory z disku\? diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 92a1d2294..a3bb7068b 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -681,7 +681,6 @@ Fäst kommentar LeakCanary är inte tillgänglig ExoPlayer standard - Ändra inläsningsintervallets storlek (för närvarande %s). Ett lägre värde kan påskynda den första videoinläsningen. Ändringar kräver omstart av spelaren Uppdateringsintervall Nödvändig nätverksanslutning Alla nätverk diff --git a/app/src/main/res/values-te/strings.xml b/app/src/main/res/values-te/strings.xml index fd38b35d5..a0e65045e 100644 --- a/app/src/main/res/values-te/strings.xml +++ b/app/src/main/res/values-te/strings.xml @@ -417,7 +417,6 @@ పరివీక్షణ తేలియాడే విధంగా మార్చు తదుపరి స్ట్రీమ్‌ను స్వీయ-ఎన్క్యూ - లోడ్ విరామం పరిమాణాన్ని మార్చండి (ప్రస్తుతం %s). తక్కువ విలువ ప్రారంభ వీడియో లోడింగ్‌ని వేగవంతం చేయవచ్చు. మార్పులకు ప్లేయర్ రీస్టార్ట్ అవసరం. LeakCanary అందుబాటులో లేదు ప్లేయర్ శీర్షిక వచన స్థాయి మరియు నేపథ్య శైలులను సవరించండి. అమలులోకి రావడానికి యాప్ రీస్టార్ట్ అవసరం స్వయంచాలకంగా రూపొందించబడింది (ఎక్కించినవారు కనబడుటలేదు) diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 7943e8adf..9b07dd7f7 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -679,7 +679,6 @@ Oynatıcıyı çöktür Sabitlenmiş yorum LeakCanary yok - Yükleme ara boyutunu değiştir (şu anda %s). Düşük bir değer videonun ilk yüklenişini hızlandırabilir. Değişiklikler oynatıcının yeniden başlatılmasını gerektirir ExoPlayer öntanımlısı Yeni akış bildirimleri Bildirimler diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 6706396ae..4436b30e9 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -697,7 +697,6 @@ Закріплений коментар LeakCanary недоступний Типовий ExoPlayer - Змінити розмір інтервалу завантаження (наразі %s). Менше значення може прискорити початкове завантаження відео. Зміни вимагають перезапуску програвача Ви підписалися на цей канал , Сповіщення про нові трансляції для підписок diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index fc00769ba..7d0f15132 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -666,7 +666,6 @@ \nVui lòng cài đặt ứng dụng quản lý tệp tương thích với Storage Access Framework. Không tìm thấy ứng dụng quản lý tệp phù hợp nào để thực hiện hành động. \nVui lòng cài đặt ứng dụng quản lý tệp hoặc tắt \'%s\' trong cài đặt tải xuống - Thay đổi kích thước khoảng thời gian tải (tầm khoảng %s). Để ở giá trị thấp hơn có thể sẽ tăng tốc độ tải video hơn ban đầu. Khởi động lại trình phát để áp dụng thay đổi LeakCanary không khả dụng ExoPlayer mặc định Bình luận được ghim diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 4ee6bc285..b4dfa142c 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -668,7 +668,6 @@ NewPipe 遇到了一个错误,点击此处报告此错误 置顶评论 LeakCanary 不可用 - 更改加载间隔的大小(当前为 %s),较低的值可以加快视频的首次加载速度。更改需要重启播放器 ExoPlayer 默认 配置当前正在播放的串流的通知 新串流通知 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 8e83c4015..d70913965 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -646,7 +646,6 @@ 係咪要全部剷走晒播放到邊個位? 百分比 半音 - 更改載入斬件大細 (目前係 %s)。細啲或者可以等條片快啲開波。更改要開過個播放器至生效 問過先至將排隊播清零 目前播放器入面嘅排隊播將會清零 加一個站 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 75e77fa18..15bf15a0f 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -669,7 +669,6 @@ 釘選的留言 LeakCanary 無法使用 ExoPlayer 預設值 - 變更載入間隔大小(目前為 %s)。較低的值可能會提昇初始影片載入速度。變更需要重新啟動播放器 播放器通知 通知 正在載入串流詳細資訊…… diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1dad7c01d..767dadab0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -79,7 +79,7 @@ Inexact seek allows the player to seek to positions faster with reduced precision. Seeking for 5, 15 or 25 seconds doesn\'t work with this Fast-forward/-rewind seek duration Playback load interval size - Change the load interval size (currently %s). A lower value may speed up initial video loading. Changes require a player restart + Change the load interval size on progressive contents (currently %s). A lower value may speed up their initial loading Ask for confirmation before clearing a queue Switching from one player to another may replace your queue The active player queue will be replaced From 787758a4360063cafce3f77d8cf562082419945f Mon Sep 17 00:00:00 2001 From: AudricV <74829229+AudricV@users.noreply.github.com> Date: Sun, 26 Feb 2023 19:39:17 +0100 Subject: [PATCH 5/5] [Android 6+] Add ability to always use ExoPlayer's MediaVideoCodecRenderer setOutputSurface workaround As some devices not present in ExoPlayer's list may not implement MediaCodec.setOutputSurface(Surface) properly, this workaround could be useful on these devices. It forces ExoPlayer to fall back on releasing and re-instantiating video codec instances, which is always used on Android 5 and lower due to addition of this method in Android 6. To do so, a CustomMediaCodecVideoRenderer, based on ExoPlayer's MediaVideoCodecRenderer which always return true for the codecNeedsSetOutputSurfaceWorkaround method has been added, which is used in CustomRenderersFactory, a class based on DefaultRenderersFactory which always returns our CustomMediaCodecVideoRenderer as the video renderers. CustomRenderersFactory replaces DefaultRenderersFactory in the player, in the case this setting is enabled. --- .../org/schabi/newpipe/player/Player.java | 17 ++++-- .../helper/CustomMediaCodecVideoRenderer.java | 54 +++++++++++++++++++ .../player/helper/CustomRenderersFactory.java | 43 +++++++++++++++ app/src/main/res/values/settings_keys.xml | 1 + app/src/main/res/values/strings.xml | 2 + app/src/main/res/xml/exoplayer_settings.xml | 10 +++- 6 files changed, 121 insertions(+), 6 deletions(-) create mode 100644 app/src/main/java/org/schabi/newpipe/player/helper/CustomMediaCodecVideoRenderer.java create mode 100644 app/src/main/java/org/schabi/newpipe/player/helper/CustomRenderersFactory.java 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 5dc9382e7..b446cbb81 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -69,7 +69,6 @@ import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.PlaybackException; import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.Player.PositionInfo; -import com.google.android.exoplayer2.RenderersFactory; import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.Tracks; import com.google.android.exoplayer2.source.MediaSource; @@ -95,6 +94,7 @@ import org.schabi.newpipe.local.history.HistoryRecordManager; import org.schabi.newpipe.player.event.PlayerEventListener; import org.schabi.newpipe.player.event.PlayerServiceEventListener; import org.schabi.newpipe.player.helper.AudioReactor; +import org.schabi.newpipe.player.helper.CustomRenderersFactory; import org.schabi.newpipe.player.helper.LoadController; import org.schabi.newpipe.player.helper.PlayerDataSource; import org.schabi.newpipe.player.helper.PlayerHelper; @@ -196,7 +196,7 @@ public final class Player implements PlaybackListener, Listener { @NonNull private final DefaultTrackSelector trackSelector; @NonNull private final LoadController loadController; - @NonNull private final RenderersFactory renderFactory; + @NonNull private final DefaultRenderersFactory renderFactory; @NonNull private final VideoPlaybackResolver videoResolver; @NonNull private final AudioPlaybackResolver audioResolver; @@ -261,9 +261,16 @@ public final class Player implements PlaybackListener, Listener { final PlayerDataSource dataSource = new PlayerDataSource(context, new DefaultBandwidthMeter.Builder(context).build()); loadController = new LoadController(); - renderFactory = new DefaultRenderersFactory(context) - .setEnableDecoderFallback(prefs.getBoolean( - context.getString(R.string.use_exoplayer_decoder_fallback_key), false)); + + renderFactory = prefs.getBoolean( + context.getString( + R.string.always_use_exoplayer_set_output_surface_workaround_key), false) + ? new CustomRenderersFactory(context) : new DefaultRenderersFactory(context); + + renderFactory.setEnableDecoderFallback( + prefs.getBoolean( + context.getString( + R.string.use_exoplayer_decoder_fallback_key), false)); videoResolver = new VideoPlaybackResolver(context, dataSource, getQualityResolver()); audioResolver = new AudioPlaybackResolver(context, dataSource); diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/CustomMediaCodecVideoRenderer.java b/app/src/main/java/org/schabi/newpipe/player/helper/CustomMediaCodecVideoRenderer.java new file mode 100644 index 000000000..66ac6d50b --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/player/helper/CustomMediaCodecVideoRenderer.java @@ -0,0 +1,54 @@ +package org.schabi.newpipe.player.helper; + +import android.content.Context; +import android.os.Handler; + +import androidx.annotation.Nullable; + +import com.google.android.exoplayer2.mediacodec.MediaCodecAdapter; +import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; +import com.google.android.exoplayer2.video.MediaCodecVideoRenderer; +import com.google.android.exoplayer2.video.VideoRendererEventListener; + +/** + * A {@link MediaCodecVideoRenderer} which always enable the output surface workaround that + * ExoPlayer enables on several devices which are known to implement + * {@link android.media.MediaCodec#setOutputSurface(android.view.Surface) + * MediaCodec.setOutputSurface(Surface)} incorrectly. + * + *

+ * See {@link MediaCodecVideoRenderer#codecNeedsSetOutputSurfaceWorkaround(String)} for more + * details. + *

+ * + *

+ * This custom {@link MediaCodecVideoRenderer} may be useful in the case a device is affected by + * this issue but is not present in ExoPlayer's list. + *

+ * + *

+ * This class has only effect on devices with Android 6 and higher, as the {@code setOutputSurface} + * method is only implemented in these Android versions and the method used as a workaround is + * always applied on older Android versions (releasing and re-instantiating video codec instances). + *

+ */ +public final class CustomMediaCodecVideoRenderer extends MediaCodecVideoRenderer { + + @SuppressWarnings({"checkstyle:ParameterNumber", "squid:S107"}) + public CustomMediaCodecVideoRenderer(final Context context, + final MediaCodecAdapter.Factory codecAdapterFactory, + final MediaCodecSelector mediaCodecSelector, + final long allowedJoiningTimeMs, + final boolean enableDecoderFallback, + @Nullable final Handler eventHandler, + @Nullable final VideoRendererEventListener eventListener, + final int maxDroppedFramesToNotify) { + super(context, codecAdapterFactory, mediaCodecSelector, allowedJoiningTimeMs, + enableDecoderFallback, eventHandler, eventListener, maxDroppedFramesToNotify); + } + + @Override + protected boolean codecNeedsSetOutputSurfaceWorkaround(final String name) { + return true; + } +} diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/CustomRenderersFactory.java b/app/src/main/java/org/schabi/newpipe/player/helper/CustomRenderersFactory.java new file mode 100644 index 000000000..668b48c30 --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/player/helper/CustomRenderersFactory.java @@ -0,0 +1,43 @@ +package org.schabi.newpipe.player.helper; + +import android.content.Context; +import android.os.Handler; + +import com.google.android.exoplayer2.DefaultRenderersFactory; +import com.google.android.exoplayer2.Renderer; +import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; +import com.google.android.exoplayer2.video.VideoRendererEventListener; + +import java.util.ArrayList; + +/** + * A {@link DefaultRenderersFactory} which only uses {@link CustomMediaCodecVideoRenderer} as an + * implementation of video codec renders. + * + *

+ * As no ExoPlayer extension is currently used, the reflection code used by ExoPlayer to try to + * load video extension libraries is not needed in our case and has been removed. This should be + * changed in the case an extension is shipped with the app, such as the AV1 one. + *

+ */ +public final class CustomRenderersFactory extends DefaultRenderersFactory { + + public CustomRenderersFactory(final Context context) { + super(context); + } + + @SuppressWarnings("checkstyle:ParameterNumber") + @Override + protected void buildVideoRenderers(final Context context, + @ExtensionRendererMode final int extensionRendererMode, + final MediaCodecSelector mediaCodecSelector, + final boolean enableDecoderFallback, + final Handler eventHandler, + final VideoRendererEventListener eventListener, + final long allowedVideoJoiningTimeMs, + final ArrayList out) { + out.add(new CustomMediaCodecVideoRenderer(context, getCodecAdapterFactory(), + mediaCodecSelector, allowedVideoJoiningTimeMs, enableDecoderFallback, eventHandler, + eventListener, MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY)); + } +} diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 8ff617172..f9d0572e8 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -1370,4 +1370,5 @@ exoplayer_settings_key disable_media_tunneling_key use_exoplayer_decoder_fallback_key + always_use_exoplayer_set_output_surface_workaround_key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 767dadab0..5730e063e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -777,4 +777,6 @@ Manage some ExoPlayer settings. These changes require a player restart to take effect Use ExoPlayer\'s decoder fallback feature Enable this option if you have decoder initialization issues, which falls back to lower-priority decoders if primary decoders initialization fail. This may result in poor playback performance than when using primary decoders + Always use ExoPlayer\'s video output surface setting workaround + This workaround releases and re-instantiates video codecs when a surface change occurs, instead of setting the surface to the codec directly. Already used by ExoPlayer on some devices with this issue, this setting has only an effect on Android 6 and higher\n\nEnabling this option may prevent playback errors when switching the current video player or switching to fullscreen \ No newline at end of file diff --git a/app/src/main/res/xml/exoplayer_settings.xml b/app/src/main/res/xml/exoplayer_settings.xml index d855ad936..7e903fff1 100644 --- a/app/src/main/res/xml/exoplayer_settings.xml +++ b/app/src/main/res/xml/exoplayer_settings.xml @@ -29,4 +29,12 @@ app:singleLineTitle="false" app:iconSpaceReserved="false" /> - \ No newline at end of file + + +