Clean up ownership of webrtc::VideoEncoder

Currently, webrtc::VideoEncoders are supposed to be deleted through the
factory that created them with the
WebRtcVideoEncoderFactory::DestroyVideoEncoder method. In practice,
we sometimes use this method and sometimes we just call delete on the
webrtc::VideoEncoder pointer. We want to be able to consistently use the
normal destructor of webrtc::VideoEncoder instead of having to call
DestroyVideoEncoder so that we can put webrtc::VideoEncoder inside
an std::unique_ptr and make ownership more clear. As part of webrtc:7925
we also want to make a new encoder factory class that does not have the
DestroyVideoEncoder() method, and this CL is a step in that direction.

This CL introduces a helper function CreateScopedVideoEncoder that takes
a webrtc::VideoEncoder and a WebRtcVideoEncoderFactory pointer, and
returns a new webrtc::VideoEncoder instance that can be deleted through
the regular destructor.

This CL also removes WebRtcSimulcastEncoderFactory that almost only
contains logic for handling the DestroyVideoEncoder calls that we no
longer need, and inlines the rest of the logic inside the
WebRtcVideoChannel::WebRtcVideoSendStream::CreateVideoEncoder method.

BUG=webrtc:7925

Review-Url: https://codereview.webrtc.org/3007643002
Cr-Original-Commit-Position: refs/heads/master@{#19564}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 3f8975839865d668b993d3f84824167672830235
7 files changed