Dodgy cam sensor will make them idle rough for sure, and given that its throwing a code and youve ordered one, install it and go from there.
There could be other things wrong given the way the rpms seem to float up, but they dont run smooth with the cam sensor playing up so eliminate that first.
Have you checked for vacuum leaks or dodgy
PCV valve?