Skip to content

Commit a62ee43

Browse files
fix(YouTube - Spoof video streams): Resolve playback dropping frames (#6051)
1 parent 6a79911 commit a62ee43

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class SpoofVideoStreamsPatch {
3939
@Nullable
4040
private static volatile AppLanguage languageOverride;
4141

42-
private static volatile ClientType preferredClient = ClientType.ANDROID_VR_1_61_48;
42+
private static volatile ClientType preferredClient = ClientType.ANDROID_VR_1_43_32;
4343

4444
/**
4545
* @return If this patch was included during patching.

extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/spoof/SpoofVideoStreamsPatch.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,20 @@ public class SpoofVideoStreamsPatch {
1818
* Injection point.
1919
*/
2020
public static void setClientOrderToUse() {
21-
final boolean forceAVC = Settings.FORCE_AVC_CODEC.get();
22-
23-
// VR 1.61 uses VP9/AV1, and cannot force AVC.
2421
ClientType client = Settings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get();
25-
if (forceAVC && client == ANDROID_VR_1_61_48) {
26-
client = ANDROID_VR_1_43_32; // Use VR 1.43 instead.
22+
23+
24+
if (Settings.FORCE_AVC_CODEC.get() && client == ANDROID_VR_1_61_48) {
25+
// VR 1.61 uses VP9/AV1, and cannot force AVC. Use 1.43 instead.
26+
client = ANDROID_VR_1_43_32;
2727
}
2828

29-
List<ClientType> availableClients = forceAVC
30-
? List.of(
29+
List<ClientType> availableClients = List.of(
3130
ANDROID_VR_1_43_32,
3231
VISIONOS,
3332
ANDROID_CREATOR,
3433
ANDROID_VR_1_61_48,
35-
IPADOS)
36-
: List.of(
37-
ANDROID_VR_1_61_48,
38-
VISIONOS,
39-
ANDROID_CREATOR,
40-
ANDROID_VR_1_43_32,
41-
IPADOS
42-
);
34+
IPADOS);
4335

4436
app.revanced.extension.shared.spoof.SpoofVideoStreamsPatch.setClientsToUse(
4537
availableClients, client);

extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public class Settings extends BaseSettings {
356356
public static final BooleanSetting EXTERNAL_BROWSER = new BooleanSetting("revanced_external_browser", TRUE, true);
357357
public static final BooleanSetting SPOOF_DEVICE_DIMENSIONS = new BooleanSetting("revanced_spoof_device_dimensions", FALSE, true,
358358
"revanced_spoof_device_dimensions_user_dialog_message");
359-
public static final EnumSetting<ClientType> SPOOF_VIDEO_STREAMS_CLIENT_TYPE = new EnumSetting<>("revanced_spoof_video_streams_client_type", ClientType.ANDROID_VR_1_61_48, true, parent(SPOOF_VIDEO_STREAMS));
359+
public static final EnumSetting<ClientType> SPOOF_VIDEO_STREAMS_CLIENT_TYPE = new EnumSetting<>("revanced_spoof_video_streams_client_type", ClientType.ANDROID_VR_1_43_32, true, parent(SPOOF_VIDEO_STREAMS));
360360
public static final BooleanSetting DEBUG_PROTOBUFFER = new BooleanSetting("revanced_debug_protobuffer", FALSE, false,
361361
"revanced_debug_protobuffer_user_dialog_message", parent(BaseSettings.DEBUG));
362362

extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/preference/SpoofStreamingDataSideEffectsPreference.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,17 @@ private void updateUI() {
8383
String summary = str("revanced_spoof_video_streams_about_no_audio_tracks");
8484

8585
switch (clientType) {
86-
case ANDROID_VR_1_61_48 ->
87-
summary += '\n' + str("revanced_spoof_video_streams_about_no_stable_volume");
8886
case ANDROID_CREATOR ->
89-
summary += '\n' + str("revanced_spoof_video_streams_about_no_av1")
90-
+ '\n' + str("revanced_spoof_video_streams_about_no_stable_volume")
91-
+ '\n' + str("revanced_spoof_video_streams_about_no_force_original_audio");
87+
summary += '\n' + str("revanced_spoof_video_streams_about_no_stable_volume")
88+
+ '\n' + str("revanced_spoof_video_streams_about_no_av1")
89+
+ '\n' + str("revanced_spoof_video_streams_about_no_force_original_audio");
90+
case ANDROID_VR_1_43_32 ->
91+
summary += '\n' + str("revanced_spoof_video_streams_about_no_stable_volume")
92+
+ '\n' + str("revanced_spoof_video_streams_about_no_av1");
93+
case ANDROID_VR_1_61_48 ->
94+
summary = str("revanced_spoof_video_streams_about_dropped_frames")
95+
+ '\n' + summary
96+
+ '\n' + str("revanced_spoof_video_streams_about_no_stable_volume");
9297
case IPADOS ->
9398
summary = str("revanced_spoof_video_streams_about_playback_failure")
9499
+ '\n' + str("revanced_spoof_video_streams_about_no_av1");

patches/src/main/resources/addresources/values/arrays.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,14 @@
137137
<app id="youtube">
138138
<patch id="misc.fix.playback.spoofVideoStreamsPatch">
139139
<string-array name="revanced_spoof_video_streams_client_type_entries">
140-
<item>Android VR</item>
140+
<item>Android VR 1.43</item>
141+
<item>Android VR 1.61</item>
141142
<item>Android Studio</item>
142143
<item>visionOS</item>
143144
<item>iPadOS</item>
144145
</string-array>
145146
<string-array name="revanced_spoof_video_streams_client_type_entry_values">
147+
<item>ANDROID_VR_1_43_32</item>
146148
<item>ANDROID_VR_1_61_48</item>
147149
<item>ANDROID_CREATOR</item>
148150
<item>VISIONOS</item>

patches/src/main/resources/addresources/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,7 @@ Limitations:
16871687
<string name="revanced_spoof_video_streams_about_no_audio_tracks">• Audio track menu is missing</string>
16881688
<string name="revanced_spoof_video_streams_about_no_av1">• No AV1 video codec</string>
16891689
<string name="revanced_spoof_video_streams_about_no_stable_volume">• Stable volume is not available</string>
1690+
<string name="revanced_spoof_video_streams_about_dropped_frames">• Playback may stutter or drop frames</string>
16901691
<string name="revanced_spoof_video_streams_about_kids_videos">• Kids videos may not play when logged out or in incognito mode</string>
16911692
<!-- "Force original audio" should use the same text as revanced_force_original_audio_title -->
16921693
<string name="revanced_spoof_video_streams_about_no_force_original_audio">• Force original audio is not available</string>

0 commit comments

Comments
 (0)