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
+
+
+