@@ -50,7 +50,7 @@ public class RecorderThread implements Runnable {
5050 private AudioRecord audioRecord ;
5151 private MediaMuxer muxer ;
5252 private boolean muxerStarted ;
53- private boolean startTimestampInitialized ;
53+ private boolean isStartTimestampInitialized = false ;
5454 private long startTimestampUs ;
5555 private final Handler handler ;
5656 private Thread audioRecordThread ;
@@ -63,10 +63,7 @@ public class RecorderThread implements Runnable {
6363 private final String videoMime ;
6464 private int videoWidth ;
6565 private int videoHeight ;
66- private int videoBitrate ;
6766 private final int sampleRate ;
68- private Thread recordingThread ;
69- //private final boolean isRotated;
7067 private final int recordingRotation ;
7168
7269 private volatile boolean stopped = false ;
@@ -108,7 +105,7 @@ public RecorderThread(MediaProjection mediaProjection, String outputFilePath,
108105
109106 public void startRecording () {
110107 stopped = false ;
111- recordingThread = new Thread (this );
108+ Thread recordingThread = new Thread (this );
112109 recordingThread .start ();
113110 }
114111
@@ -117,7 +114,7 @@ public void stopRecording() {
117114 }
118115
119116 public boolean isRecordingRunning () {
120- return stopped ;
117+ return ! stopped ;
121118 }
122119
123120 @ RequiresApi (api = Build .VERSION_CODES .LOLLIPOP )
@@ -132,7 +129,7 @@ private void setupVideoCodec() throws IOException {
132129 getCapabilitiesForType (videoMime ).getVideoCapabilities ();
133130 this .videoWidth = videoEncoderCapabilities .getSupportedWidths ().clamp (this .videoWidth );
134131 this .videoHeight = videoEncoderCapabilities .getSupportedHeights ().clamp (this .videoHeight );
135- this . videoBitrate = calcBitRate (videoWidth , videoHeight );
132+ int videoBitrate = calcBitRate (videoWidth , videoHeight );
136133
137134 MediaFormat encoderFormat = MediaFormat .createVideoFormat (videoMime , videoWidth ,
138135 videoHeight );
@@ -251,10 +248,10 @@ public void run() {
251248 }
252249
253250 private long getPresentationTimeUs () {
254- if (!startTimestampInitialized ) {
251+ if (!isStartTimestampInitialized ) {
255252 startTimestampUs =
256253 System .nanoTime () / RecorderConstant .NANOSECOND_TO_MICROSECOND ;
257- startTimestampInitialized = true ;
254+ isStartTimestampInitialized = true ;
258255 }
259256 return (System .nanoTime () / RecorderConstant .NANOSECOND_TO_MICROSECOND
260257 - startTimestampUs );
0 commit comments