-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Gear 360: OOM with poorly interleaved videos #3481
Comments
It seems your mp4 files are very poorly interleaved which is causing the issue you see. When you use ConcatenatingMediaSource with a very short ClippingMediaMediaSource, the player tries to preload the next video after loading the first one. That's why you're seeing the OOM only when concatenating both videos. To fix your issue, please make sure to interleave audio and video data in some sane way. See also #1405 and #1386 where similar issues occurred. |
Do you have any recommendations about how to handle this type of error, or any method for identifying badly interleaved files? I ask that because this is the most common crash faced by my user base. |
Are these media files being produced entirely by Samsung's own hardware/software, or is your own software involved? It's really not great that the audio is just being shoved onto the end of the file like that, rather than being interleaved properly. If it's entirely Samsung's own hardware/software, we should have a discussion with them about why they're doing that. |
Those files came directly from the Samsung Gear 360 (2016) cameras, however only some files present the problem. Edit: Got some samples from Samsung Gear 360 (2017) and they also are bad interleaved. |
Lovely :(. Just to clarify, I don't think you're actually seeing a crash are you? You should just be seeing playback fail, which we currently consider working as intended when media is this poorly interleaved. If you are seeing a crash, you haven't provided any logs that show it, so please do so (note the error shown in the snippet above is something our code catches and handles gracefully as playback failure). |
In the demo app there is no crash happening but ExoPlayer keeps using the memory trying to load the video over and over again. Then in my app this over usage of memory generates OOM Exceptions in other threads. |
Got it. We could impose a hard limit on the maximum memory we'll consider using, but since different devices will allow us to use different amounts of memory, it's very unclear what that value should really be set to. I don't think we retry indefinitely. I think we retry three times before giving up (and releasing all memory) by default. #2844 tracks not retrying at all for certain error types, which should probably be the case here. Either way if we're consuming nearly all available memory at some point in time, it's going to be possible that some other thread might OOM if it tries to allocate something whilst ExoPlayer is in this state. |
You are right, in the demo app ExoPlayer only try to load the video three times before stopping. However, my application hangs with the garbage collector on the first try and some seconds later it crashes. Seein that my application is a 360 video editor, videos from Gear 360 are very common and by far this is the most common issue that our users face. So even if my application didn't crash, just showing an error message would not suffice. Therefore, I thought about two possible solutions:
Do you have any recommendations on how to achieve that or other solutions? |
|
Great, I will follow that approach. On any news please let me know. Thanks! |
Closing the issue for now as the underlying cause is tracked with Samsung. |
When determining the next sample to load, the Mp4Extractor now takes into account how far one stream is reading ahead of the others. If one stream is reading ahead more than a threshold (default: 10 seconds), the extractor continues reading the other stream even though it needs to reload the source at a new position. GitHub:#3481 GitHub:#3214 GitHub:#3670 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=182504396
The change reference above should allow for playback of these streams without hitting an OOM. Samsung may also issue a fix for the poor interleaving, which will make it easier for these files to be streamed. |
Issue description
Experiencing a OOM crash in multiple devices when combining multiple
ClippingMediaSource
in aConcatenatingMediaSource
orDynamicConcatenatingMediaSource
. I was only able to reproduce the issue in videos recorded by the camera Gear 360 (2016).I was not able to reproduce the crash using
ClippingMediaSource
orConcatenatingMediaSource
independently.Reproduction steps
I was able to reproduce the issue with the following changes in the demo app:
Link to test content
https://drive.google.com/file/d/1_UGZiwwpm_8TEd1ycIw5HbFyS2lk3Qi4/view?usp=sharing
https://drive.google.com/file/d/1yh4GgIoahZqShtnjntGN19qEfhand6rA/view?usp=sharing
Version of ExoPlayer being used
r2.5.4
Device(s) and version(s) of Android being used
Galaxy Note 8 - Android 7.1.1
Galaxy S7 Edge - Android 7.1.1
Xiaomi Redmi Note 4 - Android 7.0
A full bug report captured from the device
The text was updated successfully, but these errors were encountered: