Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

feat(YouTube - Spoof client): Allow forcing AVC codec with iOS #679

Merged
merged 11 commits into from
Aug 22, 2024
Merged

feat(YouTube - Spoof client): Allow forcing AVC codec with iOS #679

merged 11 commits into from
Aug 22, 2024

Conversation

LisoUseInAIKyrios
Copy link
Contributor

@LisoUseInAIKyrios LisoUseInAIKyrios commented Aug 21, 2024

Integration changes for ReVanced/revanced-patches#3570

@LisoUseInAIKyrios
Copy link
Contributor Author

LisoUseInAIKyrios commented Aug 21, 2024

it might be worth adding a toggle for iOS to force AVC1, as it appears some devices can act up when using VP9 (even though they have VP9 hardware decoding)

ReVanced/revanced-patches#3353

edit: the issue above might be unrelated and have nothing to do with AVC1 vs VP9

@oSumAtrIX
Copy link
Member

Why would the issue be unrelated?

@LisoUseInAIKyrios
Copy link
Contributor Author

Because the user in that issue also saw dropped frames in Android VR as well.

@LisoUseInAIKyrios
Copy link
Contributor Author

LisoUseInAIKyrios commented Aug 21, 2024

It might be worth renaming revanced_spoof_client_use_ios to something else, as this setting was originally default off, then it was removed, then it came back as default on.

So some users updating from the first release of Spoof client will have Android VR turned on by default, caused by their old settings.

The downside to this change is anyone who currently has and wants Android VR will have to change the setting again.

@LisoUseInAIKyrios LisoUseInAIKyrios changed the title fix(YouTube - Spoof client): Use iOS VP9 only if device has hardware decoding feat(YouTube - Spoof client): Allow forcing AVC1 codec with iOS Aug 21, 2024
@LisoUseInAIKyrios
Copy link
Contributor Author

LisoUseInAIKyrios commented Aug 21, 2024

Added AVC1 (aka H.264) override.

Googling for "VP9 problems" and you get many forum and bug reports for non YouTube apps that struggle with VP9 (and report no problem with AVC1), despite the reported devices officially supporting VP9. So perhaps the devices don't support VP9 in all codec configurations, or the device overheats with VP9 and throttles the chipset.

The users who report VP9 issues seem to be those with older first generation VP9 chipsets (such as Snapdragon 810 released in 2015), or they have a budget non mainstream chipset.

…ference due to excessive text clipping in foreign languages
@kitadai31
Copy link
Contributor

After some sleep, I finally came up with a logic to check both codecs in one check. 😅
Please give me a chance to suggest this code.

/**
 * @return 0 = AVC, 1 = VP9, 2 = AV1
 */
private static int checkSupportedHardwareDecoding() {
    boolean vp9found = false;
    MediaCodecList codecList = new MediaCodecList(MediaCodecList.ALL_CODECS);

    for (MediaCodecInfo codecInfo : codecList.getCodecInfos()) {
        final boolean isHardwareAccelerated = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
                ? codecInfo.isHardwareAccelerated()
                : !codecInfo.getName().startsWith("OMX.google"); // Software decoder.
        if (isHardwareAccelerated && !codecInfo.isEncoder()) {
            for (String type : codecInfo.getSupportedTypes()) {
                if (type.equalsIgnoreCase("video/av01")) {
                    Logger.printDebug(() -> "Device supports AV1 hardware decoding.");
                    return 2;
                } else if (!vp9found && type.equalsIgnoreCase("video/x-vnd.on2.vp9")) {
                    vp9found = true;
                }
            }
        }
    }

    if (vp9found) {
        Logger.printDebug(() -> "Device supports VP9 hardware decoding.");
        return 1;
    } else {
        Logger.printDebug(() -> "Device does not support either VP9 or AV1 hardware decoding.");
        return 0;
    }
}

/**
 * Represents the hardware decoding supported by the device.
 * 0 = AVC only.
 * 1 = VP9 hardware decoding is supported.
 * 2 = AV1 hardware decoding is supported.
 */
private static final int SUPPORTED_CODEC_LEVEL = checkSupportedHardwareDecoding();
private static boolean allowVP9() {
    return SUPPORTED_CODEC_LEVEL >= 1 && !Settings.SPOOF_CLIENT_IOS_FORCE_AVC1.get();
}
private static boolean allowAV1() {
    return SUPPORTED_CODEC_LEVEL >= 2;
}

I have no idea if this code is well designed or not.

@LisoUseInAIKyrios
Copy link
Contributor Author

That works. But for this situation I think a little copy paste and using two methods is simpler and easier to understand.

@LisoUseInAIKyrios LisoUseInAIKyrios changed the title feat(YouTube - Spoof client): Allow forcing AVC1 codec with iOS feat(YouTube - Spoof client): Allow forcing AVC codec with iOS Aug 21, 2024
@LisoUseInAIKyrios LisoUseInAIKyrios merged commit 2c471f3 into ReVanced:dev Aug 22, 2024
2 checks passed
@LisoUseInAIKyrios LisoUseInAIKyrios deleted the fix/client_spoof_vp9 branch August 22, 2024 17:47
revanced-bot pushed a commit that referenced this pull request Aug 22, 2024
# [1.14.0-dev.1](v1.13.1-dev.2...v1.14.0-dev.1) (2024-08-22)

### Features

* **YouTube - Spoof client:** Allow forcing AVC codec with iOS ([#679](#679)) ([2c471f3](2c471f3))
zainarbani pushed a commit to zainarbani/revanced-integrations that referenced this pull request Aug 26, 2024
# [1.14.0-dev.1](v1.13.1...v1.14.0-dev.1) (2024-08-26)

### Bug Fixes

* **YouTube - Hide layout components:** Hide new kind of community post ([ReVanced#678](https://github.com/zainarbani/revanced-integrations/issues/678)) ([6be257a](6be257a))
* **YouTube - SponsorBlock:** Handle if the user enters an invalid number into any SB settings ([01f084d](01f084d))
* **YouTube - Spoof Client:** Fix playback by replace streaming data ([d498d79](d498d79))

### Features

* **YouTube - Spoof client:** Allow forcing AVC codec with iOS ([ReVanced#679](https://github.com/zainarbani/revanced-integrations/issues/679)) ([2c471f3](2c471f3))
revanced-bot pushed a commit that referenced this pull request Sep 18, 2024
# [1.14.0](v1.13.0...v1.14.0) (2024-09-18)

### Bug Fixes

* **YouTube - Check environment patch:** Allow adb installs even if patched more than 30 minutes ago ([5adf8bd](5adf8bd))
* **YouTube - Check environment patch:** Show if patched apk is too old, if the install source is not Manager or ADB ([18048f3](18048f3))
* **YouTube - Check environment patch:** Use app install/update time instead of current time ([#687](#687)) ([b0d82b0](b0d82b0))
* **YouTube - GmsCore support:** Show an error toast if GmsCore is included with root mounted installation ([#686](#686)) ([a4848be](a4848be))
* **YouTube - Hide layout components:** Hide new kind of community post ([#678](#678)) ([6be257a](6be257a))
* **YouTube - Return YouTube Dislike:** Show correct value when swiping back to prior Short and disliking ([2eb5e3a](2eb5e3a))
* **YouTube - ReturnYouTubeDislike:** Show estimated like count for videos with hidden likes ([#684](#684)) ([27d2b60](27d2b60))
* **YouTube - SponsorBlock:** Add summary text to 'view my segments' button ([0f5dfb4](0f5dfb4))
* **YouTube - SponsorBlock:** Handle if the user enters an invalid number into any SB settings ([01f084d](01f084d))
* **YouTube:** Fix issues related to playback by replace streaming data ([#680](#680)) ([0468235](0468235))

### Features

* Add `Check environment` patch ([#683](#683)) ([e856455](e856455))
* **YouTube - Hide Shorts components:** Hide 'Use this sound' button ([#691](#691)) ([6f3d2ff](6f3d2ff))
* **YouTube - Keyword filter:** Add syntax to match whole keywords and not substrings ([#681](#681)) ([5314dd9](5314dd9))
* **YouTube - Spoof client:** Allow forcing AVC codec with iOS ([#679](#679)) ([2c471f3](2c471f3))
* **YouTube:** Add donation link to settings about screen ([#688](#688)) ([b816c45](b816c45))
github-actions bot pushed a commit to zainarbani/revanced-integrations that referenced this pull request Oct 4, 2024
# [1.17.0-dev.1](v1.16.1...v1.17.0-dev.1) (2024-10-04)

### Bug Fixes

* **YouTube - Check environment patch:** Allow adb installs even if patched more than 30 minutes ago ([5adf8bd](5adf8bd))
* **YouTube - Check environment patch:** Show if patched apk is too old, if the install source is not Manager or ADB ([18048f3](18048f3))
* **YouTube - Check environment patch:** Use app install/update time instead of current time ([ReVanced#687](https://github.com/zainarbani/revanced-integrations/issues/687)) ([b0d82b0](b0d82b0))
* **YouTube - Check environment:** Only use fields available since Android 8 ([ReVanced#693](https://github.com/zainarbani/revanced-integrations/issues/693)) ([c0829c3](c0829c3))
* **YouTube - Check watch history domain name resolution:** Do not show warning if network connection is flaky ([ReVanced#702](https://github.com/zainarbani/revanced-integrations/issues/702)) ([80482df](80482df))
* **YouTube - GmsCore support:** Show an error toast if GmsCore is included with root mounted installation ([ReVanced#686](https://github.com/zainarbani/revanced-integrations/issues/686)) ([a4848be](a4848be))
* **YouTube - Hide layout components:** Hide new kind of community post ([ReVanced#678](https://github.com/zainarbani/revanced-integrations/issues/678)) ([6be257a](6be257a))
* **YouTube - Hide layout components:** Hide new kind of community posts ([ReVanced#695](https://github.com/zainarbani/revanced-integrations/issues/695)) ([b384926](b384926))
* **YouTube - Return YouTube Dislike:** Show correct value when swiping back to prior Short and disliking ([2eb5e3a](2eb5e3a))
* **YouTube - ReturnYouTubeDislike:** Show estimated like count for videos with hidden likes ([ReVanced#684](https://github.com/zainarbani/revanced-integrations/issues/684)) ([27d2b60](27d2b60))
* **YouTube - SponsorBlock:** Add summary text to 'view my segments' button ([0f5dfb4](0f5dfb4))
* **YouTube - SponsorBlock:** Handle if the user enters an invalid number into any SB settings ([01f084d](01f084d))
* **YouTube - Spoof video streams:** Change default client type to Android VR ([a2e8bbb](a2e8bbb))
* **YouTube - Spoof video streams:** Change default client type to Android VR ([ReVanced#697](https://github.com/zainarbani/revanced-integrations/issues/697)) ([d06706d](d06706d))
* **YouTube - Spoof video streams:** Handle app left open for a long time ([ReVanced#709](https://github.com/zainarbani/revanced-integrations/issues/709)) ([ea4b073](ea4b073))
* **YouTube:** Fix issues related to playback by replace streaming data ([ReVanced#680](https://github.com/zainarbani/revanced-integrations/issues/680)) ([0468235](0468235))
* **YouTube:** Show video chapter titles without clipping when overlay buttons are enabled ([ReVanced#699](https://github.com/zainarbani/revanced-integrations/issues/699)) ([325cc17](325cc17))

### Features

* Add `Check environment` patch ([ReVanced#683](https://github.com/zainarbani/revanced-integrations/issues/683)) ([e856455](e856455))
* Merge branch `feat/yt-bump` to `dev` ([48a7ac4](48a7ac4))
* **YouTube - Disable precise seeking gesture:** Hide "pull up" label that shows up when swiping ([ReVanced#696](https://github.com/zainarbani/revanced-integrations/issues/696)) ([0b9afd0](0b9afd0))
* **YouTube - Hide Shorts components:** Add `Hide save music`, `Hide stickers` ([ReVanced#703](https://github.com/zainarbani/revanced-integrations/issues/703)) ([a87456e](a87456e))
* **YouTube - Hide Shorts components:** Add option to hide like fountain ([ReVanced#708](https://github.com/zainarbani/revanced-integrations/issues/708)) ([16c3ef7](16c3ef7))
* **YouTube - Hide Shorts components:** Hide 'Use this sound' button ([ReVanced#691](https://github.com/zainarbani/revanced-integrations/issues/691)) ([6f3d2ff](6f3d2ff))
* **YouTube - Keyword filter:** Add syntax to match whole keywords and not substrings ([ReVanced#681](https://github.com/zainarbani/revanced-integrations/issues/681)) ([5314dd9](5314dd9))
* **YouTube - Spoof client:** Allow forcing AVC codec with iOS ([ReVanced#679](https://github.com/zainarbani/revanced-integrations/issues/679)) ([2c471f3](2c471f3))
* **YouTube:** Add donation link to settings about screen ([ReVanced#688](https://github.com/zainarbani/revanced-integrations/issues/688)) ([b816c45](b816c45))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(YouTube - Spoof client): With iOS spoofing, VP9 is used even if the device doesn't support VP9
3 participants