Merge "Fix Tv source audio device adjust volume, and audio is breaks up intermittently." am: 67dccd5e64 am: 9b17bea1e0

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1008694

Change-Id: I4a6e139abc89c479926ffa651dec2a12f3ee5e98
This commit is contained in:
Treehugger Robot
2021-10-26 07:56:26 +00:00
committed by Automerger Merge Worker

View File

@@ -1075,19 +1075,24 @@ class TvInputHardwareManager implements TvInputHal.Callback {
} }
if (shouldRecreateAudioPatch) { if (shouldRecreateAudioPatch) {
mCommittedVolume = volume; mCommittedVolume = volume;
// only recreate if something was updated or audioPath is null
if (mAudioPatch == null || sinkUpdated ||sourceUpdated ) {
if (mAudioPatch != null) { if (mAudioPatch != null) {
mAudioManager.releaseAudioPatch(mAudioPatch); mAudioManager.releaseAudioPatch(mAudioPatch);
audioPatchArray[0] = null;
} }
mAudioManager.createAudioPatch( mAudioManager.createAudioPatch(
audioPatchArray, audioPatchArray,
new AudioPortConfig[] { sourceConfig }, new AudioPortConfig[] { sourceConfig },
sinkConfigs.toArray(new AudioPortConfig[sinkConfigs.size()])); sinkConfigs.toArray(new AudioPortConfig[sinkConfigs.size()]));
mAudioPatch = audioPatchArray[0]; mAudioPatch = audioPatchArray[0];
}
}
if (sourceGainConfig != null) { if (sourceGainConfig != null) {
mAudioManager.setAudioPortGain(mAudioSource, sourceGainConfig); mAudioManager.setAudioPortGain(mAudioSource, sourceGainConfig);
} }
} }
}
@Override @Override
public void setStreamVolume(float volume) throws RemoteException { public void setStreamVolume(float volume) throws RemoteException {