This is a first step to refactor this code. I'm deprecating https://codereview.webrtc.org/1913073002 and implementing this in smaller more isolated steps. BUG=webrtc:5206 R=asapersson@webrtc.org, kjellander@webrtc.org, noahric@chromium.org Review URL: https://codereview.webrtc.org/2288223002 . Cr-Commit-Position: refs/heads/master@{#14186}