Skip to content

Commit 4a9d210

Browse files
author
Robin
committed
Disabled tunneling on Hi3798MV200
1 parent 5739caa commit 4a9d210

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

app/src/main/java/org/schabi/newpipe/player/Player.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
7575
import com.google.android.exoplayer2.ui.SubtitleView;
7676
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
77+
import com.google.android.exoplayer2.util.Util;
7778
import com.google.android.exoplayer2.video.VideoListener;
7879
import com.google.android.material.floatingactionbutton.FloatingActionButton;
7980
import com.nostra13.universalimageloader.core.ImageLoader;
@@ -488,8 +489,13 @@ private void initPlayer(final boolean playOnReady) {
488489
// Setup subtitle view
489490
simpleExoPlayer.addTextOutput(binding.subtitleView);
490491

491-
// Setup audio session with onboard equalizer
492-
trackSelector.setParameters(trackSelector.buildUponParameters().setTunnelingEnabled(true));
492+
// enable media tunneling
493+
if (DeviceUtils.shouldSupportMediaTunneling()) {
494+
trackSelector.setParameters(
495+
trackSelector.buildUponParameters().setTunnelingEnabled(true));
496+
} else if (DEBUG) {
497+
Log.d(TAG, "[" + Util.DEVICE_DEBUG_INFO + "] does not support media tunneling");
498+
}
493499
}
494500

495501
private void initListeners() {

app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ public final class DeviceUtils {
2020
private static final String AMAZON_FEATURE_FIRE_TV = "amazon.hardware.fire_tv";
2121
private static Boolean isTV = null;
2222

23+
/*
24+
* Devices that do not support media tunneling
25+
*/
26+
// Formuler Z8 Pro, Z8, CC, Z Alpha, Z+ Neo
27+
private static final boolean HI3798MV200 = Build.VERSION.SDK_INT == 24
28+
&& Build.DEVICE.equals("Hi3798MV200");
29+
2330
private DeviceUtils() {
2431
}
2532

@@ -88,4 +95,15 @@ public static int spToPx(@Dimension(unit = Dimension.SP) final int sp,
8895
sp,
8996
context.getResources().getDisplayMetrics());
9097
}
98+
99+
/**
100+
* Some devices have broken tunneled video playback but claim to support it.
101+
* See https://github.com/TeamNewPipe/NewPipe/issues/5911
102+
* @return false if Kitkat (does not support tunneling) or affected device
103+
*/
104+
public static boolean shouldSupportMediaTunneling() {
105+
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
106+
&& !HI3798MV200;
107+
}
108+
91109
}

0 commit comments

Comments
 (0)