Migrate leftovers in media/ and modules/ to webrtc::Mutex.
Bug: webrtc:11567 Change-Id: Id40a53fcec6cba1cd5af70422291ba46b0a6da8c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178905 Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Magnus Flodman <mflodman@webrtc.org> Commit-Queue: Markus Handell <handellm@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31694}
This commit is contained in:
committed by
Commit Bot
parent
85585f4a52
commit
f7303e6486
@ -190,7 +190,7 @@ bool VideoAdapter::AdaptFrameResolution(int in_width,
|
|||||||
int* cropped_height,
|
int* cropped_height,
|
||||||
int* out_width,
|
int* out_width,
|
||||||
int* out_height) {
|
int* out_height) {
|
||||||
rtc::CritScope cs(&critical_section_);
|
webrtc::MutexLock lock(&mutex_);
|
||||||
++frames_in_;
|
++frames_in_;
|
||||||
|
|
||||||
// The max output pixel count is the minimum of the requests from
|
// The max output pixel count is the minimum of the requests from
|
||||||
@ -329,7 +329,7 @@ void VideoAdapter::OnOutputFormatRequest(
|
|||||||
const absl::optional<std::pair<int, int>>& target_portrait_aspect_ratio,
|
const absl::optional<std::pair<int, int>>& target_portrait_aspect_ratio,
|
||||||
const absl::optional<int>& max_portrait_pixel_count,
|
const absl::optional<int>& max_portrait_pixel_count,
|
||||||
const absl::optional<int>& max_fps) {
|
const absl::optional<int>& max_fps) {
|
||||||
rtc::CritScope cs(&critical_section_);
|
webrtc::MutexLock lock(&mutex_);
|
||||||
target_landscape_aspect_ratio_ = target_landscape_aspect_ratio;
|
target_landscape_aspect_ratio_ = target_landscape_aspect_ratio;
|
||||||
max_landscape_pixel_count_ = max_landscape_pixel_count;
|
max_landscape_pixel_count_ = max_landscape_pixel_count;
|
||||||
target_portrait_aspect_ratio_ = target_portrait_aspect_ratio;
|
target_portrait_aspect_ratio_ = target_portrait_aspect_ratio;
|
||||||
@ -339,7 +339,7 @@ void VideoAdapter::OnOutputFormatRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VideoAdapter::OnSinkWants(const rtc::VideoSinkWants& sink_wants) {
|
void VideoAdapter::OnSinkWants(const rtc::VideoSinkWants& sink_wants) {
|
||||||
rtc::CritScope cs(&critical_section_);
|
webrtc::MutexLock lock(&mutex_);
|
||||||
resolution_request_max_pixel_count_ = sink_wants.max_pixel_count;
|
resolution_request_max_pixel_count_ = sink_wants.max_pixel_count;
|
||||||
resolution_request_target_pixel_count_ =
|
resolution_request_target_pixel_count_ =
|
||||||
sink_wants.target_pixel_count.value_or(
|
sink_wants.target_pixel_count.value_or(
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
#include "api/video/video_source_interface.h"
|
#include "api/video/video_source_interface.h"
|
||||||
#include "media/base/video_common.h"
|
#include "media/base/video_common.h"
|
||||||
#include "rtc_base/constructor_magic.h"
|
#include "rtc_base/constructor_magic.h"
|
||||||
#include "rtc_base/critical_section.h"
|
#include "rtc_base/synchronization/mutex.h"
|
||||||
#include "rtc_base/thread_annotations.h"
|
#include "rtc_base/thread_annotations.h"
|
||||||
|
|
||||||
namespace cricket {
|
namespace cricket {
|
||||||
@ -46,8 +46,7 @@ class VideoAdapter {
|
|||||||
int* cropped_width,
|
int* cropped_width,
|
||||||
int* cropped_height,
|
int* cropped_height,
|
||||||
int* out_width,
|
int* out_width,
|
||||||
int* out_height)
|
int* out_height) RTC_LOCKS_EXCLUDED(mutex_);
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_);
|
|
||||||
|
|
||||||
// DEPRECATED. Please use OnOutputFormatRequest below.
|
// DEPRECATED. Please use OnOutputFormatRequest below.
|
||||||
// TODO(asapersson): Remove this once it is no longer used.
|
// TODO(asapersson): Remove this once it is no longer used.
|
||||||
@ -59,7 +58,7 @@ class VideoAdapter {
|
|||||||
// 720x1280 is requested.
|
// 720x1280 is requested.
|
||||||
// Note: Should be called from the source only.
|
// Note: Should be called from the source only.
|
||||||
void OnOutputFormatRequest(const absl::optional<VideoFormat>& format)
|
void OnOutputFormatRequest(const absl::optional<VideoFormat>& format)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_);
|
RTC_LOCKS_EXCLUDED(mutex_);
|
||||||
|
|
||||||
// Requests output frame size and frame interval from |AdaptFrameResolution|.
|
// Requests output frame size and frame interval from |AdaptFrameResolution|.
|
||||||
// |target_aspect_ratio|: The input frame size will be cropped to match the
|
// |target_aspect_ratio|: The input frame size will be cropped to match the
|
||||||
@ -72,7 +71,7 @@ class VideoAdapter {
|
|||||||
void OnOutputFormatRequest(
|
void OnOutputFormatRequest(
|
||||||
const absl::optional<std::pair<int, int>>& target_aspect_ratio,
|
const absl::optional<std::pair<int, int>>& target_aspect_ratio,
|
||||||
const absl::optional<int>& max_pixel_count,
|
const absl::optional<int>& max_pixel_count,
|
||||||
const absl::optional<int>& max_fps) RTC_LOCKS_EXCLUDED(critical_section_);
|
const absl::optional<int>& max_fps) RTC_LOCKS_EXCLUDED(mutex_);
|
||||||
|
|
||||||
// Same as above, but allows setting two different target aspect ratios
|
// Same as above, but allows setting two different target aspect ratios
|
||||||
// depending on incoming frame orientation. This gives more fine-grained
|
// depending on incoming frame orientation. This gives more fine-grained
|
||||||
@ -83,7 +82,7 @@ class VideoAdapter {
|
|||||||
const absl::optional<int>& max_landscape_pixel_count,
|
const absl::optional<int>& max_landscape_pixel_count,
|
||||||
const absl::optional<std::pair<int, int>>& target_portrait_aspect_ratio,
|
const absl::optional<std::pair<int, int>>& target_portrait_aspect_ratio,
|
||||||
const absl::optional<int>& max_portrait_pixel_count,
|
const absl::optional<int>& max_portrait_pixel_count,
|
||||||
const absl::optional<int>& max_fps) RTC_LOCKS_EXCLUDED(critical_section_);
|
const absl::optional<int>& max_fps) RTC_LOCKS_EXCLUDED(mutex_);
|
||||||
|
|
||||||
// Requests the output frame size from |AdaptFrameResolution| to have as close
|
// Requests the output frame size from |AdaptFrameResolution| to have as close
|
||||||
// as possible to |sink_wants.target_pixel_count| pixels (if set)
|
// as possible to |sink_wants.target_pixel_count| pixels (if set)
|
||||||
@ -96,24 +95,20 @@ class VideoAdapter {
|
|||||||
// |sink_wants.resolution_alignment|.
|
// |sink_wants.resolution_alignment|.
|
||||||
// Note: Should be called from the sink only.
|
// Note: Should be called from the sink only.
|
||||||
void OnSinkWants(const rtc::VideoSinkWants& sink_wants)
|
void OnSinkWants(const rtc::VideoSinkWants& sink_wants)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_);
|
RTC_LOCKS_EXCLUDED(mutex_);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Determine if frame should be dropped based on input fps and requested fps.
|
// Determine if frame should be dropped based on input fps and requested fps.
|
||||||
bool KeepFrame(int64_t in_timestamp_ns)
|
bool KeepFrame(int64_t in_timestamp_ns) RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_);
|
|
||||||
|
|
||||||
int frames_in_ RTC_GUARDED_BY(critical_section_); // Number of input frames.
|
int frames_in_ RTC_GUARDED_BY(mutex_); // Number of input frames.
|
||||||
int frames_out_
|
int frames_out_ RTC_GUARDED_BY(mutex_); // Number of output frames.
|
||||||
RTC_GUARDED_BY(critical_section_); // Number of output frames.
|
int frames_scaled_ RTC_GUARDED_BY(mutex_); // Number of frames scaled.
|
||||||
int frames_scaled_
|
|
||||||
RTC_GUARDED_BY(critical_section_); // Number of frames scaled.
|
|
||||||
int adaption_changes_
|
int adaption_changes_
|
||||||
RTC_GUARDED_BY(critical_section_); // Number of changes in scale factor.
|
RTC_GUARDED_BY(mutex_); // Number of changes in scale factor.
|
||||||
int previous_width_
|
int previous_width_ RTC_GUARDED_BY(mutex_); // Previous adapter output width.
|
||||||
RTC_GUARDED_BY(critical_section_); // Previous adapter output width.
|
|
||||||
int previous_height_
|
int previous_height_
|
||||||
RTC_GUARDED_BY(critical_section_); // Previous adapter output height.
|
RTC_GUARDED_BY(mutex_); // Previous adapter output height.
|
||||||
const bool variable_start_scale_factor_;
|
const bool variable_start_scale_factor_;
|
||||||
|
|
||||||
// The fixed source resolution alignment requirement.
|
// The fixed source resolution alignment requirement.
|
||||||
@ -121,30 +116,27 @@ class VideoAdapter {
|
|||||||
// The currently applied resolution alignment, as given by the requirements:
|
// The currently applied resolution alignment, as given by the requirements:
|
||||||
// - the fixed |source_resolution_alignment_|; and
|
// - the fixed |source_resolution_alignment_|; and
|
||||||
// - the latest |sink_wants.resolution_alignment|.
|
// - the latest |sink_wants.resolution_alignment|.
|
||||||
int resolution_alignment_ RTC_GUARDED_BY(critical_section_);
|
int resolution_alignment_ RTC_GUARDED_BY(mutex_);
|
||||||
|
|
||||||
// The target timestamp for the next frame based on requested format.
|
// The target timestamp for the next frame based on requested format.
|
||||||
absl::optional<int64_t> next_frame_timestamp_ns_
|
absl::optional<int64_t> next_frame_timestamp_ns_ RTC_GUARDED_BY(mutex_);
|
||||||
RTC_GUARDED_BY(critical_section_);
|
|
||||||
|
|
||||||
// Max number of pixels/fps requested via calls to OnOutputFormatRequest,
|
// Max number of pixels/fps requested via calls to OnOutputFormatRequest,
|
||||||
// OnResolutionFramerateRequest respectively.
|
// OnResolutionFramerateRequest respectively.
|
||||||
// The adapted output format is the minimum of these.
|
// The adapted output format is the minimum of these.
|
||||||
absl::optional<std::pair<int, int>> target_landscape_aspect_ratio_
|
absl::optional<std::pair<int, int>> target_landscape_aspect_ratio_
|
||||||
RTC_GUARDED_BY(critical_section_);
|
RTC_GUARDED_BY(mutex_);
|
||||||
absl::optional<int> max_landscape_pixel_count_
|
absl::optional<int> max_landscape_pixel_count_ RTC_GUARDED_BY(mutex_);
|
||||||
RTC_GUARDED_BY(critical_section_);
|
|
||||||
absl::optional<std::pair<int, int>> target_portrait_aspect_ratio_
|
absl::optional<std::pair<int, int>> target_portrait_aspect_ratio_
|
||||||
RTC_GUARDED_BY(critical_section_);
|
RTC_GUARDED_BY(mutex_);
|
||||||
absl::optional<int> max_portrait_pixel_count_
|
absl::optional<int> max_portrait_pixel_count_ RTC_GUARDED_BY(mutex_);
|
||||||
RTC_GUARDED_BY(critical_section_);
|
absl::optional<int> max_fps_ RTC_GUARDED_BY(mutex_);
|
||||||
absl::optional<int> max_fps_ RTC_GUARDED_BY(critical_section_);
|
int resolution_request_target_pixel_count_ RTC_GUARDED_BY(mutex_);
|
||||||
int resolution_request_target_pixel_count_ RTC_GUARDED_BY(critical_section_);
|
int resolution_request_max_pixel_count_ RTC_GUARDED_BY(mutex_);
|
||||||
int resolution_request_max_pixel_count_ RTC_GUARDED_BY(critical_section_);
|
int max_framerate_request_ RTC_GUARDED_BY(mutex_);
|
||||||
int max_framerate_request_ RTC_GUARDED_BY(critical_section_);
|
|
||||||
|
|
||||||
// The critical section to protect the above variables.
|
// The critical section to protect the above variables.
|
||||||
rtc::CriticalSection critical_section_;
|
webrtc::Mutex mutex_;
|
||||||
|
|
||||||
RTC_DISALLOW_COPY_AND_ASSIGN(VideoAdapter);
|
RTC_DISALLOW_COPY_AND_ASSIGN(VideoAdapter);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -199,12 +199,12 @@ RTCPSender::RTCPSender(const RtpRtcpInterface::Configuration& config)
|
|||||||
RTCPSender::~RTCPSender() {}
|
RTCPSender::~RTCPSender() {}
|
||||||
|
|
||||||
RtcpMode RTCPSender::Status() const {
|
RtcpMode RTCPSender::Status() const {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
return method_;
|
return method_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTCPSender::SetRTCPStatus(RtcpMode new_method) {
|
void RTCPSender::SetRTCPStatus(RtcpMode new_method) {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
|
|
||||||
if (method_ == RtcpMode::kOff && new_method != RtcpMode::kOff) {
|
if (method_ == RtcpMode::kOff && new_method != RtcpMode::kOff) {
|
||||||
// When switching on, reschedule the next packet
|
// When switching on, reschedule the next packet
|
||||||
@ -215,7 +215,7 @@ void RTCPSender::SetRTCPStatus(RtcpMode new_method) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool RTCPSender::Sending() const {
|
bool RTCPSender::Sending() const {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
return sending_;
|
return sending_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ int32_t RTCPSender::SetSendingStatus(const FeedbackState& feedback_state,
|
|||||||
bool sending) {
|
bool sending) {
|
||||||
bool sendRTCPBye = false;
|
bool sendRTCPBye = false;
|
||||||
{
|
{
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
|
|
||||||
if (method_ != RtcpMode::kOff) {
|
if (method_ != RtcpMode::kOff) {
|
||||||
if (sending == false && sending_ == true) {
|
if (sending == false && sending_ == true) {
|
||||||
@ -243,7 +243,7 @@ int32_t RTCPSender::SendLossNotification(const FeedbackState& feedback_state,
|
|||||||
uint16_t last_received_seq_num,
|
uint16_t last_received_seq_num,
|
||||||
bool decodability_flag,
|
bool decodability_flag,
|
||||||
bool buffering_allowed) {
|
bool buffering_allowed) {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
|
|
||||||
loss_notification_state_.last_decoded_seq_num = last_decoded_seq_num;
|
loss_notification_state_.last_decoded_seq_num = last_decoded_seq_num;
|
||||||
loss_notification_state_.last_received_seq_num = last_received_seq_num;
|
loss_notification_state_.last_received_seq_num = last_received_seq_num;
|
||||||
@ -262,7 +262,7 @@ int32_t RTCPSender::SendLossNotification(const FeedbackState& feedback_state,
|
|||||||
|
|
||||||
void RTCPSender::SetRemb(int64_t bitrate_bps, std::vector<uint32_t> ssrcs) {
|
void RTCPSender::SetRemb(int64_t bitrate_bps, std::vector<uint32_t> ssrcs) {
|
||||||
RTC_CHECK_GE(bitrate_bps, 0);
|
RTC_CHECK_GE(bitrate_bps, 0);
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
remb_bitrate_ = bitrate_bps;
|
remb_bitrate_ = bitrate_bps;
|
||||||
remb_ssrcs_ = std::move(ssrcs);
|
remb_ssrcs_ = std::move(ssrcs);
|
||||||
|
|
||||||
@ -273,18 +273,18 @@ void RTCPSender::SetRemb(int64_t bitrate_bps, std::vector<uint32_t> ssrcs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RTCPSender::UnsetRemb() {
|
void RTCPSender::UnsetRemb() {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
// Stop sending REMB each report until it is reenabled and REMB data set.
|
// Stop sending REMB each report until it is reenabled and REMB data set.
|
||||||
ConsumeFlag(kRtcpRemb, /*forced=*/true);
|
ConsumeFlag(kRtcpRemb, /*forced=*/true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTCPSender::TMMBR() const {
|
bool RTCPSender::TMMBR() const {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
return IsFlagPresent(RTCPPacketType::kRtcpTmmbr);
|
return IsFlagPresent(RTCPPacketType::kRtcpTmmbr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTCPSender::SetTMMBRStatus(bool enable) {
|
void RTCPSender::SetTMMBRStatus(bool enable) {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
SetFlag(RTCPPacketType::kRtcpTmmbr, false);
|
SetFlag(RTCPPacketType::kRtcpTmmbr, false);
|
||||||
} else {
|
} else {
|
||||||
@ -293,19 +293,19 @@ void RTCPSender::SetTMMBRStatus(bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RTCPSender::SetMaxRtpPacketSize(size_t max_packet_size) {
|
void RTCPSender::SetMaxRtpPacketSize(size_t max_packet_size) {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
max_packet_size_ = max_packet_size;
|
max_packet_size_ = max_packet_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTCPSender::SetTimestampOffset(uint32_t timestamp_offset) {
|
void RTCPSender::SetTimestampOffset(uint32_t timestamp_offset) {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
timestamp_offset_ = timestamp_offset;
|
timestamp_offset_ = timestamp_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTCPSender::SetLastRtpTime(uint32_t rtp_timestamp,
|
void RTCPSender::SetLastRtpTime(uint32_t rtp_timestamp,
|
||||||
int64_t capture_time_ms,
|
int64_t capture_time_ms,
|
||||||
int8_t payload_type) {
|
int8_t payload_type) {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
// For compatibility with clients who don't set payload type correctly on all
|
// For compatibility with clients who don't set payload type correctly on all
|
||||||
// calls.
|
// calls.
|
||||||
if (payload_type != -1) {
|
if (payload_type != -1) {
|
||||||
@ -321,12 +321,12 @@ void RTCPSender::SetLastRtpTime(uint32_t rtp_timestamp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RTCPSender::SetRtpClockRate(int8_t payload_type, int rtp_clock_rate_hz) {
|
void RTCPSender::SetRtpClockRate(int8_t payload_type, int rtp_clock_rate_hz) {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
rtp_clock_rates_khz_[payload_type] = rtp_clock_rate_hz / 1000;
|
rtp_clock_rates_khz_[payload_type] = rtp_clock_rate_hz / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTCPSender::SetRemoteSSRC(uint32_t ssrc) {
|
void RTCPSender::SetRemoteSSRC(uint32_t ssrc) {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
remote_ssrc_ = ssrc;
|
remote_ssrc_ = ssrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ int32_t RTCPSender::SetCNAME(const char* c_name) {
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
RTC_DCHECK_LT(strlen(c_name), RTCP_CNAME_SIZE);
|
RTC_DCHECK_LT(strlen(c_name), RTCP_CNAME_SIZE);
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
cname_ = c_name;
|
cname_ = c_name;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -343,7 +343,7 @@ int32_t RTCPSender::SetCNAME(const char* c_name) {
|
|||||||
int32_t RTCPSender::AddMixedCNAME(uint32_t SSRC, const char* c_name) {
|
int32_t RTCPSender::AddMixedCNAME(uint32_t SSRC, const char* c_name) {
|
||||||
RTC_DCHECK(c_name);
|
RTC_DCHECK(c_name);
|
||||||
RTC_DCHECK_LT(strlen(c_name), RTCP_CNAME_SIZE);
|
RTC_DCHECK_LT(strlen(c_name), RTCP_CNAME_SIZE);
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
// One spot is reserved for ssrc_/cname_.
|
// One spot is reserved for ssrc_/cname_.
|
||||||
// TODO(danilchap): Add support for more than 30 contributes by sending
|
// TODO(danilchap): Add support for more than 30 contributes by sending
|
||||||
// several sdes packets.
|
// several sdes packets.
|
||||||
@ -355,7 +355,7 @@ int32_t RTCPSender::AddMixedCNAME(uint32_t SSRC, const char* c_name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t RTCPSender::RemoveMixedCNAME(uint32_t SSRC) {
|
int32_t RTCPSender::RemoveMixedCNAME(uint32_t SSRC) {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
auto it = csrc_cnames_.find(SSRC);
|
auto it = csrc_cnames_.find(SSRC);
|
||||||
|
|
||||||
if (it == csrc_cnames_.end())
|
if (it == csrc_cnames_.end())
|
||||||
@ -426,7 +426,7 @@ bool RTCPSender::TimeToSendRTCPReport(bool sendKeyframeBeforeRTP) const {
|
|||||||
|
|
||||||
int64_t now = clock_->TimeInMilliseconds();
|
int64_t now = clock_->TimeInMilliseconds();
|
||||||
|
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
|
|
||||||
if (method_ == RtcpMode::kOff)
|
if (method_ == RtcpMode::kOff)
|
||||||
return false;
|
return false;
|
||||||
@ -532,7 +532,7 @@ std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildREMB(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RTCPSender::SetTargetBitrate(unsigned int target_bitrate) {
|
void RTCPSender::SetTargetBitrate(unsigned int target_bitrate) {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
tmmbr_send_bps_ = target_bitrate;
|
tmmbr_send_bps_ = target_bitrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,7 +548,7 @@ std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR(
|
|||||||
// get current bounding set from RTCP receiver
|
// get current bounding set from RTCP receiver
|
||||||
bool tmmbr_owner = false;
|
bool tmmbr_owner = false;
|
||||||
|
|
||||||
// holding critical_section_rtcp_sender_ while calling RTCPreceiver which
|
// holding mutex_rtcp_sender_ while calling RTCPreceiver which
|
||||||
// will accuire criticalSectionRTCPReceiver_ is a potental deadlock but
|
// will accuire criticalSectionRTCPReceiver_ is a potental deadlock but
|
||||||
// since RTCPreceiver is not doing the reverse we should be fine
|
// since RTCPreceiver is not doing the reverse we should be fine
|
||||||
std::vector<rtcp::TmmbItem> candidates =
|
std::vector<rtcp::TmmbItem> candidates =
|
||||||
@ -702,7 +702,7 @@ int32_t RTCPSender::SendCompoundRTCP(
|
|||||||
size_t max_packet_size;
|
size_t max_packet_size;
|
||||||
|
|
||||||
{
|
{
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
auto result = ComputeCompoundRTCPPacket(feedback_state, packet_types,
|
auto result = ComputeCompoundRTCPPacket(feedback_state, packet_types,
|
||||||
nack_size, nack_list, &container);
|
nack_size, nack_list, &container);
|
||||||
if (result) {
|
if (result) {
|
||||||
@ -895,22 +895,22 @@ std::vector<rtcp::ReportBlock> RTCPSender::CreateReportBlocks(
|
|||||||
|
|
||||||
void RTCPSender::SetCsrcs(const std::vector<uint32_t>& csrcs) {
|
void RTCPSender::SetCsrcs(const std::vector<uint32_t>& csrcs) {
|
||||||
RTC_DCHECK_LE(csrcs.size(), kRtpCsrcSize);
|
RTC_DCHECK_LE(csrcs.size(), kRtpCsrcSize);
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
csrcs_ = csrcs;
|
csrcs_ = csrcs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTCPSender::SendRtcpXrReceiverReferenceTime(bool enable) {
|
void RTCPSender::SendRtcpXrReceiverReferenceTime(bool enable) {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
xr_send_receiver_reference_time_enabled_ = enable;
|
xr_send_receiver_reference_time_enabled_ = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTCPSender::RtcpXrReceiverReferenceTime() const {
|
bool RTCPSender::RtcpXrReceiverReferenceTime() const {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
return xr_send_receiver_reference_time_enabled_;
|
return xr_send_receiver_reference_time_enabled_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTCPSender::SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) {
|
void RTCPSender::SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
tmmbn_to_send_ = std::move(bounding_set);
|
tmmbn_to_send_ = std::move(bounding_set);
|
||||||
SetFlag(kRtcpTmmbn, true);
|
SetFlag(kRtcpTmmbn, true);
|
||||||
}
|
}
|
||||||
@ -952,7 +952,7 @@ bool RTCPSender::AllVolatileFlagsConsumed() const {
|
|||||||
|
|
||||||
void RTCPSender::SetVideoBitrateAllocation(
|
void RTCPSender::SetVideoBitrateAllocation(
|
||||||
const VideoBitrateAllocation& bitrate) {
|
const VideoBitrateAllocation& bitrate) {
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
// Check if this allocation is first ever, or has a different set of
|
// Check if this allocation is first ever, or has a different set of
|
||||||
// spatial/temporal layers signaled and enabled, if so trigger an rtcp report
|
// spatial/temporal layers signaled and enabled, if so trigger an rtcp report
|
||||||
// as soon as possible.
|
// as soon as possible.
|
||||||
@ -1000,7 +1000,7 @@ void RTCPSender::SendCombinedRtcpPacket(
|
|||||||
size_t max_packet_size;
|
size_t max_packet_size;
|
||||||
uint32_t ssrc;
|
uint32_t ssrc;
|
||||||
{
|
{
|
||||||
rtc::CritScope lock(&critical_section_rtcp_sender_);
|
MutexLock lock(&mutex_rtcp_sender_);
|
||||||
if (method_ == RtcpMode::kOff) {
|
if (method_ == RtcpMode::kOff) {
|
||||||
RTC_LOG(LS_WARNING) << "Can't send rtcp if it is disabled.";
|
RTC_LOG(LS_WARNING) << "Can't send rtcp if it is disabled.";
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -32,8 +32,8 @@
|
|||||||
#include "modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
|
#include "modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
|
||||||
#include "modules/rtp_rtcp/source/rtp_rtcp_interface.h"
|
#include "modules/rtp_rtcp/source/rtp_rtcp_interface.h"
|
||||||
#include "rtc_base/constructor_magic.h"
|
#include "rtc_base/constructor_magic.h"
|
||||||
#include "rtc_base/critical_section.h"
|
|
||||||
#include "rtc_base/random.h"
|
#include "rtc_base/random.h"
|
||||||
|
#include "rtc_base/synchronization/mutex.h"
|
||||||
#include "rtc_base/thread_annotations.h"
|
#include "rtc_base/thread_annotations.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -67,100 +67,94 @@ class RTCPSender final {
|
|||||||
explicit RTCPSender(const RtpRtcpInterface::Configuration& config);
|
explicit RTCPSender(const RtpRtcpInterface::Configuration& config);
|
||||||
virtual ~RTCPSender();
|
virtual ~RTCPSender();
|
||||||
|
|
||||||
RtcpMode Status() const RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RtcpMode Status() const RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
void SetRTCPStatus(RtcpMode method)
|
void SetRTCPStatus(RtcpMode method) RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
|
||||||
|
|
||||||
bool Sending() const RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
bool Sending() const RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
int32_t SetSendingStatus(const FeedbackState& feedback_state,
|
int32_t SetSendingStatus(const FeedbackState& feedback_state,
|
||||||
bool enabled)
|
bool enabled)
|
||||||
RTC_LOCKS_EXCLUDED(
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_); // combine the functions
|
||||||
critical_section_rtcp_sender_); // combine the functions
|
|
||||||
|
|
||||||
int32_t SetNackStatus(bool enable)
|
int32_t SetNackStatus(bool enable) RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
|
||||||
|
|
||||||
void SetTimestampOffset(uint32_t timestamp_offset)
|
void SetTimestampOffset(uint32_t timestamp_offset)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
// TODO(bugs.webrtc.org/6458): Remove default parameter value when all the
|
// TODO(bugs.webrtc.org/6458): Remove default parameter value when all the
|
||||||
// depending projects are updated to correctly set payload type.
|
// depending projects are updated to correctly set payload type.
|
||||||
void SetLastRtpTime(uint32_t rtp_timestamp,
|
void SetLastRtpTime(uint32_t rtp_timestamp,
|
||||||
int64_t capture_time_ms,
|
int64_t capture_time_ms,
|
||||||
int8_t payload_type = -1)
|
int8_t payload_type = -1)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
void SetRtpClockRate(int8_t payload_type, int rtp_clock_rate_hz)
|
void SetRtpClockRate(int8_t payload_type, int rtp_clock_rate_hz)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
uint32_t SSRC() const { return ssrc_; }
|
uint32_t SSRC() const { return ssrc_; }
|
||||||
|
|
||||||
void SetRemoteSSRC(uint32_t ssrc)
|
void SetRemoteSSRC(uint32_t ssrc) RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
|
||||||
|
|
||||||
int32_t SetCNAME(const char* cName)
|
int32_t SetCNAME(const char* cName) RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
|
||||||
|
|
||||||
int32_t AddMixedCNAME(uint32_t SSRC, const char* c_name)
|
int32_t AddMixedCNAME(uint32_t SSRC, const char* c_name)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
int32_t RemoveMixedCNAME(uint32_t SSRC)
|
int32_t RemoveMixedCNAME(uint32_t SSRC)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
bool TimeToSendRTCPReport(bool sendKeyframeBeforeRTP = false) const
|
bool TimeToSendRTCPReport(bool sendKeyframeBeforeRTP = false) const
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
int32_t SendRTCP(const FeedbackState& feedback_state,
|
int32_t SendRTCP(const FeedbackState& feedback_state,
|
||||||
RTCPPacketType packetType,
|
RTCPPacketType packetType,
|
||||||
int32_t nackSize = 0,
|
int32_t nackSize = 0,
|
||||||
const uint16_t* nackList = 0)
|
const uint16_t* nackList = 0)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
int32_t SendCompoundRTCP(const FeedbackState& feedback_state,
|
int32_t SendCompoundRTCP(const FeedbackState& feedback_state,
|
||||||
const std::set<RTCPPacketType>& packetTypes,
|
const std::set<RTCPPacketType>& packetTypes,
|
||||||
int32_t nackSize = 0,
|
int32_t nackSize = 0,
|
||||||
const uint16_t* nackList = nullptr)
|
const uint16_t* nackList = nullptr)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
int32_t SendLossNotification(const FeedbackState& feedback_state,
|
int32_t SendLossNotification(const FeedbackState& feedback_state,
|
||||||
uint16_t last_decoded_seq_num,
|
uint16_t last_decoded_seq_num,
|
||||||
uint16_t last_received_seq_num,
|
uint16_t last_received_seq_num,
|
||||||
bool decodability_flag,
|
bool decodability_flag,
|
||||||
bool buffering_allowed)
|
bool buffering_allowed)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
void SetRemb(int64_t bitrate_bps, std::vector<uint32_t> ssrcs)
|
void SetRemb(int64_t bitrate_bps, std::vector<uint32_t> ssrcs)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
void UnsetRemb() RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
void UnsetRemb() RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
bool TMMBR() const RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
bool TMMBR() const RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
void SetTMMBRStatus(bool enable)
|
void SetTMMBRStatus(bool enable) RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
|
||||||
|
|
||||||
void SetMaxRtpPacketSize(size_t max_packet_size)
|
void SetMaxRtpPacketSize(size_t max_packet_size)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
void SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set)
|
void SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
void SendRtcpXrReceiverReferenceTime(bool enable)
|
void SendRtcpXrReceiverReferenceTime(bool enable)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
bool RtcpXrReceiverReferenceTime() const
|
bool RtcpXrReceiverReferenceTime() const
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
void SetCsrcs(const std::vector<uint32_t>& csrcs)
|
void SetCsrcs(const std::vector<uint32_t>& csrcs)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
void SetTargetBitrate(unsigned int target_bitrate)
|
void SetTargetBitrate(unsigned int target_bitrate)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
void SetVideoBitrateAllocation(const VideoBitrateAllocation& bitrate)
|
void SetVideoBitrateAllocation(const VideoBitrateAllocation& bitrate)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
void SendCombinedRtcpPacket(
|
void SendCombinedRtcpPacket(
|
||||||
std::vector<std::unique_ptr<rtcp::RtcpPacket>> rtcp_packets)
|
std::vector<std::unique_ptr<rtcp::RtcpPacket>> rtcp_packets)
|
||||||
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
|
RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class RtcpContext;
|
class RtcpContext;
|
||||||
@ -169,7 +163,7 @@ class RTCPSender final {
|
|||||||
const std::set<RTCPPacketType>& packet_types,
|
const std::set<RTCPPacketType>& packet_types,
|
||||||
int32_t nack_size,
|
int32_t nack_size,
|
||||||
const uint16_t* nack_list)
|
const uint16_t* nack_list)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
absl::optional<int32_t> ComputeCompoundRTCPPacket(
|
absl::optional<int32_t> ComputeCompoundRTCPPacket(
|
||||||
const FeedbackState& feedback_state,
|
const FeedbackState& feedback_state,
|
||||||
@ -177,80 +171,79 @@ class RTCPSender final {
|
|||||||
int32_t nack_size,
|
int32_t nack_size,
|
||||||
const uint16_t* nack_list,
|
const uint16_t* nack_list,
|
||||||
rtcp::CompoundPacket* out_packet)
|
rtcp::CompoundPacket* out_packet)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
// Determine which RTCP messages should be sent and setup flags.
|
// Determine which RTCP messages should be sent and setup flags.
|
||||||
void PrepareReport(const FeedbackState& feedback_state)
|
void PrepareReport(const FeedbackState& feedback_state)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
std::vector<rtcp::ReportBlock> CreateReportBlocks(
|
std::vector<rtcp::ReportBlock> CreateReportBlocks(
|
||||||
const FeedbackState& feedback_state)
|
const FeedbackState& feedback_state)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
std::unique_ptr<rtcp::RtcpPacket> BuildSR(const RtcpContext& context)
|
std::unique_ptr<rtcp::RtcpPacket> BuildSR(const RtcpContext& context)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
std::unique_ptr<rtcp::RtcpPacket> BuildRR(const RtcpContext& context)
|
std::unique_ptr<rtcp::RtcpPacket> BuildRR(const RtcpContext& context)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
std::unique_ptr<rtcp::RtcpPacket> BuildSDES(const RtcpContext& context)
|
std::unique_ptr<rtcp::RtcpPacket> BuildSDES(const RtcpContext& context)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
std::unique_ptr<rtcp::RtcpPacket> BuildPLI(const RtcpContext& context)
|
std::unique_ptr<rtcp::RtcpPacket> BuildPLI(const RtcpContext& context)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
std::unique_ptr<rtcp::RtcpPacket> BuildREMB(const RtcpContext& context)
|
std::unique_ptr<rtcp::RtcpPacket> BuildREMB(const RtcpContext& context)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
std::unique_ptr<rtcp::RtcpPacket> BuildTMMBR(const RtcpContext& context)
|
std::unique_ptr<rtcp::RtcpPacket> BuildTMMBR(const RtcpContext& context)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
std::unique_ptr<rtcp::RtcpPacket> BuildTMMBN(const RtcpContext& context)
|
std::unique_ptr<rtcp::RtcpPacket> BuildTMMBN(const RtcpContext& context)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
std::unique_ptr<rtcp::RtcpPacket> BuildAPP(const RtcpContext& context)
|
std::unique_ptr<rtcp::RtcpPacket> BuildAPP(const RtcpContext& context)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
std::unique_ptr<rtcp::RtcpPacket> BuildLossNotification(
|
std::unique_ptr<rtcp::RtcpPacket> BuildLossNotification(
|
||||||
const RtcpContext& context)
|
const RtcpContext& context)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
std::unique_ptr<rtcp::RtcpPacket> BuildExtendedReports(
|
std::unique_ptr<rtcp::RtcpPacket> BuildExtendedReports(
|
||||||
const RtcpContext& context)
|
const RtcpContext& context)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
std::unique_ptr<rtcp::RtcpPacket> BuildBYE(const RtcpContext& context)
|
std::unique_ptr<rtcp::RtcpPacket> BuildBYE(const RtcpContext& context)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
std::unique_ptr<rtcp::RtcpPacket> BuildFIR(const RtcpContext& context)
|
std::unique_ptr<rtcp::RtcpPacket> BuildFIR(const RtcpContext& context)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
std::unique_ptr<rtcp::RtcpPacket> BuildNACK(const RtcpContext& context)
|
std::unique_ptr<rtcp::RtcpPacket> BuildNACK(const RtcpContext& context)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const bool audio_;
|
const bool audio_;
|
||||||
const uint32_t ssrc_;
|
const uint32_t ssrc_;
|
||||||
Clock* const clock_;
|
Clock* const clock_;
|
||||||
Random random_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
Random random_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
RtcpMode method_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
RtcpMode method_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
|
|
||||||
RtcEventLog* const event_log_;
|
RtcEventLog* const event_log_;
|
||||||
Transport* const transport_;
|
Transport* const transport_;
|
||||||
|
|
||||||
const int report_interval_ms_;
|
const int report_interval_ms_;
|
||||||
|
|
||||||
rtc::CriticalSection critical_section_rtcp_sender_;
|
mutable Mutex mutex_rtcp_sender_;
|
||||||
bool sending_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
bool sending_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
|
|
||||||
int64_t next_time_to_send_rtcp_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
int64_t next_time_to_send_rtcp_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
|
|
||||||
uint32_t timestamp_offset_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
uint32_t timestamp_offset_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
uint32_t last_rtp_timestamp_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
uint32_t last_rtp_timestamp_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
int64_t last_frame_capture_time_ms_
|
int64_t last_frame_capture_time_ms_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
|
||||||
// SSRC that we receive on our RTP channel
|
// SSRC that we receive on our RTP channel
|
||||||
uint32_t remote_ssrc_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
uint32_t remote_ssrc_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
std::string cname_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
std::string cname_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
|
|
||||||
ReceiveStatisticsProvider* receive_statistics_
|
ReceiveStatisticsProvider* receive_statistics_
|
||||||
RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
std::map<uint32_t, std::string> csrc_cnames_
|
std::map<uint32_t, std::string> csrc_cnames_
|
||||||
RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
|
|
||||||
// send CSRCs
|
// send CSRCs
|
||||||
std::vector<uint32_t> csrcs_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
std::vector<uint32_t> csrcs_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
|
|
||||||
// Full intra request
|
// Full intra request
|
||||||
uint8_t sequence_number_fir_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
uint8_t sequence_number_fir_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
|
|
||||||
// Loss Notification
|
// Loss Notification
|
||||||
struct LossNotificationState {
|
struct LossNotificationState {
|
||||||
@ -259,52 +252,47 @@ class RTCPSender final {
|
|||||||
bool decodability_flag;
|
bool decodability_flag;
|
||||||
};
|
};
|
||||||
LossNotificationState loss_notification_state_
|
LossNotificationState loss_notification_state_
|
||||||
RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
|
|
||||||
// REMB
|
// REMB
|
||||||
int64_t remb_bitrate_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
int64_t remb_bitrate_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
std::vector<uint32_t> remb_ssrcs_
|
std::vector<uint32_t> remb_ssrcs_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
|
||||||
|
|
||||||
std::vector<rtcp::TmmbItem> tmmbn_to_send_
|
std::vector<rtcp::TmmbItem> tmmbn_to_send_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
uint32_t tmmbr_send_bps_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
uint32_t tmmbr_send_bps_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
uint32_t packet_oh_send_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
uint32_t packet_oh_send_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
size_t max_packet_size_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
size_t max_packet_size_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
|
||||||
|
|
||||||
// True if sending of XR Receiver reference time report is enabled.
|
// True if sending of XR Receiver reference time report is enabled.
|
||||||
bool xr_send_receiver_reference_time_enabled_
|
bool xr_send_receiver_reference_time_enabled_
|
||||||
RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
|
|
||||||
RtcpPacketTypeCounterObserver* const packet_type_counter_observer_;
|
RtcpPacketTypeCounterObserver* const packet_type_counter_observer_;
|
||||||
RtcpPacketTypeCounter packet_type_counter_
|
RtcpPacketTypeCounter packet_type_counter_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
|
||||||
|
|
||||||
RtcpNackStats nack_stats_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
RtcpNackStats nack_stats_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
|
|
||||||
VideoBitrateAllocation video_bitrate_allocation_
|
VideoBitrateAllocation video_bitrate_allocation_
|
||||||
RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
bool send_video_bitrate_allocation_
|
bool send_video_bitrate_allocation_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
|
||||||
|
|
||||||
std::map<int8_t, int> rtp_clock_rates_khz_
|
std::map<int8_t, int> rtp_clock_rates_khz_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
int8_t last_payload_type_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
int8_t last_payload_type_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
|
||||||
|
|
||||||
absl::optional<VideoBitrateAllocation> CheckAndUpdateLayerStructure(
|
absl::optional<VideoBitrateAllocation> CheckAndUpdateLayerStructure(
|
||||||
const VideoBitrateAllocation& bitrate) const
|
const VideoBitrateAllocation& bitrate) const
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
|
|
||||||
void SetFlag(uint32_t type, bool is_volatile)
|
void SetFlag(uint32_t type, bool is_volatile)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
void SetFlags(const std::set<RTCPPacketType>& types, bool is_volatile)
|
void SetFlags(const std::set<RTCPPacketType>& types, bool is_volatile)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
bool IsFlagPresent(uint32_t type) const
|
bool IsFlagPresent(uint32_t type) const
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
bool ConsumeFlag(uint32_t type, bool forced = false)
|
bool ConsumeFlag(uint32_t type, bool forced = false)
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
bool AllVolatileFlagsConsumed() const
|
bool AllVolatileFlagsConsumed() const
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||||
struct ReportFlag {
|
struct ReportFlag {
|
||||||
ReportFlag(uint32_t type, bool is_volatile)
|
ReportFlag(uint32_t type, bool is_volatile)
|
||||||
: type(type), is_volatile(is_volatile) {}
|
: type(type), is_volatile(is_volatile) {}
|
||||||
@ -314,8 +302,7 @@ class RTCPSender final {
|
|||||||
const bool is_volatile;
|
const bool is_volatile;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::set<ReportFlag> report_flags_
|
std::set<ReportFlag> report_flags_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||||
RTC_GUARDED_BY(critical_section_rtcp_sender_);
|
|
||||||
|
|
||||||
typedef std::unique_ptr<rtcp::RtcpPacket> (RTCPSender::*BuilderFunc)(
|
typedef std::unique_ptr<rtcp::RtcpPacket> (RTCPSender::*BuilderFunc)(
|
||||||
const RtcpContext&);
|
const RtcpContext&);
|
||||||
|
|||||||
@ -804,7 +804,7 @@ bool ModuleRtpRtcpImpl::LastReceivedNTP(
|
|||||||
|
|
||||||
void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) {
|
void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) {
|
||||||
{
|
{
|
||||||
rtc::CritScope cs(&critical_section_rtt_);
|
MutexLock lock(&mutex_rtt_);
|
||||||
rtt_ms_ = rtt_ms;
|
rtt_ms_ = rtt_ms;
|
||||||
}
|
}
|
||||||
if (rtp_sender_) {
|
if (rtp_sender_) {
|
||||||
@ -813,7 +813,7 @@ void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t ModuleRtpRtcpImpl::rtt_ms() const {
|
int64_t ModuleRtpRtcpImpl::rtt_ms() const {
|
||||||
rtc::CritScope cs(&critical_section_rtt_);
|
MutexLock lock(&mutex_rtt_);
|
||||||
return rtt_ms_;
|
return rtt_ms_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -33,8 +33,8 @@
|
|||||||
#include "modules/rtp_rtcp/source/rtp_packet_history.h"
|
#include "modules/rtp_rtcp/source/rtp_packet_history.h"
|
||||||
#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
|
#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
|
||||||
#include "modules/rtp_rtcp/source/rtp_sender.h"
|
#include "modules/rtp_rtcp/source/rtp_sender.h"
|
||||||
#include "rtc_base/critical_section.h"
|
|
||||||
#include "rtc_base/gtest_prod_util.h"
|
#include "rtc_base/gtest_prod_util.h"
|
||||||
|
#include "rtc_base/synchronization/mutex.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp {
|
|||||||
RtcpRttStats* const rtt_stats_;
|
RtcpRttStats* const rtt_stats_;
|
||||||
|
|
||||||
// The processed RTT from RtcpRttStats.
|
// The processed RTT from RtcpRttStats.
|
||||||
rtc::CriticalSection critical_section_rtt_;
|
mutable Mutex mutex_rtt_;
|
||||||
int64_t rtt_ms_;
|
int64_t rtt_ms_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -712,7 +712,7 @@ bool ModuleRtpRtcpImpl2::LastReceivedNTP(
|
|||||||
void ModuleRtpRtcpImpl2::set_rtt_ms(int64_t rtt_ms) {
|
void ModuleRtpRtcpImpl2::set_rtt_ms(int64_t rtt_ms) {
|
||||||
RTC_DCHECK_RUN_ON(worker_queue_);
|
RTC_DCHECK_RUN_ON(worker_queue_);
|
||||||
{
|
{
|
||||||
rtc::CritScope cs(&critical_section_rtt_);
|
MutexLock lock(&mutex_rtt_);
|
||||||
rtt_ms_ = rtt_ms;
|
rtt_ms_ = rtt_ms;
|
||||||
}
|
}
|
||||||
if (rtp_sender_) {
|
if (rtp_sender_) {
|
||||||
@ -721,7 +721,7 @@ void ModuleRtpRtcpImpl2::set_rtt_ms(int64_t rtt_ms) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t ModuleRtpRtcpImpl2::rtt_ms() const {
|
int64_t ModuleRtpRtcpImpl2::rtt_ms() const {
|
||||||
rtc::CritScope cs(&critical_section_rtt_);
|
MutexLock lock(&mutex_rtt_);
|
||||||
return rtt_ms_;
|
return rtt_ms_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,8 +34,8 @@
|
|||||||
#include "modules/rtp_rtcp/source/rtp_rtcp_impl2.h"
|
#include "modules/rtp_rtcp/source/rtp_rtcp_impl2.h"
|
||||||
#include "modules/rtp_rtcp/source/rtp_sender.h"
|
#include "modules/rtp_rtcp/source/rtp_sender.h"
|
||||||
#include "modules/rtp_rtcp/source/rtp_sender_egress.h"
|
#include "modules/rtp_rtcp/source/rtp_sender_egress.h"
|
||||||
#include "rtc_base/critical_section.h"
|
|
||||||
#include "rtc_base/gtest_prod_util.h"
|
#include "rtc_base/gtest_prod_util.h"
|
||||||
|
#include "rtc_base/synchronization/mutex.h"
|
||||||
#include "rtc_base/synchronization/sequence_checker.h"
|
#include "rtc_base/synchronization/sequence_checker.h"
|
||||||
#include "rtc_base/task_utils/pending_task_safety_flag.h"
|
#include "rtc_base/task_utils/pending_task_safety_flag.h"
|
||||||
#include "rtc_base/task_utils/repeating_task.h"
|
#include "rtc_base/task_utils/repeating_task.h"
|
||||||
@ -320,7 +320,7 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
|
|||||||
RepeatingTaskHandle rtt_update_task_ RTC_GUARDED_BY(worker_queue_);
|
RepeatingTaskHandle rtt_update_task_ RTC_GUARDED_BY(worker_queue_);
|
||||||
|
|
||||||
// The processed RTT from RtcpRttStats.
|
// The processed RTT from RtcpRttStats.
|
||||||
rtc::CriticalSection critical_section_rtt_;
|
mutable Mutex mutex_rtt_;
|
||||||
int64_t rtt_ms_;
|
int64_t rtt_ms_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user