TIF: Release an existing audio patch before creating a new one

Bug: 28115694, Bug: 28954262
Change-Id: I04e2e9176a008b72468592db7dc3c7ce376b94f2
This commit is contained in:
Jae Seo
2016-05-31 10:31:15 -07:00
parent ce289e937e
commit ee32ede540

View File

@@ -742,7 +742,10 @@ class TvInputHardwareManager implements TvInputHal.Callback {
synchronized (mImplLock) {
mAudioSource = null;
mAudioSink.clear();
mAudioPatch = null;
if (mAudioPatch != null) {
mAudioManager.releaseAudioPatch(mAudioPatch);
mAudioPatch = null;
}
}
}
};
@@ -980,6 +983,9 @@ class TvInputHardwareManager implements TvInputHal.Callback {
}
if (shouldRecreateAudioPatch) {
mCommittedVolume = volume;
if (mAudioPatch != null) {
mAudioManager.releaseAudioPatch(mAudioPatch);
}
mAudioManager.createAudioPatch(
audioPatchArray,
new AudioPortConfig[] { sourceConfig },