Bug 62591 - sdremote: frequent crashes ...
Summary: sdremote: frequent crashes ...
Status: RESOLVED FIXED
Alias: None
Product: Impress Remote
Classification: Unclassified
Component: Android Remote App (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium critical
Assignee: Not Assigned
URL:
Whiteboard: target:4.1.0 target:4.0.3
Keywords:
Depends on:
Blocks: mab4.0
  Show dependency treegraph
 
Reported: 2013-03-21 13:30 UTC by Michael Meeks
Modified: 2015-02-13 19:42 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meeks 2013-03-21 13:30:21 UTC
I did an hour long presentation and got this today:

E/AndroidRuntime( 2269): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
E/AndroidRuntime( 2269):        at android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
E/AndroidRuntime( 2269):        at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:405)
E/AndroidRuntime( 2269):        at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:418)
E/AndroidRuntime( 2269):        at org.libreoffice.impressremote.communication.SlideShow.getImage(SlideShow.java:57)
E/AndroidRuntime( 2269):        at org.libreoffice.impressremote.PresentationFragment$ThumbnailAdapter.createBitmap(PresentationFragment.java:309)
E/AndroidRuntime( 2269):        at pl.polidea.coverflow.AbstractCoverFlowImageAdapter.getItem(AbstractCoverFlowImageAdapter.java:73)


I strongly suspect that this is because:

    public Bitmap getImage(int aSlide) {
        byte[] aImage = mPreviewImages.get(aSlide);
        if (aImage == null) {
            return BitmapFactory.decodeResource(mContext.getResources(),
                            R.drawable.image_loading);
        }
        Bitmap aBitmap = null;
        try {
            aBitmap = BitmapFactory.decodeByteArray(aImage, 0, aImage.length);
        } catch (OutOfMemoryError e) {
            Log.e(Globals.TAG, "Bitmap decoding error byte length: " + aImage.length +
                  "first 4 bytes: " + aImage[0] + " " + aImage[1] + " " + aImage[2] + " " + aImage[3] +
                  "Exception " + e);
        }
        if (aBitmap == null) {
            return BitmapFactory.decodeResource(mContext.getResources(),
                            R.drawable.image_loading);
        }
        return aBitmap;
    }

is called by the coverflow, and constantly re-creates the bitmap from the stored base64 string.

It seems to me that this is really silly :-) we should store the Bitmap and return the same Bitmap pointer for each slide as a Bitmap - which has to be 50% of the size of a base64 encoded image. It would also be the same image each time so as to not kill the GC etc. - and caching that should improve perf.

We should throw away the base64 text too as soon as we successfully have an image in hand :-)
Comment 1 Commit Notification 2013-03-25 10:40:01 UTC
Artur Dryomov committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=514d6c6fb61437a2e4f6c94abb4bfea22936f86c

fdo#62591 - change Impress remote slide previews building



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 2 Commit Notification 2013-03-25 11:18:25 UTC
Artur Dryomov committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4ef4046419a3bc351a2ae06362ff5049cd120f96&h=libreoffice-4-0

fdo#62591 - change Impress remote slide previews building


It will be available in LibreOffice 4.0.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 3 Michael Meeks 2013-03-25 11:28:56 UTC
marking it fixed - thanks Artur !
Comment 4 Robinson Tryon (qubit) 2015-02-13 19:42:49 UTC
Moving bug to (new) 'Impress Remote' product.