Skip to content Skip to sidebar Skip to footer

What Is The Use Of Calling Surfaceholder.setfixedsize()?

I have similar code to many examples floating around the net: mSurfaceHolder = mVideoSurface.getHolder(); mSurfaceHolder.addCallback(this); mSurfaceHolder.setFormat(PixelFormat.TRA

Solution 1:

The size matters for things like OpenGL ES, where you draw on the Surface at whatever size it happens to be. When you're sending buffers of data from the camera or a video decoder, the buffers arrive at whatever size they were given by the camera or video. It's scaled to match the size of the SurfaceView's View, but it's not scaled to match the size of the SurfaceView's Surface.

The one place the two concepts cross is with the Camera2 preview API, which will apparently resize its capture to match the Surface in some cases.

You can read more about a primary use case in this blog post (demo here), and more about the graphics architecture as a whole in this doc.

Post a Comment for "What Is The Use Of Calling Surfaceholder.setfixedsize()?"