Merge "APM: only use the flags that are compatible for the mix port when opening input stream." into main