Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df11329a authored by ApurupaPattapu's avatar ApurupaPattapu Committed by Steve Kondik
Browse files

frameworks/base: Fix screen stretch issue for NuPlayer

- Fixes screen not moving to full screen after suspend resume during RTSP
  streaming in landscape mode.
- If there is an incorrect height and width, it saves the video height and
  width and then does the correction to have proper width and height.

Change-Id: Icb4b9b71f21d138b85f200dc82a1fbe58342866f
parent 2c2c0ef7
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -79,6 +79,8 @@ public class VideoView extends SurfaceView implements MediaPlayerControl {
    private int         mVideoHeight;
    private int         mSurfaceWidth;
    private int         mSurfaceHeight;
    private int         mPreviousWidth;
    private int         mPreviousHeight;
    private MediaController mMediaController;
    private OnCompletionListener mOnCompletionListener;
    private MediaPlayer.OnPreparedListener mOnPreparedListener;
@@ -121,6 +123,18 @@ public class VideoView extends SurfaceView implements MediaPlayerControl {
                        //width+"/"+height+"="+
                        //mVideoWidth+"/"+mVideoHeight);
            }
            mPreviousWidth = mVideoWidth;
            mPreviousHeight = mVideoHeight;
        } else if (mPreviousWidth > 0 && mPreviousHeight > 0) {
            width = getDefaultSize(mPreviousWidth, widthMeasureSpec);
            height = getDefaultSize(mPreviousHeight, heightMeasureSpec);
            if ( mPreviousWidth * height > width * mPreviousHeight ) {
               Log.i("VideoView", "image too tall, correcting");
               height = width * mPreviousHeight / mPreviousWidth;
            } else if ( mPreviousWidth * height < width * mPreviousHeight ) {
               Log.i("VideoView", "image too wide, correcting");
               width = height * mPreviousWidth / mPreviousHeight;
            }
        }
        //Log.i("@@@@@@@@@@", "setting size: " + width + 'x' + height);
        setMeasuredDimension(width, height);