Skip to content

Commit

Permalink
Refactoring PayloadRouter.
Browse files Browse the repository at this point in the history
- Move PayloadRouter to RtpTransportControllerInterface.
- Move RetransmissionLimiter inside RtpTransportControllerSend from
  VideoSendStreamImpl.
- Move video RTP specifics into PayloadRouter, in particular ownership
  of the RTP modules.
- PayloadRouter now contains all video specific RTP code, and will be
  renamed in a follow-up to VideoRtpSender.
- Introduce VideoRtpSenderInterface.

Bug: webrtc:9517
Change-Id: I1c7b293fa6f9c320286c80533b3c584498034a38
Reviewed-on: https://webrtc-review.googlesource.com/88240
Commit-Queue: Stefan Holmer <[email protected]>
Reviewed-by: Sebastian Jansson <[email protected]>
Cr-Commit-Position: refs/heads/master@{#24009}
  • Loading branch information
Stefan Holmer authored and Commit Bot committed Jul 17, 2018
1 parent e1d7b23 commit dbdb3a0
Show file tree
Hide file tree
Showing 45 changed files with 1,199 additions and 783 deletions.
2 changes: 1 addition & 1 deletion api/video/video_stream_encoder_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class VideoStreamEncoderInterface : public rtc::VideoSinkInterface<VideoFrame> {
int min_transmit_bitrate_bps) = 0;
};

virtual ~VideoStreamEncoderInterface() = default;
~VideoStreamEncoderInterface() override = default;

// Sets the source that will provide video frames to the VideoStreamEncoder's
// OnFrame method. |degradation_preference| control whether or not resolution
Expand Down
8 changes: 8 additions & 0 deletions call/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ rtc_source_set("rtp_interfaces") {
"../api:array_view",
"../api:libjingle_peerconnection_api",
"../api/transport:bitrate_settings",
"../logging:rtc_event_log_api",
"../modules/rtp_rtcp:rtp_rtcp_format",
"../rtc_base:rtc_base_approved",
"//third_party/abseil-cpp/absl/types:optional",
]
Expand Down Expand Up @@ -104,13 +106,16 @@ rtc_source_set("rtp_sender") {
"rtp_payload_params.h",
"rtp_transport_controller_send.cc",
"rtp_transport_controller_send.h",
"video_rtp_sender_interface.h",
]
deps = [
":bitrate_configurator",
":rtp_interfaces",
"..:webrtc_common",
"../api:transport_api",
"../api/transport:network_control",
"../api/video_codecs:video_codecs_api",
"../logging:rtc_event_log_api",
"../modules/congestion_controller",
"../modules/congestion_controller/rtp:congestion_controller",
"../modules/pacing",
Expand All @@ -120,6 +125,7 @@ rtc_source_set("rtp_sender") {
"../modules/utility",
"../modules/video_coding:video_codec_interface",
"../rtc_base:checks",
"../rtc_base:rate_limiter",
"../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_task_queue",
Expand Down Expand Up @@ -318,6 +324,7 @@ if (rtc_include_tests) {
"../modules/utility:mock_process_thread",
"../modules/video_coding:video_codec_interface",
"../rtc_base:checks",
"../rtc_base:rate_limiter",
"../rtc_base:rtc_base_approved",
"../system_wrappers",
"../test:audio_codec_mocks",
Expand All @@ -326,6 +333,7 @@ if (rtc_include_tests) {
"../test:test_common",
"../test:test_support",
"../test:video_test_common",
"../video:video",
"//testing/gtest",
"//third_party/abseil-cpp/absl/memory",
]
Expand Down
2 changes: 1 addition & 1 deletion call/bitrate_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class BitrateAllocator : public BitrateAllocatorInterface {
};

explicit BitrateAllocator(LimitObserver* limit_observer);
~BitrateAllocator();
~BitrateAllocator() override;

// Allocate target_bitrate across the registered BitrateAllocatorObservers.
void OnNetworkChanged(uint32_t target_bitrate_bps,
Expand Down
13 changes: 1 addition & 12 deletions call/call.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#include "rtc_base/location.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_minmax.h"
#include "rtc_base/rate_limiter.h"
#include "rtc_base/sequenced_task_checker.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/synchronization/rw_lock_wrapper.h"
Expand All @@ -70,8 +69,6 @@
namespace webrtc {

namespace {
static const int64_t kRetransmitWindowSizeMs = 500;

// TODO(nisse): This really begs for a shared context struct.
bool UseSendSideBwe(const std::vector<RtpExtension>& extensions,
bool transport_cc) {
Expand Down Expand Up @@ -361,7 +358,6 @@ class Call final : public webrtc::Call,
RTC_GUARDED_BY(&bitrate_crit_);
AvgCounter pacer_bitrate_kbps_counter_ RTC_GUARDED_BY(&bitrate_crit_);

RateLimiter retransmission_rate_limiter_;
ReceiveSideCongestionController receive_side_cc_;

const std::unique_ptr<ReceiveTimeCalculator> receive_time_calculator_;
Expand Down Expand Up @@ -442,7 +438,6 @@ Call::Call(const Call::Config& config,
configured_max_padding_bitrate_bps_(0),
estimated_send_bitrate_kbps_counter_(clock_, nullptr, true),
pacer_bitrate_kbps_counter_(clock_, nullptr, true),
retransmission_rate_limiter_(clock_, kRetransmitWindowSizeMs),
receive_side_cc_(clock_, transport_send->packet_router()),
receive_time_calculator_(ReceiveTimeCalculator::CreateFromFieldTrial()),
video_send_delay_stats_(new SendDelayStats(clock_)),
Expand Down Expand Up @@ -732,8 +727,7 @@ webrtc::VideoSendStream* Call::CreateVideoSendStream(
transport_send_ptr_, bitrate_allocator_.get(),
video_send_delay_stats_.get(), event_log_, std::move(config),
std::move(encoder_config), suspended_video_send_ssrcs_,
suspended_video_payload_states_, std::move(fec_controller),
&retransmission_rate_limiter_);
suspended_video_payload_states_, std::move(fec_controller));

{
WriteLockScoped write_lock(*send_crit_);
Expand All @@ -743,7 +737,6 @@ webrtc::VideoSendStream* Call::CreateVideoSendStream(
}
video_send_streams_.insert(send_stream);
}
send_stream->SignalNetworkState(video_network_state_);
UpdateAggregateNetworkState();

return send_stream;
Expand Down Expand Up @@ -991,9 +984,6 @@ void Call::SignalChannelNetworkState(MediaType media, NetworkState state) {
for (auto& kv : audio_send_ssrcs_) {
kv.second->SignalNetworkState(audio_network_state_);
}
for (auto& kv : video_send_ssrcs_) {
kv.second->SignalNetworkState(video_network_state_);
}
}
{
ReadLockScoped read_lock(*receive_crit_);
Expand Down Expand Up @@ -1081,7 +1071,6 @@ void Call::OnTargetTransferRate(TargetTransferRate msg) {
rtc::CritScope cs(&last_bandwidth_bps_crit_);
last_bandwidth_bps_ = bandwidth_bps;
}
retransmission_rate_limiter_.SetMaxRate(bandwidth_bps);
// For controlling the rate of feedback messages.
receive_side_cc_.OnBitrateChanged(target_bitrate_bps);
bitrate_allocator_->OnNetworkChanged(target_bitrate_bps, fraction_loss,
Expand Down
Loading

0 comments on commit dbdb3a0

Please sign in to comment.