austgl / gifview

Automatically exported from code.google.com/p/gifview
0 stars 0 forks source link

快点解决大图的OOM问题 #6

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
能否改为解码一帧,并显示,然后释放内存,再解码下一帧��
�再显示,并释放内存?

Original issue reported on code.google.com by Wei.Zhan...@gmail.com on 14 Sep 2011 at 11:00

GoogleCodeExporter commented 8 years ago
恐怕不太容易。
首先非常感觉作者提供了这个源码,最近我也花了些时间来��
�理,并解决了一些问题,但是oome的问题仍然没有根本解决。
现在只有强制结束解析了。
附件为修改的代码。
gf2=(GifView2) findViewById(R.id.gif2);
        gf2.setGifImageType(GifView2.GifImageType.ANIMATION);
        try {
            File file=new File("/sdcard/test.gif");
            FileInputStream fis=null;

            fis=new FileInputStream(file);
            System.out.println("fis:"+fis.available());
            gf2.setGifImage(fis);

            /*FileInputStream fileInputStream=new FileInputStream(file);
            byte[] bytes=new byte[fileInputStream.available()];
            fileInputStream.read(bytes);
            gf2.setGifImage(bytes);*/
            gf2.setOnClickListener(this);
        } catch (IOException e) {
            e.printStackTrace();
        }测试代码。

动态的解析,播放个人认为不太好,太耗内存了。

Original comment by arc...@gmail.com on 13 Dec 2011 at 10:11

Attachments:

GoogleCodeExporter commented 8 years ago
理论上OOM是无解的。
其实我曾经想把解码后的图片保持成文件,以此来解决OOM,��
�实际效果太差了。在代码中你可以看到这部分代码,虽然我�
��这个接口注释了,但代码没有删除。

Original comment by cy.liao...@gmail.com on 25 Apr 2012 at 8:52