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

Commit 6cd7a609 authored by Ethan Chen's avatar Ethan Chen
Browse files

FMRadio: Immediately mute AudioTrack once stopRender is called

* This is kind of a hack, to squelch any possible output from when
  stopRender is called to when AudioTrack.stop is called. This is
  because the render thread may be playing audio and not respond
  immediately to a stopRender call, resulting in garbage being written
  to the output once the FM input is shut down. (such as in the case of
  the headphone/antenna being removed).

REF: KIPPER-560
Change-Id: Id9dab17ca95a41e5a98c16fc8bc58d9e414e4efc
parent c2c2cbf2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -410,6 +410,9 @@ public class FmService extends Service implements FmRecorder.OnRecorderStateChan
    private synchronized void stopRender() {
        Log.d(TAG, "stopRender");
        mIsRender = false;
        // HACK: Set volume to 0 to squelch any output between the call to
        // stopRender and the render thread calling AudioTrack.stop
        mAudioTrack.setVolume(0.0f);
    }

    private synchronized void createRenderThread() {