Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如果Resource目录有媒体文件例如.mp4,应用更新后会导致媒体文件加载不出来 #24

Open
hanfy91 opened this issue Jun 15, 2022 · 5 comments

Comments

@hanfy91
Copy link

hanfy91 commented Jun 15, 2022

生成assetBinData压缩文件时,需要根据文件后缀判断是否需要压缩,媒体文件压缩后是无法正确加载的。

@hanfy91
Copy link
Author

hanfy91 commented Jun 17, 2022

不压缩后依然加载不了,挪到StreamingAsset使用,更新后依然加载不了,使用UnityWebRequest从StreamingAsset加载二进制文件没问题,但是用Unity VideoPlayer组件的Url加载模式会加载不出来

2022-06-17 14:56:38.396 1929-2052/cn.jj.jedi I/il2cpp: [9a65f910]my_open open: /data/app/cn.jj.jedi-1/base.apk
2022-06-17 14:56:38.396 1929-2052/cn.jj.jedi I/il2cpp: [9a65f910]prepare_file /data/app/cn.jj.jedi-1/base.apk -> 0x8f634508
2022-06-17 14:56:38.396 1929-2052/cn.jj.jedi I/il2cpp: [9a65f910]fopen -> 0x8f634508
2022-06-17 14:56:38.396 1929-2052/cn.jj.jedi I/il2cpp: [9a65f910]FileExtraData saved to /storage/emulated/0/Android/data/cn.jj.jedi/files/IL2CPPRes/rt_fd_mappings/8fffc000. fd:0x0000010e, file*: 0x8f63455c
2022-06-17 14:56:38.396 1929-2052/cn.jj.jedi D/il2cpp: [9a65f910]shadow apk in open: /data/app/cn.jj.jedi-1/base.apk, fd:0x0000010e, file*: 0x8f63455c
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]fopen([/sys/devices/system/cpu/cpu0/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]not exist([/sys/devices/system/cpu/cpu0/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]fopen([/sys/devices/system/cpu/cpu1/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]not exist([/sys/devices/system/cpu/cpu1/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]fopen([/sys/devices/system/cpu/cpu2/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]not exist([/sys/devices/system/cpu/cpu2/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]fopen([/sys/devices/system/cpu/cpu3/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]not exist([/sys/devices/system/cpu/cpu3/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]fopen([/sys/devices/system/cpu/cpu4/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]not exist([/sys/devices/system/cpu/cpu4/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]fopen([/sys/devices/system/cpu/cpu5/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]not exist([/sys/devices/system/cpu/cpu5/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]fopen([/sys/devices/system/cpu/cpu6/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]not exist([/sys/devices/system/cpu/cpu6/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]fopen([/sys/devices/system/cpu/cpu7/cpu_capacity],[r])
2022-06-17 14:56:38.406 1929-2054/cn.jj.jedi I/il2cpp: [98d58910]not exist([/sys/devices/system/cpu/cpu7/cpu_capacity],[r])
2022-06-17 14:56:38.411 1929-2052/cn.jj.jedi W/FileSource: offset/length adjusted from 296527356/858610 to 24/0
2022-06-17 14:56:38.413 1929-2052/cn.jj.jedi E/WVMExtractor: Failed to open libwvm.so: dlopen failed: library "libwvm.so" not found
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]fopen([/sys/devices/system/cpu/cpu0/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]not exist([/sys/devices/system/cpu/cpu0/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]fopen([/sys/devices/system/cpu/cpu1/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]not exist([/sys/devices/system/cpu/cpu1/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]fopen([/sys/devices/system/cpu/cpu2/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]not exist([/sys/devices/system/cpu/cpu2/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]fopen([/sys/devices/system/cpu/cpu3/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]not exist([/sys/devices/system/cpu/cpu3/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]fopen([/sys/devices/system/cpu/cpu4/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]not exist([/sys/devices/system/cpu/cpu4/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]fopen([/sys/devices/system/cpu/cpu5/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]not exist([/sys/devices/system/cpu/cpu5/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]fopen([/sys/devices/system/cpu/cpu6/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]not exist([/sys/devices/system/cpu/cpu6/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]fopen([/sys/devices/system/cpu/cpu7/cpu_capacity],[r])
2022-06-17 14:56:38.428 1929-2055/cn.jj.jedi I/il2cpp: [98b58910]not exist([/sys/devices/system/cpu/cpu7/cpu_capacity],[r])
2022-06-17 14:56:38.453 1929-2056/cn.jj.jedi I/il2cpp: [98958910]fopen([/sys/devices/system/cpu/cpu0/cpu_capacity],[r])
2022-06-17 14:56:38.453 1929-2056/cn.jj.jedi I/il2cpp: [98958910]not exist([/sys/devices/system/cpu/cpu0/cpu_capacity],[r])
2022-06-17 14:56:38.453 1929-2056/cn.jj.jedi I/il2cpp: [98958910]fopen([/sys/devices/system/cpu/cpu1/cpu_capacity],[r])
2022-06-17 14:56:38.453 1929-2056/cn.jj.jedi I/il2cpp: [98958910]not exist([/sys/devices/system/cpu/cpu1/cpu_capacity],[r])
2022-06-17 14:56:38.453 1929-2056/cn.jj.jedi I/il2cpp: [98958910]fopen([/sys/devices/system/cpu/cpu2/cpu_capacity],[r])
2022-06-17 14:56:38.454 1929-2056/cn.jj.jedi I/il2cpp: [98958910]not exist([/sys/devices/system/cpu/cpu2/cpu_capacity],[r])
2022-06-17 14:56:38.454 1929-2056/cn.jj.jedi I/il2cpp: [98958910]fopen([/sys/devices/system/cpu/cpu3/cpu_capacity],[r])
2022-06-17 14:56:38.454 1929-2056/cn.jj.jedi I/il2cpp: [98958910]not exist([/sys/devices/system/cpu/cpu3/cpu_capacity],[r])
2022-06-17 14:56:38.454 1929-2056/cn.jj.jedi I/il2cpp: [98958910]fopen([/sys/devices/system/cpu/cpu4/cpu_capacity],[r])
2022-06-17 14:56:38.454 1929-2056/cn.jj.jedi I/il2cpp: [98958910]not exist([/sys/devices/system/cpu/cpu4/cpu_capacity],[r])
2022-06-17 14:56:38.454 1929-2056/cn.jj.jedi I/il2cpp: [98958910]fopen([/sys/devices/system/cpu/cpu5/cpu_capacity],[r])
2022-06-17 14:56:38.454 1929-2056/cn.jj.jedi I/il2cpp: [98958910]not exist([/sys/devices/system/cpu/cpu5/cpu_capacity],[r])
2022-06-17 14:56:38.454 1929-2056/cn.jj.jedi I/il2cpp: [98958910]fopen([/sys/devices/system/cpu/cpu6/cpu_capacity],[r])
2022-06-17 14:56:38.454 1929-2056/cn.jj.jedi I/il2cpp: [98958910]not exist([/sys/devices/system/cpu/cpu6/cpu_capacity],[r])
2022-06-17 14:56:38.454 1929-2056/cn.jj.jedi I/il2cpp: [98958910]fopen([/sys/devices/system/cpu/cpu7/cpu_capacity],[r])
2022-06-17 14:56:38.454 1929-2056/cn.jj.jedi I/il2cpp: [98958910]not exist([/sys/devices/system/cpu/cpu7/cpu_capacity],[r])
2022-06-17 14:56:38.481 1929-2052/cn.jj.jedi E/NdkMediaExtractor: sf error code: -1010
2022-06-17 14:56:38.481 1929-2052/cn.jj.jedi I/il2cpp: [9a65f910]my_close: 0x0000010e
2022-06-17 14:56:38.481 1929-2052/cn.jj.jedi W/Unity: AndroidVideoMedia: Error opening extractor: -10000
(Filename: ./PlatformDependent/AndroidPlayer/Modules/Video/Private/AndroidVideoMedia.cpp Line: 469)
2022-06-17 14:56:38.495 1929-2058/cn.jj.jedi I/il2cpp: [98558910]my_open open: /data/app/cn.jj.jedi-1/base.apk
2022-06-17 14:56:38.496 1929-2058/cn.jj.jedi W/FileSource: offset/length adjusted from 296527356/858610 to 24/0
2022-06-17 14:56:38.499 1929-2058/cn.jj.jedi E/NdkMediaExtractor: sf error code: -1010
2022-06-17 14:56:38.500 1929-2058/cn.jj.jedi I/il2cpp: [98558910]my_close: 0x0000010e
2022-06-17 14:56:38.500 1929-2058/cn.jj.jedi W/Unity: AndroidVideoMedia: Error opening extractor: -10000
(Filename: ./PlatformDependent/AndroidPlayer/Modules/Video/Private/AndroidVideoMedia.cpp Line: 469)

@hanfy91
Copy link
Author

hanfy91 commented Jun 17, 2022

研究了一下源码,问题应在hook只hook了libunity.so,视频的播放方式可能是libUnity.so获取文件描述符,然后给到Android底层,底层使用文件描述符去读取文件,但是libunity.so中返回的文件描述符不是真实的apk文件的文件描述符,所以底层直接读取文件是读取不到的,具体怎么修改,还没想好,作者大佬有没有什么好的解决方案??

@noodle1983
Copy link
Owner

不打AB,不处理,直接放streaming里面,直接load streaming的出来播。变更的话,下载到随便一个目录,读出来播就是了

@hanfy91
Copy link
Author

hanfy91 commented Jun 17, 2022

unity 的VideoPlayer不支持load streaming播放,现在临时的解决方案就是复制到包体外面,用外面的路径播放,但是不确定会不会有其他类似的问题,bug的本质是因为只Hook了libUnity.so的io接口,只要libUnity.so把文件句柄提供给其他部分使用都会有这种问题,感觉是个隐藏的坑啊,这个bug有什么本质性的解决方案么?

@noodle1983
Copy link
Owner

没, 没必要搞复杂,用最稳妥的方案,特例不多。我们之前时用streaming的,不行就复制到外面

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants