The two functions have a lot of shared logic and locking. This CL consolidates that into a single function. Bug: webrtc:111235 Change-Id: Ib1c32165dbf0e212c7d4b0753bcbb5ffd05eb6fe Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/163022 Commit-Queue: Sam Zackrisson <saza@webrtc.org> Reviewed-by: Per Åhgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30144}