mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
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:
parent
ede7cb2ec1
commit
c44f6cc5fe
10 changed files with 19 additions and 11 deletions
|
@ -489,7 +489,7 @@ ChannelReceive::ChannelReceive(
|
|||
|
||||
configuration.event_log = event_log_;
|
||||
|
||||
_rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration));
|
||||
_rtpRtcpModule = RtpRtcp::Create(configuration);
|
||||
_rtpRtcpModule->SetSendingMediaStatus(false);
|
||||
_rtpRtcpModule->SetRemoteSSRC(remote_ssrc_);
|
||||
|
||||
|
|
|
@ -700,7 +700,7 @@ ChannelSend::ChannelSend(Clock* clock,
|
|||
configuration.extmap_allow_mixed = extmap_allow_mixed;
|
||||
configuration.rtcp_report_interval_ms = rtcp_report_interval_ms;
|
||||
|
||||
_rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration));
|
||||
_rtpRtcpModule = RtpRtcp::Create(configuration);
|
||||
_rtpRtcpModule->SetSendingMediaStatus(false);
|
||||
|
||||
// We want to invoke the 'TargetRateObserver' and |OnOverheadChanged|
|
||||
|
|
|
@ -130,8 +130,7 @@ std::unique_ptr<RtpRtcp> CreateRtpRtcpModule(
|
|||
configuration.receive_statistics = receive_statistics;
|
||||
configuration.outgoing_transport = rtcp_send_transport;
|
||||
configuration.rtt_stats = rtt_stats;
|
||||
std::unique_ptr<RtpRtcp> rtp_rtcp(RtpRtcp::CreateRtpRtcp(configuration));
|
||||
return rtp_rtcp;
|
||||
return RtpRtcp::Create(configuration);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -119,7 +119,7 @@ std::vector<RtpStreamSender> CreateRtpStreamSenders(
|
|||
auto playout_delay_oracle = absl::make_unique<PlayoutDelayOracle>();
|
||||
|
||||
configuration.ack_observer = playout_delay_oracle.get();
|
||||
auto rtp_rtcp = absl::WrapUnique(RtpRtcp::CreateRtpRtcp(configuration));
|
||||
auto rtp_rtcp = RtpRtcp::Create(configuration);
|
||||
rtp_rtcp->SetSendingStatus(false);
|
||||
rtp_rtcp->SetSendingMediaStatus(false);
|
||||
rtp_rtcp->SetRTCPStatus(RtcpMode::kCompound);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#ifndef MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_H_
|
||||
#define MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_H_
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
@ -119,8 +120,10 @@ class RtpRtcp : public Module, public RtcpFeedbackSenderInterface {
|
|||
RTC_DISALLOW_COPY_AND_ASSIGN(Configuration);
|
||||
};
|
||||
|
||||
// Create a RTP/RTCP module object using the system clock.
|
||||
// |configuration| - Configuration of the RTP/RTCP module.
|
||||
// Creates an RTP/RTCP module object using provided |configuration|.
|
||||
static std::unique_ptr<RtpRtcp> Create(const Configuration& configuration);
|
||||
// Prefer factory function just above.
|
||||
RTC_DEPRECATED
|
||||
static RtpRtcp* CreateRtpRtcp(const RtpRtcp::Configuration& configuration);
|
||||
|
||||
// **************************************************************************
|
||||
|
|
|
@ -136,7 +136,7 @@ class RtpRtcpRtxNackTest : public ::testing::Test {
|
|||
configuration.receive_statistics = receive_statistics_.get();
|
||||
configuration.outgoing_transport = &transport_;
|
||||
configuration.retransmission_rate_limiter = &retransmission_rate_limiter_;
|
||||
rtp_rtcp_module_ = absl::WrapUnique(RtpRtcp::CreateRtpRtcp(configuration));
|
||||
rtp_rtcp_module_ = RtpRtcp::Create(configuration);
|
||||
rtp_sender_video_ = absl::make_unique<RTPSenderVideo>(
|
||||
&fake_clock, rtp_rtcp_module_->RtpSender(), nullptr,
|
||||
&playout_delay_oracle_, nullptr, false, FieldTrialBasedConfig());
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -193,7 +193,7 @@ TEST_F(BandwidthEndToEndTest, RembWithSendSideBwe) {
|
|||
config.clock = clock_;
|
||||
config.outgoing_transport = receive_transport_;
|
||||
config.retransmission_rate_limiter = &retransmission_rate_limiter_;
|
||||
rtp_rtcp_.reset(RtpRtcp::CreateRtpRtcp(config));
|
||||
rtp_rtcp_ = RtpRtcp::Create(config);
|
||||
rtp_rtcp_->SetRemoteSSRC((*receive_configs)[0].rtp.remote_ssrc);
|
||||
rtp_rtcp_->SetSSRC((*receive_configs)[0].rtp.local_ssrc);
|
||||
rtp_rtcp_->SetRTCPStatus(RtcpMode::kReducedSize);
|
||||
|
|
|
@ -76,7 +76,7 @@ std::unique_ptr<RtpRtcp> CreateRtpRtcpModule(
|
|||
configuration.bandwidth_callback = nullptr;
|
||||
configuration.transport_feedback_callback = nullptr;
|
||||
|
||||
std::unique_ptr<RtpRtcp> rtp_rtcp(RtpRtcp::CreateRtpRtcp(configuration));
|
||||
std::unique_ptr<RtpRtcp> rtp_rtcp = RtpRtcp::Create(configuration);
|
||||
rtp_rtcp->SetRTCPStatus(RtcpMode::kCompound);
|
||||
|
||||
return rtp_rtcp;
|
||||
|
|
|
@ -1619,9 +1619,10 @@ TEST_F(VideoSendStreamTest, MinTransmitBitrateRespectsRemb) {
|
|||
const std::vector<VideoReceiveStream*>& receive_streams) override {
|
||||
stream_ = send_stream;
|
||||
RtpRtcp::Configuration config;
|
||||
config.clock = Clock::GetRealTimeClock();
|
||||
config.outgoing_transport = feedback_transport_.get();
|
||||
config.retransmission_rate_limiter = &retranmission_rate_limiter_;
|
||||
rtp_rtcp_.reset(RtpRtcp::CreateRtpRtcp(config));
|
||||
rtp_rtcp_ = RtpRtcp::Create(config);
|
||||
rtp_rtcp_->SetRTCPStatus(RtcpMode::kReducedSize);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue