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

Commit f5456c31 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "VideoView: Add logs for video start/stop profiling"

parents 9508f916 9a0cf5c2
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -307,11 +307,13 @@ public class VideoView extends SurfaceView

    public void stopPlayback() {
        if (mMediaPlayer != null) {
            Log.i(TAG, "Playback Stop begin");
            mMediaPlayer.stop();
            mMediaPlayer.release();
            mMediaPlayer = null;
            mCurrentState = STATE_IDLE;
            mTargetState  = STATE_IDLE;
            Log.i(TAG, "Playback Stop end");
        }
    }

@@ -320,6 +322,8 @@ public class VideoView extends SurfaceView
            // not ready for playback just yet, will try again later
            return;
        }

        Log.i(TAG, "Open Video");
        AudioManager am = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
        am.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);

@@ -350,6 +354,7 @@ public class VideoView extends SurfaceView
            mMediaPlayer.setOnInfoListener(mInfoListener);
            mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener);
            mCurrentBufferPercentage = 0;
            Log.i(TAG, "SetDataSource");
            mMediaPlayer.setDataSource(mContext, mUri, mHeaders);
            mMediaPlayer.setDisplay(mSurfaceHolder);
            mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
@@ -763,8 +768,10 @@ public class VideoView extends SurfaceView
    @Override
    public void start() {
        if (isInPlaybackState()) {
            Log.i(TAG, "Playback Start begin");
            mMediaPlayer.start();
            mCurrentState = STATE_PLAYING;
            Log.i(TAG, "Playback Start end");
        }
        mTargetState = STATE_PLAYING;
    }
@@ -781,6 +788,7 @@ public class VideoView extends SurfaceView
    }

    public void suspend() {
        Log.i(TAG, "Playback Suspend begin");
        // HTTP streaming will call MediaPlayer::suspend() for suspend operation, others will call release()
        if (isHTTPStreaming(mUri) && mCurrentState > STATE_PREPARING && mMediaPlayer != null) {
            if (mMediaPlayer.suspend()) {
@@ -790,6 +798,7 @@ public class VideoView extends SurfaceView
            }
        }
        release(false);
        Log.i(TAG, "Playback Suspend end");
    }

    public void resume() {