Upstream commit: https://webrtc.googlesource.com/src/+/c896e3a5b59e0169e5bc6fcf3dee9dd4a9834b8e Cleanup implemenation of AudioState SetRecording/SetPlayout vs. Add/Remove {Send/Recv}stream So that they behave in the most obvious ways: Set{Recording/Playout} = TRUE - Enables {Recording/Playout} is there are {Send/Recv} streams - Set state variable Set{Recording/Plaout} = FALSE - Disable {Recording/Playout} - Set state variable Add {Send/Recv} stream - Enables {Recording/Playout} if state variable is TRUE - Otherwise does nothing Remove {Send/Recv} stream - Disable {Recording/Playout} if last stream - Otherwise does nothing --- Before this patch the behavior was hard to non obvious, e.g SetRecording(false) followed by SetRecording(true) did not work (same for playout). BUG=b/397376626 Change-Id: I530497d4a46ad73334fcb3d73f4b87264bd18486 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/378740 Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org> Commit-Queue: Jonas Oreland <jonaso@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#44025} Differential Revision: https://phabricator.services.mozilla.com/D244036