RtpSenderEgress: remove lock recursions.
This change removes lock recursions and adds thread annotations. Bug: webrtc:11567 Change-Id: I300272038764359d6612f28606730d1f44ffc759 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175101 Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Markus Handell <handellm@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31261}
This commit is contained in:
parent
02ba1d252e
commit
e1b526444c
@ -206,7 +206,7 @@ void RtpSenderEgress::ProcessBitrateAndNotifyObservers() {
|
||||
return;
|
||||
|
||||
rtc::CritScope lock(&lock_);
|
||||
RtpSendRates send_rates = GetSendRates();
|
||||
RtpSendRates send_rates = GetSendRatesLocked();
|
||||
bitrate_callback_->Notify(
|
||||
send_rates.Sum().bps(),
|
||||
send_rates[RtpPacketMediaType::kRetransmission].bps(), ssrc_);
|
||||
@ -214,6 +214,10 @@ void RtpSenderEgress::ProcessBitrateAndNotifyObservers() {
|
||||
|
||||
RtpSendRates RtpSenderEgress::GetSendRates() const {
|
||||
rtc::CritScope lock(&lock_);
|
||||
return GetSendRatesLocked();
|
||||
}
|
||||
|
||||
RtpSendRates RtpSenderEgress::GetSendRatesLocked() const {
|
||||
const int64_t now_ms = clock_->TimeInMilliseconds();
|
||||
RtpSendRates current_rates;
|
||||
for (size_t i = 0; i < kNumMediaTypes; ++i) {
|
||||
|
||||
@ -51,20 +51,23 @@ class RtpSenderEgress {
|
||||
RtpPacketHistory* packet_history);
|
||||
~RtpSenderEgress() = default;
|
||||
|
||||
void SendPacket(RtpPacketToSend* packet, const PacedPacketInfo& pacing_info);
|
||||
void SendPacket(RtpPacketToSend* packet, const PacedPacketInfo& pacing_info)
|
||||
RTC_LOCKS_EXCLUDED(lock_);
|
||||
uint32_t Ssrc() const { return ssrc_; }
|
||||
absl::optional<uint32_t> RtxSsrc() const { return rtx_ssrc_; }
|
||||
absl::optional<uint32_t> FlexFecSsrc() const { return flexfec_ssrc_; }
|
||||
|
||||
void ProcessBitrateAndNotifyObservers();
|
||||
RtpSendRates GetSendRates() const;
|
||||
void ProcessBitrateAndNotifyObservers() RTC_LOCKS_EXCLUDED(lock_);
|
||||
RtpSendRates GetSendRates() const RTC_LOCKS_EXCLUDED(lock_);
|
||||
void GetDataCounters(StreamDataCounters* rtp_stats,
|
||||
StreamDataCounters* rtx_stats) const;
|
||||
StreamDataCounters* rtx_stats) const
|
||||
RTC_LOCKS_EXCLUDED(lock_);
|
||||
|
||||
void ForceIncludeSendPacketsInAllocation(bool part_of_allocation);
|
||||
bool MediaHasBeenSent() const;
|
||||
void SetMediaHasBeenSent(bool media_sent);
|
||||
void SetTimestampOffset(uint32_t timestamp);
|
||||
void ForceIncludeSendPacketsInAllocation(bool part_of_allocation)
|
||||
RTC_LOCKS_EXCLUDED(lock_);
|
||||
bool MediaHasBeenSent() const RTC_LOCKS_EXCLUDED(lock_);
|
||||
void SetMediaHasBeenSent(bool media_sent) RTC_LOCKS_EXCLUDED(lock_);
|
||||
void SetTimestampOffset(uint32_t timestamp) RTC_LOCKS_EXCLUDED(lock_);
|
||||
|
||||
// For each sequence number in |sequence_number|, recall the last RTP packet
|
||||
// which bore it - its timestamp and whether it was the first and/or last
|
||||
@ -72,7 +75,8 @@ class RtpSenderEgress {
|
||||
// recalled, return a vector with all of them (in corresponding order).
|
||||
// If any could not be recalled, return an empty vector.
|
||||
std::vector<RtpSequenceNumberMap::Info> GetSentRtpPacketInfos(
|
||||
rtc::ArrayView<const uint16_t> sequence_numbers) const;
|
||||
rtc::ArrayView<const uint16_t> sequence_numbers) const
|
||||
RTC_LOCKS_EXCLUDED(lock_);
|
||||
|
||||
private:
|
||||
// Maps capture time in milliseconds to send-side delay in milliseconds.
|
||||
@ -80,6 +84,7 @@ class RtpSenderEgress {
|
||||
// time.
|
||||
typedef std::map<int64_t, int> SendDelayMap;
|
||||
|
||||
RtpSendRates GetSendRatesLocked() const RTC_EXCLUSIVE_LOCKS_REQUIRED(lock_);
|
||||
bool HasCorrectSsrc(const RtpPacketToSend& packet) const;
|
||||
void AddPacketToTransportFeedback(uint16_t packet_id,
|
||||
const RtpPacketToSend& packet,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user