Removed new calls on RtpTransportControllerSend.
new is an unsafe construct, while these specific cases were properly handled it is a code smell and using unique_ptr from the start makes the code more obviously correct. Bug: None Change-Id: I2554cef8d3a8432a3ced1623292fae0adff9421d Reviewed-on: https://webrtc-review.googlesource.com/56620 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22147}
This commit is contained in:

committed by
Commit Bot

parent
5d436ac0bf
commit
9a03dd89e0
@ -24,6 +24,7 @@
|
||||
#include "ortc/rtptransportadapter.h"
|
||||
#include "pc/rtpmediautils.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/ptr_util.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -650,12 +651,11 @@ void RtpTransportControllerAdapter::Init_w() {
|
||||
call_config.bitrate_config.min_bitrate_bps = kMinBandwidthBps;
|
||||
call_config.bitrate_config.start_bitrate_bps = kStartBandwidthBps;
|
||||
call_config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps;
|
||||
|
||||
call_send_rtp_transport_controller_ = new RtpTransportControllerSend(
|
||||
std::unique_ptr<RtpTransportControllerSend> controller_send =
|
||||
rtc::MakeUnique<RtpTransportControllerSend>(
|
||||
Clock::GetRealTimeClock(), event_log_, call_config.bitrate_config);
|
||||
call_.reset(webrtc::Call::Create(
|
||||
call_config, std::unique_ptr<RtpTransportControllerSendInterface>(
|
||||
call_send_rtp_transport_controller_)));
|
||||
call_send_rtp_transport_controller_ = controller_send.get();
|
||||
call_.reset(webrtc::Call::Create(call_config, std::move(controller_send)));
|
||||
}
|
||||
|
||||
void RtpTransportControllerAdapter::Close_w() {
|
||||
|
@ -171,12 +171,11 @@ void CallTest::CreateCalls(const Call::Config& sender_config,
|
||||
}
|
||||
|
||||
void CallTest::CreateSenderCall(const Call::Config& config) {
|
||||
sender_call_transport_controller_ = new RtpTransportControllerSend(
|
||||
std::unique_ptr<RtpTransportControllerSend> controller_send =
|
||||
rtc::MakeUnique<RtpTransportControllerSend>(
|
||||
Clock::GetRealTimeClock(), config.event_log, config.bitrate_config);
|
||||
|
||||
sender_call_.reset(
|
||||
Call::Create(config, std::unique_ptr<RtpTransportControllerSend>(
|
||||
sender_call_transport_controller_)));
|
||||
sender_call_transport_controller_ = controller_send.get();
|
||||
sender_call_.reset(Call::Create(config, std::move(controller_send)));
|
||||
}
|
||||
|
||||
void CallTest::CreateReceiverCall(const Call::Config& config) {
|
||||
|
Reference in New Issue
Block a user