I work for nowhere.io and when upgrading to Babylon 7.11.2 from 6.33.1, we see a heavy decrease in performance on IOS devices while running a live stream.
With our current build, 6.33.1, we can watch at least 20-30-minute streams on older ios devices, but after the update, we are now getting a WebGL crash after about 3 minutes.
There is always a constant battle with iphones and memory constraints, and I suspect the same issue is at play here. It seems to be that something within the Babylon upgrade is either causing a direct performance issue with video texture rendering, or a performance issue elsewhere that is accentuated by rendering a video texture.
β Other changes that were necessary to upgrade β
- babylonjs-gltf2interface: ^6.17.0 to 7.11.2,
- havok 1.0.1 to 1.3.7 (downgraded this and the same issue still persisted)
- typescript 4.4.4 to 5.4.5
- ts-loader 8.4.0 to 9.5.0
Any thoughts you may have would be very helpful as we want to keep up with the latest releases of Babylon to take advantage of gaussian splats and much more, but cannot do so if it hurts ios performance.
Thanks!
cc @sebavan @Evgeni_Popov to see if they could think of anything.
Here is some ideas to try:
- Turn off sRGBbuffers:
const engine = new BABYLON.Engine(canvas, true, {forceSRGBBufferSupportState: false});
- Test with WebGL1
Ideally we will need a simple repro test to investigate, else we are shooting in the dark.
@Deltakosh thanks, I will give that a try. I can see if I can replicate it in a playground, but our system is handling so much that it may be very difficult to do so.
I know we are sort of shooting in the dark here, so I am just looking for some ideas on what to test on my side that could have changed between the Babylon versions, so I appreciated the suggestion there.
Webgl2 is working fine with Babylon 6, but I can force WebGL1 in Babylon 7 to see if it helps β I will force webgl1 in Babylon 6 to compare if you think this is a valid route to explore
The only thing I changed other than the Babylon versions was changing some Engine
types to AbstractEngine
1 Like
What crashes/error do you see ?
If indeed it is memory related you should be able to spot the leak in chrome as well where there would be more time before crashing ?
We are getting a webgl context lost event. This is a common thing that happens specifically on ios when the OS decides you are using too much memory and kills the page.
Either this issue does not happen on a desktop browser or it happens after a very long time, because we only see it on iOS. I do not think it is a leak, but just more memory being used by Babylon 7 than babylon 6 somehow. A similar crash might happen if we load in too large of a texture or model of some sort
I am testing with the above suggestions from @Deltakosh and will report back specific errors if they come back.
Here is one error log, but the error before WebGL context lost I think is unrelated, as it is due to not having a user gesture and trying to play sound.
Agree it definitely looks like a memory issue here
Would be great if you could pinpoint it ?
The furthest I have pinpointed so far seems to be just running a live stream, which would normally increase memory footprint, and now I think it is increasing the footprint too much after a few minutes of running (maybe a leak, unsure tho). I will be testing with screen share vs live stream now, but I suspect it to be the same as the base VideoTexture
class is used for both of them.
Here is another instance of it crashing
yeah we definitely a repro
I think we really just need an hls live stream in a playground β I will test and see if it happens with this as well - https://playground.babylonjs.com/#RI4YX8#18
1 Like
I just confirmed it seems to be only happening with HLS streams not screen share⦠so it is not explicitly the VideoTexture class
errors on IOS from this playground, after 3min β
https://playground.babylonjs.com/#9FSDC7#262
I am updating my hls.js library, and also enabling web workers for the hls stream. The web workers may be a bandaid fix, but the hls.js update might fix a bug causing this. If this works, I will get rid of the webworker and see if the outdated hls.js alone was the culprit, and update this thread
this error only happened once, not able to get it to happen again on ios in that playground
Updating hls.js did not solve the issue, neither did enabling web workers for the hls stream. Still a webgl context lost crash under 5 min. Screenshare does not have the same issue, no crash on iOS 20+min deep
Gosh! The plot is deepening
pinging @sebavan and @Evgeni_Popov again to be sure they see it
I have no other clue on my side. I cannot repro on my iphone16 pro max
one idea: can you check with safari on mac if there is a memory leak? that could explain the context lost