Search Issue Tracker
Won't Fix
Votes
9
Found in
5.6.1p4
Issue ID
923400
Regression
No
[Android] VideoPlayer.Prepare with multiple videos freezes the application(NdkMediaCodec: sf error code: -38)
Steps to reproduce:
1) Download attached project 'ReproStripped.zip' and open in Unity
2) Build and Run 'MainStage' scene on a device
While initializing application and VideoPlayer.Prepare starts preparing videos, application will freeze and 'NdkMediaCodec: sf error code: -38' error will be spawned in the logcat
Expected result: Videos should be loaded without freeze
Actual result: Application freezes while preparing multiple videos
Reproduced with:
5.6.2p1, 2017.1.0f1, 2017.2.0b1
Devices under test:
Reproduced with:
Samsung SM G800F (Galaxy S5 Mini)*, OS:6.0.1, CPU:armeabi-v7a, GPU:Mali-400 MP, Build:samsung/kminiltexx/kminilte:5.1.1/LMY47X/G800FXXU1BPC4:user/release-keys
Not reproduced with:
Google Nexus 5*, OS:6.0.1, CPU:armeabi-v7a, GPU:Adreno (TM) 330, Build:google/hammerhead/hammerhead:6.0.1/MOB31E/3142026:user/release-keys
Samsung SM G903F*, OS:6.0.1, CPU:armeabi-v7a, GPU:Mali-T720, Build:samsung/s5neoltexx/s5neolte:6.0.1/MMB29K/G903FXXU1BPF4:user/release-keys
Xiaomi Mi 4i*, OS:5.0.2, CPU:arm64-v8a, GPU:Adreno (TM) 405, Build:Xiaomi/ferrari/ferrari:5.0.2/LRX22G/V8.1.5.0.LXIMIDI:user/release-keys
Google Nexus 4*, OS:5.1.1, CPU:armeabi-v7a, GPU:Adreno (TM) 320, Build:google/occam/mako:5.1.1/LMY48T/2237560:user/release-keys
Htc HTC One mini 2*, OS:4.4.2, CPU:armeabi-v7a, GPU:Adreno (TM) 305, Build:htc/htc_europe/htc_memul:4.4.2/KOT49H/405590.2:user/release-keys
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note (2020.1.X):
This appears to be an issue with Google's MediaExtractor and MediaCodec libraries, which we are currently dependent on for video playback on Android. If you try to play too many videos, we crash or hang. I can't find a reasonable work-around as we can't query for the max number of video instances and we don't seem to get a reasonable error back that we can use to shut down the Xth version of the video player.
Having said that, on a fairly wide range of relatively new phones I tried (released in the last few years), Android does seem to be able to support up to 8 H.264 videos consistently. If playing so many, and the phone can't reliably play them all back in real time, it is a good idea to turn off the VideoPlayer's "SkipOnDrop" property. Otherwise, each video will continuously seek ahead to try to catch up to where it should be and this greatly degrades performance.
If your app requires this functionality (playing several videos at once), I think it will require testing on a bunch of different Android devices to confirm that it works consistently.