Merge "Fix Tv source audio device adjust volume, and audio is breaks up intermittently."

This commit is contained in:
Treehugger Robot
2021-10-26 07:21:52 +00:00
committed by Gerrit Code Review

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 {