Search code examples
androidouya

Ouya - dimensions too large


I'm testing my video player on an OUYA device and it crashes almost immediately with the "dimension too large" error (see logcat dump below). If anyone knows of a work-around or a way to set a maximum dimension, I'll be grateful.

D/MySurface(2651): surfaceCreated
W/InputDispatcher(319): Attempted to unregister already unregistered input channel '41daf688 tv.ouya.console.wallpaper.OozeService (server)'
I/WindowState(319): WIN DEATH: Window{41daf688 tv.ouya.console.wallpaper.OozeService paused=false}
I/WindowManager(319): WINDOW DIED Window{41daf688 tv.ouya.console.wallpaper.OozeService paused=false}
E/SurfaceFlinger(109): dimensions too large 2560 x 1472
E/SurfaceFlinger(109): createNormalSurfaceLocked() failed (Invalid argument)
W/WindowStateAnimator(319): OutOfResourcesException creating surface
I/WindowManager(319): Out of memory for surface!  Looking for leaks...
W/WindowManager(319): No leaked surfaces; killing applicatons!
W/ActivityManager(319): Killing processes Free memory at adjustment 0
W/ActivityManager(319): Killing ProcessRecord{41d9cae8 2651:example.android.player/u0a37} (adj 0): Free memory
W/WindowManager(319): Looks like we have reclaimed some memory, clearing surface for retry.
W/WindowManager(319): Due to memory failure, waiting a bit for next layout

I've tried changing the resolutions via this post as well without any success: http://forums.ouya.tv/discussion/2170/setting-resolution-not-working


Solution

  • I found a work around for this using a Surface callback with a pre-set max for width and height:

    @Override
    public void surfaceCreated(SurfaceHolder holder) {
        Rect rect = holder.getSurfaceFrame();
        if (rect.width() > maxWidth || rect.height() > maxHeight) {
            holder.setFixedSize(maxWidth, maxHeight);
        }
    }