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

Commit c2c2cbf2 authored by Ethan Chen's avatar Ethan Chen
Browse files

FMRadio: Pause and stop AudioTrack before stopping

* According to documentation, stop will continue to play the last
  buffer, while pause immediately halts playback.
* Pause to reduce latency to stop, then flush the AudioTrack buffer
  before actually stopping in the render thread.

Change-Id: I0b497cd6b95b0921f63796746c7279a4f931dbd3
parent 4711f659
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -503,6 +503,8 @@ public class FmService extends Service implements FmRecorder.OnRecorderStateChan
                        mCurrentFrame = 0;

                        if (mAudioTrack.getPlayState() == AudioTrack.PLAYSTATE_PLAYING) {
                            mAudioTrack.pause();
                            mAudioTrack.flush();
                            mAudioTrack.stop();
                        }