Modernize RtpRtcp factory function: use unique_ptr as return type

to clearly signal passed ownership.
Drop support for accepting nullptr clock to avoid copying the Configuration structure.
Update all calls in webrtc to the new factory function

Bug: None
Change-Id: Ic5a78da8e59ba3988a757a9d9634fa31499ce0db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/125901
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26994}
This commit is contained in:
Danil Chapovalov
2019-03-06 11:31:09 +01:00
committed by Commit Bot
parent ede7cb2ec1
commit c44f6cc5fe
10 changed files with 19 additions and 11 deletions

View File

@ -41,6 +41,11 @@ constexpr int32_t kDefaultAudioReportInterval = 5000;
RtpRtcp::Configuration::Configuration() = default;
std::unique_ptr<RtpRtcp> RtpRtcp::Create(const Configuration& configuration) {
RTC_DCHECK(configuration.clock);
return absl::make_unique<ModuleRtpRtcpImpl>(configuration);
}
RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) {
if (configuration.clock) {
return new ModuleRtpRtcpImpl(configuration);