-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
In 4.11.0 crash generating thumbnails of big sized videos #4165
Comments
I had the same problem. Most on Huawei devices. |
I had the same problem in 4.11 version. Huawei Nova 3 Android Pie.
|
This crash also occured when load too large bitmap (more than 8192x8192) only in glide v4. |
Could you let me know what has changed about the video frames retrieval in glide 4.11 in relation with 4.10? I've done the test to build manually a list of video thumbnails by directly using the MediaMetadataRetriever.getFrameAtTime() API. |
I've also tried MediaMetadataRetriever.getScaledFrameAtTime, with several parameter combinations and I can't make it crash. |
Can this be related to issue #4116 ? |
Can you attach a file that reproduces the issue? I don't have a device right now, but I might be able to get one in the future. If you are able to reproduce it, can you do so by just calling BitmapFactory.decodeFileDescriptor directly without using Glide? If so, does it also reproduce if you call BitmapFactory.decodeStream on the same file? If it's only an issue with decodeFileDescriptor, we could probably avoid registering the file descriptor decoder on affected Huawei devices, assuming we can get the SDK, manufacturer name, and maybe device model if it's only some of their devices with a given SDK. |
Finally I can reproduce the crash without Glide. I've done a few test by directly calling BitmapFactory.decodeFileDescriptor over a few video Uris. The result is that for normal (smaller) videos it doesn't retrieve anything at all. It returns null bitmaps, or -1 metrics when using inJustDecodeBounds=true . Yet, when performing the test with the big video file, I get the same crash as in glide. Now the questions is, why does glide use BitmapFactory.decodeFileDescriptor for video files? Is this valid? Just a quick thought, doesn't the Downsampler should be getting only the file descriptors for cached bitmaps? Could it be that is getting also the file descriptor of the actual target video file? Edit: I've checked the size of the file targeted in Downsampler->ImageReader.decodeBitmap(), by evaluating dataRewinder.rewindAndGet().getStatSize() before decoding gets executed. Same crash as glide:
|
The issue still happens in 4.12.0. The source of the bug is that Glide is incorrectly trying to decode a video thumbnail using the BitmapFactory, so passing a video file descriptor to BitmapFactory.decodeFileDescriptor. This is incorrect as the BitmapFactory is meant for image files only, not for videos. The reason it fails in some devices is just unpredictable, since is passing a file descriptor of a specific file type to a class which doesn't expect such file type. |
no fixed in 4.12.0 :( |
The crash continues in 4.12.0! Please fix it... |
Still crashing in 4.12.0. |
We have the same problem, please fix it as soon as possible... |
Sorry I'm just circling back to this, so I think I'm going to start with trying the getStatSize fix suggested here: #4165 (comment). Arbitrarily I'll experiment with some maximum file sizes around 512mb, but please let me know if you have input. These will go out internally at first as experiments so I can try to verify the size is reasonable. I don't see this issue on any manufacturer other than Huawei, please let me know if you do. |
… crashes. Fixes #4165 PiperOrigin-RevId: 406427663
… crashes. Fixes #4165 PiperOrigin-RevId: 406427663
Glide Version: 4.11.0
Integration libraries: Default installation
Device/Android Version: Huawei p30 Android 10
Issue details / Repro steps / Use case background:
Closes (crashes) the activity when try to load a big sized video file into an imageview. Running well with previous versions (4.10.0) Tested with 2Gb video file.
Glide load line /
GlideModule
(if any) / list Adapter code (if any):Stack trace / LogCat:
It runs great if we use 4.10.0 Glide version instance of 4.11.0
The text was updated successfully, but these errors were encountered: