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
diff --git a/src/com/android/fmradio/FmService.java b/src/com/android/fmradio/FmService.java
index 7e89237..553b6fa 100644
--- a/src/com/android/fmradio/FmService.java
+++ b/src/com/android/fmradio/FmService.java
@@ -410,6 +410,9 @@
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() {