Skip to content

Commit

Permalink
Merge pull request #6288 from Redirion/debugtunnellingoff
Browse files Browse the repository at this point in the history
Add debug option to disable media tunneling
  • Loading branch information
TobiGr authored May 14, 2021
2 parents 0ff6751 + 4038617 commit 9fc6f19
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/src/main/java/org/schabi/newpipe/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,11 @@ private void initPlayer(final boolean playOnReady) {
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) {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/settings_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@
<string name="allow_heap_dumping_key" translatable="false">allow_heap_dumping_key</string>
<string name="show_memory_leaks_key" translatable="false">show_memory_leaks_key</string>
<string name="allow_disposed_exceptions_key" translatable="false">allow_disposed_exceptions_key</string>
<string name="show_original_time_ago_key" translatable="false">show_original_time_ago_text_key</string>
<string name="show_original_time_ago_key" translatable="false">show_original_time_ago_key</string>
<string name="disable_media_tunneling_key" translatable="false">disable_media_tunneling_key</string>
<string name="crash_the_app_key" translatable="false">crash_the_app_key</string>

<!-- THEMES -->
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,8 @@
<string name="enable_disposed_exceptions_summary">Force reporting of undeliverable Rx exceptions outside of fragment or activity lifecycle after disposal</string>
<string name="show_original_time_ago_title">Show original time ago on items</string>
<string name="show_original_time_ago_summary">Original texts from services will be visible in stream items</string>
<string name="disable_media_tunneling_title">Disable media tunneling</string>
<string name="disable_media_tunneling_summary">Disable media tunneling if you experience a black screen or stuttering on video playback</string>
<string name="crash_the_app">Crash the app</string>
<!-- Subscriptions import/export -->
<string name="import_export_title">Import/export</string>
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/xml/debug_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
android:title="@string/show_original_time_ago_title"
app:iconSpaceReserved="false" />

<SwitchPreferenceCompat
android:defaultValue="false"
android:key="@string/disable_media_tunneling_key"
android:summary="@string/disable_media_tunneling_summary"
android:title="@string/disable_media_tunneling_title"
app:iconSpaceReserved="false" />

<Preference
android:key="@string/crash_the_app_key"
android:title="@string/crash_the_app"
Expand Down

0 comments on commit 9fc6f19

Please sign in to comment.