I have similar code for many examples floating over the network:
mSurfaceHolder = mVideoSurface.getHolder(); mSurfaceHolder.addCallback(this); mSurfaceHolder.setFormat(PixelFormat.TRANSPARENT); mSurfaceHolder.setFixedSize(20, 10);
Then in callbacks I:
@Override public void surfaceCreated(SurfaceHolder holder) { Log.d(TAG, "SurfaceCreated"); mSurfaceHolder.setFixedSize(20, 10); } @Override public void surfaceChanged( SurfaceHolder holder, int format, int width, int height ) { Log.d(TAG, "SurfaceChanged to " + format + " width " + width + " height " + height); }
From this code, I would expect the video surface to be set to a tiny size of 20x10 pixels , then scale to any layout size. I use it showing the pixel / blurry version. However, the video being played looks correctly in full native resolution; it does not decrease to 20x10. But I get the following logs:
SurfaceChanged to -2 width 20 height 10
So, if the surface of the video is set to this tiny size, but graphically the video still looks in high resolution, then why use the surface size?
Full source code is available at https://github.com/gradha/Stackoverflow38118219 .
source share