HaloMarine31 / androidscreencast

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

java.lang.OutOfMemoryError #16

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Connect my non-rooted Motorola Droid to the system in debug mode and
mount is
2. launch android screencast app and attempt to connect to my droid with
agent specified as 127.0.0.1
3. I get the following exception back
java.lang.OutOfMemoryError: Java heap space
    at java.awt.image.DataBufferInt.<init>(Unknown Source)
    at java.awt.image.Raster.createPackedRaster(Unknown Source)
    at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown
Source)
    at java.awt.image.BufferedImage.<init>(Unknown Source)
    at
net.srcz.android.screencast.injector.ScreenCaptureThread.display(ScreenCaptureTh
read.java:168)
    at
net.srcz.android.screencast.injector.ScreenCaptureThread.fetchImage(ScreenCaptur
eThread.java:107)
    at
net.srcz.android.screencast.injector.ScreenCaptureThread.run(ScreenCaptureThread
.java:50)

What is the expected output? What do you see instead?
I'd like to see it running.

What version of the product are you using? On what operating system?
the latest

Please provide any additional information below.
Does my device need to be rooted? I am new with android so dont know much
about it. 

Original issue reported on code.google.com by gurpreet...@gmail.com on 19 Nov 2009 at 11:32

GoogleCodeExporter commented 9 years ago
I get the same error on my Motorola Droid.  I used pdanet to install the ADB 
driver
and verified it was the most recent driver by trying to update using the SDK 
USB drivers.

Original comment by joel%kle...@gtempaccount.com on 19 Nov 2009 at 5:18

GoogleCodeExporter commented 9 years ago
Same error on my Droid, happens on Windows or Linux version of the SDK using 
Java 1.6 
JRE latest version.

Original comment by jper...@gmail.com on 23 Nov 2009 at 9:14

GoogleCodeExporter commented 9 years ago
I haven't looked at the code at all, but is the buffer that its reading the 
image into, large enough for the extra 
resolution of the Droid?

Original comment by cole.mickens on 14 Dec 2009 at 1:00

GoogleCodeExporter commented 9 years ago
I'd love to donate to this initiative, but please address this issue. Now that 
droid
has been rooted, a lot of people would want this app to be run with the droid. 
Is
there anyway we (droid owners) can help you in investigating as to what could 
be the
issue?

Original comment by gurpreet...@gmail.com on 14 Dec 2009 at 2:01

GoogleCodeExporter commented 9 years ago
Newest release eliminates this error.   Droid comes up but screen resolution 
appears 
jumbled and can not see screen effectively.   You can see when changes are 
occuring, 
but cannot make out what screen says

Original comment by tjcsm...@gmail.com on 21 Dec 2009 at 3:48

GoogleCodeExporter commented 9 years ago
Confirming the behavior tjcsmith mentioned. Attached a screen shot as well.

Original comment by gurpreet...@gmail.com on 21 Dec 2009 at 5:26

Attachments:

GoogleCodeExporter commented 9 years ago
If the rawImage is passed to display, then the following changes to the source 
will 
work:

1.  Set the BufferedImage to use a type of TYPE_INT_ARGB
2.  Replace the RGB loop you have with the below (borrowed from droidEx code)

                int index = 0;
        int indexInc = rawImage.bpp >> 3;

        for (int y = 0; y < rawImage.height; y++) {
            for (int x = 0; x < rawImage.width; x++, index += indexInc) {
                int value = rawImage.getARGB(index);
                image.setRGB(x, y, value);
            }
        }

3.  This now displays properly on a Droid.  However mouse/keyboard input not 
quite 
working

Original comment by tjcsm...@gmail.com on 22 Dec 2009 at 2:21

GoogleCodeExporter commented 9 years ago
"3.  This now displays properly on a Droid.  However mouse/keyboard input not 
quite 
working"
Is it working for you tjcsSmith? What shall i do to atleast see the proper 
image. I
am a nooB with Android development so don't know what needs to be done with the 
code
you have provided. 

I feel good about the fact that there is no error anymore. At least it's some 
progress.
Thanks

Original comment by gurpreet...@gmail.com on 22 Dec 2009 at 4:05

GoogleCodeExporter commented 9 years ago
My comments were to the developer.  I'm not comfortable submitting the code 
changes 
since I only have one device to test on.

But the code changes are within:
net.srcz.androidscreencast.api.injector.ScreenCaptureThread.java

In the function fetchImage, there is a call:
 display(rawImage.data,rwidth,rheight);
which I changed to:
 display(rawImage.data,rwidth,rheight,rawImage);

Then in that same component, there is a function:
 public void display(byte[] buffer, int width, int height) {
which I changed to:
 public void display(byte[] buffer, int width, int height,RawImage rawImage) {

Then within that function I replaced the code:
        int index = 0;
        for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++) {
                int value = buffer[index++] & 0xff;
                value |= buffer[index++] << 8 & 0xff00;
                int r = (value >> 11 & 0x1f) << 3;
                int g = (value >> 5 & 0x3f) << 2;
                int b = (value & 0x1f) << 3;

                value = 0xFF << 24 | r << 16 | g << 8 | b;
                if (landscape)
                    image.setRGB(y, width - x - 1, value);
                else
                    image.setRGB(x, y, value);
            }
        }

with:

        int index = 0;
        int indexInc = rawImage.bpp >> 3;

        for (int y = 0; y < rawImage.height; y++) {
            for (int x = 0; x < rawImage.width; x++, index += indexInc) {
                int value = rawImage.getARGB(index);
                if (landscape)
                    image.setRGB(y, width - x - 1, value);
                else
                    image.setRGB(x, y, value);
            }
        }

Original comment by tjcsm...@gmail.com on 22 Dec 2009 at 3:20

GoogleCodeExporter commented 9 years ago
To the developer,

Could you please incorporate the above code? I'd love to have this whole thing
working with my Droid.

Thanks to everybody :)

Original comment by gurpreet...@gmail.com on 23 Dec 2009 at 3:22

GoogleCodeExporter commented 9 years ago
wow, thank you all !
I've only a G2 so i can't test on the droid...
I'll test your change on my phone, if it works ok, i'll incorporate it to 0.4

Original comment by thiel.al...@gmail.com on 28 Dec 2009 at 9:20

GoogleCodeExporter commented 9 years ago
Issue 22 has been merged into this issue.

Original comment by thiel.al...@gmail.com on 28 Dec 2009 at 9:24

GoogleCodeExporter commented 9 years ago

Original comment by thiel.al...@gmail.com on 28 Dec 2009 at 9:24

GoogleCodeExporter commented 9 years ago
YIPPEEE. I can see my droid just fine. Thanks to the dev and tjcSmith. 
Fantastic job.

Now what would it take to have the mouse and keys working for the droid as well?

Thanks a lot
G

Original comment by gurpreet...@gmail.com on 28 Dec 2009 at 6:47

GoogleCodeExporter commented 9 years ago
I would LOVE to see this app working on the droid with full mouse and keyboard
function. Let me know what I need to do to help and I will do what I can. I have
tested and mine displays fine like others but no kb/mouse function other then 
the
right click. 

Original comment by zerf2...@gmail.com on 5 Jan 2010 at 5:41

GoogleCodeExporter commented 9 years ago
See Issue #13 for a hack to get it working on a rooted droid.  Basically 
starting an 
emulator from the SDK "Virtual Devices" and getting application running on 
that, 
copying the /data/dalvik-cache file from the emulator to your PC, and then 
getting that 
file onto /data/dalvik-cache on your rooted droid

Original comment by tjcsm...@gmail.com on 5 Jan 2010 at 4:02

GoogleCodeExporter commented 9 years ago
OutOfMemoryError seems to occure when using Android SDK 2.0 devices...
There have been some change to screen capture protocol

Original comment by thiel.al...@gmail.com on 26 Jan 2010 at 4:43