Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1675)

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_sender.h

Issue 2061423003: Refactor NACK bitrate allocation (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Moved rate limiter and addressed comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/rtp_sender.h
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.h b/webrtc/modules/rtp_rtcp/source/rtp_sender.h
index ffbcb817e709cb569da1ec09c0e5d43adfd14735..1698f1761312093acb06534d70c6863c16923324 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender.h
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.h
@@ -20,10 +20,10 @@
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/random.h"
+#include "webrtc/base/rate_statistics.h"
#include "webrtc/base/thread_annotations.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
-#include "webrtc/modules/rtp_rtcp/source/bitrate.h"
#include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h"
@@ -93,7 +93,8 @@ class RTPSender : public RTPSenderInterface {
FrameCountObserver* frame_count_observer,
SendSideDelayObserver* send_side_delay_observer,
RtcEventLog* event_log,
- SendPacketObserver* send_packet_observer);
+ SendPacketObserver* send_packet_observer,
+ NackRateLimiter* nack_rate_limiter);
virtual ~RTPSender();
@@ -227,8 +228,6 @@ class RTPSender : public RTPSenderInterface {
int32_t ReSendPacket(uint16_t packet_id, int64_t min_resend_time = 0);
- bool ProcessNACKBitRate(uint32_t now);
-
// Feedback to decide when to stop sending playout delay.
void OnReceivedRtcpReportBlocks(const ReportBlockList& report_blocks);
@@ -340,8 +339,6 @@ class RTPSender : public RTPSenderInterface {
uint16_t sequence_number,
const std::vector<uint32_t>& csrcs) const;
- void UpdateNACKBitRate(uint32_t bytes, int64_t now);
-
bool PrepareAndSendPacket(uint8_t* buffer,
size_t length,
int64_t capture_time_ms,
@@ -406,45 +403,10 @@ class RTPSender : public RTPSenderInterface {
bool is_retransmit);
bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const;
- class BitrateAggregator {
- public:
- explicit BitrateAggregator(BitrateStatisticsObserver* bitrate_callback);
-
- void OnStatsUpdated() const;
-
- Bitrate::Observer* total_bitrate_observer();
- Bitrate::Observer* retransmit_bitrate_observer();
- void set_ssrc(uint32_t ssrc);
-
- private:
- // We assume that these observers are called on the same thread, which is
- // true for RtpSender as they are called on the Process thread.
- class BitrateObserver : public Bitrate::Observer {
- public:
- explicit BitrateObserver(const BitrateAggregator& aggregator);
-
- // Implements Bitrate::Observer.
- void BitrateUpdated(const BitrateStatistics& stats) override;
- const BitrateStatistics& statistics() const;
-
- private:
- BitrateStatistics statistics_;
- const BitrateAggregator& aggregator_;
- };
-
- BitrateStatisticsObserver* const callback_;
- BitrateObserver total_bitrate_observer_;
- BitrateObserver retransmit_bitrate_observer_;
- uint32_t ssrc_;
- };
-
Clock* const clock_;
const int64_t clock_delta_ms_;
Random random_ GUARDED_BY(send_critsect_);
- BitrateAggregator bitrates_;
- Bitrate total_bitrate_sent_;
-
const bool audio_configured_;
const std::unique_ptr<RTPSenderAudio> audio_;
const std::unique_ptr<RTPSenderVideo> video_;
@@ -470,11 +432,6 @@ class RTPSender : public RTPSenderInterface {
bool video_rotation_active_;
uint16_t transport_sequence_number_;
- // NACK
- uint32_t nack_byte_count_times_[NACK_BYTECOUNT_SIZE];
- size_t nack_byte_count_[NACK_BYTECOUNT_SIZE];
- Bitrate nack_bitrate_;
-
// Tracks the current request for playout delay limits from application
// and decides whether the current RTP frame should include the playout
// delay extension on header.
@@ -490,10 +447,13 @@ class RTPSender : public RTPSenderInterface {
StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_);
StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_);
StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_);
+ RateStatistics total_bitrate_sent_ GUARDED_BY(statistics_crit_);
+ RateStatistics nack_bitrate_sent_ GUARDED_BY(statistics_crit_);
FrameCountObserver* const frame_count_observer_;
SendSideDelayObserver* const send_side_delay_observer_;
RtcEventLog* const event_log_;
SendPacketObserver* const send_packet_observer_;
+ BitrateStatisticsObserver* const bitrate_callback_;
// RTP variables
bool start_timestamp_forced_ GUARDED_BY(send_critsect_);
@@ -523,6 +483,8 @@ class RTPSender : public RTPSenderInterface {
rtc::CriticalSection target_bitrate_critsect_;
uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_);
danilchap 2016/06/28 14:26:18 Is target_bitrate_ still in use?
sprang_webrtc 2016/07/04 09:33:04 Right, this was a big part of why I did this refac
+ NackRateLimiter* const nack_rate_limiter_;
+
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender);
};

Powered by Google App Engine
This is Rietveld 408576698