Replaced CriticalSectionWrapper with rtc::CriticalSection in rtp_rtcp module

Review URL: https://codereview.webrtc.org/1877253002

Cr-Commit-Position: refs/heads/master@{#12359}
This commit is contained in:
danilchap
2016-04-14 03:05:31 -07:00
committed by Commit bot
parent b17712ff89
commit 7c9426cf38
33 changed files with 212 additions and 261 deletions

View File

@ -61,8 +61,6 @@ RtpReceiverImpl::RtpReceiverImpl(
rtp_payload_registry_(rtp_payload_registry),
rtp_media_receiver_(rtp_media_receiver),
cb_rtp_feedback_(incoming_messages_callback),
critical_section_rtp_receiver_(
CriticalSectionWrapper::CreateCriticalSection()),
last_receive_time_(0),
last_received_payload_length_(0),
ssrc_(0),
@ -89,7 +87,7 @@ int32_t RtpReceiverImpl::RegisterReceivePayload(
const uint32_t frequency,
const size_t channels,
const uint32_t rate) {
CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
rtc::CritScope lock(&critical_section_rtp_receiver_);
// TODO(phoglund): Try to streamline handling of the RED codec and some other
// cases which makes it necessary to keep track of whether we created a
@ -111,29 +109,29 @@ int32_t RtpReceiverImpl::RegisterReceivePayload(
int32_t RtpReceiverImpl::DeRegisterReceivePayload(
const int8_t payload_type) {
CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
rtc::CritScope lock(&critical_section_rtp_receiver_);
return rtp_payload_registry_->DeRegisterReceivePayload(payload_type);
}
NACKMethod RtpReceiverImpl::NACK() const {
CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
rtc::CritScope lock(&critical_section_rtp_receiver_);
return nack_method_;
}
// Turn negative acknowledgment requests on/off.
void RtpReceiverImpl::SetNACKStatus(const NACKMethod method) {
CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
rtc::CritScope lock(&critical_section_rtp_receiver_);
nack_method_ = method;
}
uint32_t RtpReceiverImpl::SSRC() const {
CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
rtc::CritScope lock(&critical_section_rtp_receiver_);
return ssrc_;
}
// Get remote CSRC.
int32_t RtpReceiverImpl::CSRCs(uint32_t array_of_csrcs[kRtpCsrcSize]) const {
CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
rtc::CritScope lock(&critical_section_rtp_receiver_);
assert(num_csrcs_ <= kRtpCsrcSize);
@ -179,7 +177,7 @@ bool RtpReceiverImpl::IncomingRtpPacket(
bool is_first_packet_in_frame = false;
{
CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
rtc::CritScope lock(&critical_section_rtp_receiver_);
if (HaveReceivedFrame()) {
is_first_packet_in_frame =
last_received_sequence_number_ + 1 == rtp_header.sequenceNumber &&
@ -198,7 +196,7 @@ bool RtpReceiverImpl::IncomingRtpPacket(
}
{
CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
rtc::CritScope lock(&critical_section_rtp_receiver_);
last_receive_time_ = clock_->TimeInMilliseconds();
last_received_payload_length_ = payload_data_length;
@ -219,7 +217,7 @@ TelephoneEventHandler* RtpReceiverImpl::GetTelephoneEventHandler() {
}
bool RtpReceiverImpl::Timestamp(uint32_t* timestamp) const {
CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
rtc::CritScope lock(&critical_section_rtp_receiver_);
if (!HaveReceivedFrame())
return false;
*timestamp = last_received_timestamp_;
@ -227,7 +225,7 @@ bool RtpReceiverImpl::Timestamp(uint32_t* timestamp) const {
}
bool RtpReceiverImpl::LastReceivedTimeMs(int64_t* receive_time_ms) const {
CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
rtc::CritScope lock(&critical_section_rtp_receiver_);
if (!HaveReceivedFrame())
return false;
*receive_time_ms = last_received_frame_time_ms_;
@ -247,7 +245,7 @@ void RtpReceiverImpl::CheckSSRCChanged(const RTPHeader& rtp_header) {
uint32_t rate = 0;
{
CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
rtc::CritScope lock(&critical_section_rtp_receiver_);
int8_t last_received_payload_type =
rtp_payload_registry_->last_received_payload_type();
@ -318,7 +316,7 @@ int32_t RtpReceiverImpl::CheckPayloadChanged(const RTPHeader& rtp_header,
int8_t payload_type = rtp_header.payloadType;
{
CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
rtc::CritScope lock(&critical_section_rtp_receiver_);
int8_t last_received_payload_type =
rtp_payload_registry_->last_received_payload_type();
@ -401,7 +399,7 @@ void RtpReceiverImpl::CheckCSRC(const WebRtcRTPHeader& rtp_header) {
uint8_t old_num_csrcs = 0;
{
CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
rtc::CritScope lock(&critical_section_rtp_receiver_);
if (!rtp_media_receiver_->ShouldReportCsrcChanges(
rtp_header.header.payloadType)) {