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

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

Issue 1623543002: Refactor RtpSender and SSRCDatabase a bit. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add locking back for voe_auto_test Created 4 years, 11 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.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc
index bd9314d5d768b6e2d30c5be2a4ef2287b9c35ef5..fb4064c97adb7312d58909c0b6d10bcbe6b25c5f 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc
@@ -125,7 +125,8 @@ RTPSender::RTPSender(
BitrateStatisticsObserver* bitrate_callback,
FrameCountObserver* frame_count_observer,
SendSideDelayObserver* send_side_delay_observer,
- RtcEventLog* event_log)
+ RtcEventLog* event_log,
+ SSRCDatabase* ssrc_database)
: clock_(clock),
// TODO(holmer): Remove this conversion when we remove the use of
// TickTime.
@@ -141,7 +142,6 @@ RTPSender::RTPSender(
transport_sequence_number_allocator_(sequence_number_allocator),
transport_feedback_observer_(transport_feedback_observer),
last_capture_time_ms_sent_(0),
- send_critsect_(CriticalSectionWrapper::CreateCriticalSection()),
transport_(transport),
sending_media_(true), // Default to sending media.
max_payload_length_(IP_PACKET_SIZE - 28), // Default is IP-v4/UDP.
@@ -168,7 +168,7 @@ RTPSender::RTPSender(
// RTP variables
start_timestamp_forced_(false),
start_timestamp_(0),
- ssrc_db_(*SSRCDatabase::GetSSRCDatabase()),
+ ssrc_db_(ssrc_database),
remote_ssrc_(0),
sequence_number_forced_(false),
ssrc_forced_(false),
@@ -185,9 +185,13 @@ RTPSender::RTPSender(
memset(nack_byte_count_times_, 0, sizeof(nack_byte_count_times_));
memset(nack_byte_count_, 0, sizeof(nack_byte_count_));
// We need to seed the random generator.
+ // TODO(holmer,tommi): Why?^^^ (SSRCDatabase does its own seeding).
+ // TODO(holmer,tommi): Note also that TimeInMilliseconds might return 0 on Mac
+ // early on in the process.
stefan-webrtc 2016/01/23 17:38:39 I think it's because timestamps and sequence numbe
tommi 2016/01/24 11:51:49 I might be misunderstanding, so please bear with m
stefan-webrtc 2016/01/25 10:09:32 I didn't actually read the code, but apparently se
srand(static_cast<uint32_t>(clock_->TimeInMilliseconds()));
- ssrc_ = ssrc_db_.CreateSSRC(); // Can't be 0.
- ssrc_rtx_ = ssrc_db_.CreateSSRC(); // Can't be 0.
+ ssrc_ = ssrc_db_->CreateSSRC(); // Can't be 0.
+ ssrc_rtx_ = ssrc_db_->CreateSSRC(); // Can't be 0.
+ // TODO(holmer, tommi): Should we DCHECK ^^^ on the 'Can't be 0' part?
stefan-webrtc 2016/01/23 17:38:39 Feel free to add. According to SsrcDatabase that s
tommi 2016/01/24 11:51:49 Done.
bitrates_->set_ssrc(ssrc_);
// Random start, 16 bits. Can't be 0.
sequence_number_rtx_ = random_.Rand(1, kMaxInitRtpSeqNumber);
@@ -195,12 +199,15 @@ RTPSender::RTPSender(
}
RTPSender::~RTPSender() {
+ // TODO(tommi,holmer: We don't grab locks in the dtor before accessing member
stefan-webrtc 2016/01/23 17:38:39 TODO(tommi,holmer) I think the only known model
tommi 2016/01/24 11:51:49 Done
+ // variables but we grab them in all other methods. (what's the design?)
+ // Start documenting what thread we're on in what method so that it's easier
+ // to understand performance attributes and possibly remove locks.
if (remote_ssrc_ != 0) {
- ssrc_db_.ReturnSSRC(remote_ssrc_);
+ ssrc_db_->ReturnSSRC(remote_ssrc_);
}
- ssrc_db_.ReturnSSRC(ssrc_);
+ ssrc_db_->ReturnSSRC(ssrc_);
- SSRCDatabase::ReturnSSRCDatabase();
while (!payload_type_map_.empty()) {
std::map<int8_t, RtpUtility::Payload*>::iterator it =
payload_type_map_.begin();
@@ -246,7 +253,7 @@ int32_t RTPSender::SetTransmissionTimeOffset(int32_t transmission_time_offset) {
transmission_time_offset < -(0x800000 - 1)) { // Word24.
return -1;
}
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
transmission_time_offset_ = transmission_time_offset;
return 0;
}
@@ -255,25 +262,25 @@ int32_t RTPSender::SetAbsoluteSendTime(uint32_t absolute_send_time) {
if (absolute_send_time > 0xffffff) { // UWord24.
return -1;
}
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
absolute_send_time_ = absolute_send_time;
return 0;
}
void RTPSender::SetVideoRotation(VideoRotation rotation) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
rotation_ = rotation;
}
int32_t RTPSender::SetTransportSequenceNumber(uint16_t sequence_number) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
transport_sequence_number_ = sequence_number;
return 0;
}
int32_t RTPSender::RegisterRtpHeaderExtension(RTPExtensionType type,
uint8_t id) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
if (type == kRtpExtensionVideoRotation) {
cvo_mode_ = kCVOInactive;
return rtp_header_extension_map_.RegisterInactive(type, id);
@@ -282,17 +289,17 @@ int32_t RTPSender::RegisterRtpHeaderExtension(RTPExtensionType type,
}
bool RTPSender::IsRtpHeaderExtensionRegistered(RTPExtensionType type) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
return rtp_header_extension_map_.IsRegistered(type);
}
int32_t RTPSender::DeregisterRtpHeaderExtension(RTPExtensionType type) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
return rtp_header_extension_map_.Deregister(type);
}
size_t RTPSender::RtpHeaderExtensionTotalLength() const {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
return rtp_header_extension_map_.GetTotalLengthInBytes();
}
@@ -303,7 +310,7 @@ int32_t RTPSender::RegisterPayload(
size_t channels,
uint32_t rate) {
assert(payload_name);
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
std::map<int8_t, RtpUtility::Payload*>::iterator it =
payload_type_map_.find(payload_number);
@@ -346,7 +353,7 @@ int32_t RTPSender::RegisterPayload(
}
int32_t RTPSender::DeRegisterSendPayload(int8_t payload_type) {
- CriticalSectionScoped lock(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
std::map<int8_t, RtpUtility::Payload*>::iterator it =
payload_type_map_.find(payload_type);
@@ -361,12 +368,12 @@ int32_t RTPSender::DeRegisterSendPayload(int8_t payload_type) {
}
void RTPSender::SetSendPayloadType(int8_t payload_type) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
payload_type_ = payload_type;
}
int8_t RTPSender::SendPayloadType() const {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
return payload_type_;
}
@@ -379,7 +386,7 @@ int32_t RTPSender::SetMaxPayloadLength(size_t max_payload_length,
// Sanity check.
RTC_DCHECK(max_payload_length >= 100 && max_payload_length <= IP_PACKET_SIZE)
<< "Invalid max payload length: " << max_payload_length;
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
max_payload_length_ = max_payload_length;
packet_over_head_ = packet_over_head;
return 0;
@@ -388,7 +395,7 @@ int32_t RTPSender::SetMaxPayloadLength(size_t max_payload_length,
size_t RTPSender::MaxDataPayloadLength() const {
int rtx;
{
- CriticalSectionScoped rtx_lock(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
rtx = rtx_;
}
if (audio_configured_) {
@@ -407,28 +414,28 @@ size_t RTPSender::MaxPayloadLength() const {
uint16_t RTPSender::PacketOverHead() const { return packet_over_head_; }
void RTPSender::SetRtxStatus(int mode) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
rtx_ = mode;
}
int RTPSender::RtxStatus() const {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
return rtx_;
}
void RTPSender::SetRtxSsrc(uint32_t ssrc) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
ssrc_rtx_ = ssrc;
}
uint32_t RTPSender::RtxSsrc() const {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
return ssrc_rtx_;
}
void RTPSender::SetRtxPayloadType(int payload_type,
int associated_payload_type) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
RTC_DCHECK_LE(payload_type, 127);
RTC_DCHECK_LE(associated_payload_type, 127);
if (payload_type < 0) {
@@ -441,7 +448,7 @@ void RTPSender::SetRtxPayloadType(int payload_type,
}
std::pair<int, int> RTPSender::RtxPayloadType() const {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
for (const auto& kv : rtx_payload_type_map_) {
if (kv.second == rtx_payload_type_) {
return std::make_pair(rtx_payload_type_, kv.first);
@@ -452,7 +459,7 @@ std::pair<int, int> RTPSender::RtxPayloadType() const {
int32_t RTPSender::CheckPayloadType(int8_t payload_type,
RtpVideoCodecTypes* video_type) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
if (payload_type < 0) {
LOG(LS_ERROR) << "Invalid payload_type " << payload_type;
@@ -494,7 +501,7 @@ int32_t RTPSender::CheckPayloadType(int8_t payload_type,
RTPSenderInterface::CVOMode RTPSender::ActivateCVORtpHeaderExtension() {
if (cvo_mode_ == kCVOInactive) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
if (rtp_header_extension_map_.SetActive(kRtpExtensionVideoRotation, true)) {
cvo_mode_ = kCVOActivated;
}
@@ -513,7 +520,7 @@ int32_t RTPSender::SendOutgoingData(FrameType frame_type,
uint32_t ssrc;
{
// Drop this packet if we're not sending media packets.
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
ssrc = ssrc_;
if (!sending_media_) {
return 0;
@@ -565,7 +572,7 @@ int32_t RTPSender::SendOutgoingData(FrameType frame_type,
size_t RTPSender::TrySendRedundantPayloads(size_t bytes_to_send) {
{
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
if ((rtx_ & kRtxRedundantPayloads) == 0)
return 0;
}
@@ -627,7 +634,7 @@ size_t RTPSender::SendPadData(size_t bytes,
int payload_type;
bool over_rtx;
{
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
if (!timestamp_provided) {
timestamp = timestamp_;
capture_time_ms = capture_time_ms_;
@@ -741,7 +748,7 @@ int32_t RTPSender::ReSendPacket(uint16_t packet_id, int64_t min_resend_time) {
}
int rtx = kRtxOff;
{
- CriticalSectionScoped lock(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
rtx = rtx_;
}
if (!PrepareAndSendPacket(data_buffer, length, capture_time_ms,
@@ -839,7 +846,7 @@ bool RTPSender::ProcessNACKBitRate(uint32_t now) {
const uint32_t kAvgIntervalMs = 1000;
uint32_t target_bitrate = GetTargetBitrate();
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
if (target_bitrate == 0) {
return true;
@@ -864,7 +871,7 @@ bool RTPSender::ProcessNACKBitRate(uint32_t now) {
}
void RTPSender::UpdateNACKBitRate(uint32_t bytes, int64_t now) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
if (bytes == 0)
return;
nack_bitrate_.Update(bytes);
@@ -900,7 +907,7 @@ bool RTPSender::TimeToSendPacket(uint16_t sequence_number,
}
int rtx;
{
- CriticalSectionScoped lock(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
rtx = rtx_;
}
return PrepareAndSendPacket(data_buffer,
@@ -958,7 +965,7 @@ bool RTPSender::PrepareAndSendPacket(uint8_t* buffer,
bool ret = SendPacketToNetwork(buffer_to_send_ptr, length, options);
if (ret) {
- CriticalSectionScoped lock(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
media_has_been_sent_ = true;
}
UpdateRtpStats(buffer_to_send_ptr, length, rtp_header, send_over_rtx,
@@ -1018,7 +1025,7 @@ size_t RTPSender::TimeToSendPadding(size_t bytes) {
if (audio_configured_ || bytes == 0)
return 0;
{
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
if (!sending_media_)
return 0;
}
@@ -1090,7 +1097,7 @@ int32_t RTPSender::SendToNetwork(uint8_t* buffer,
return -1;
{
- CriticalSectionScoped lock(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
media_has_been_sent_ = true;
}
UpdateRtpStats(buffer, length, rtp_header, false, false);
@@ -1105,7 +1112,7 @@ void RTPSender::UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms) {
int avg_delay_ms = 0;
int max_delay_ms = 0;
{
- CriticalSectionScoped lock(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
ssrc = ssrc_;
}
{
@@ -1131,7 +1138,7 @@ void RTPSender::UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms) {
}
void RTPSender::ProcessBitrate() {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
total_bitrate_sent_.Process();
nack_bitrate_.Process();
if (audio_configured_) {
@@ -1141,7 +1148,7 @@ void RTPSender::ProcessBitrate() {
}
size_t RTPSender::RTPHeaderLength() const {
- CriticalSectionScoped lock(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
size_t rtp_header_length = kRtpHeaderLength;
rtp_header_length += sizeof(uint32_t) * csrcs_.size();
rtp_header_length += RtpHeaderExtensionTotalLength();
@@ -1149,7 +1156,7 @@ size_t RTPSender::RTPHeaderLength() const {
}
uint16_t RTPSender::AllocateSequenceNumber(uint16_t packets_to_send) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
uint16_t first_allocated_sequence_number = sequence_number_;
sequence_number_ += packets_to_send;
return first_allocated_sequence_number;
@@ -1208,7 +1215,7 @@ int32_t RTPSender::BuildRTPheader(uint8_t* data_buffer,
bool timestamp_provided,
bool inc_sequence_number) {
assert(payload_type >= 0);
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
if (timestamp_provided) {
timestamp_ = start_timestamp_ + capture_timestamp;
@@ -1515,7 +1522,7 @@ void RTPSender::UpdateTransmissionTimeOffset(uint8_t* rtp_packet,
const RTPHeader& rtp_header,
int64_t time_diff_ms) const {
size_t offset;
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
switch (VerifyExtension(kRtpExtensionTransmissionTimeOffset, rtp_packet,
rtp_packet_length, rtp_header,
kTransmissionTimeOffsetLength, &offset)) {
@@ -1541,7 +1548,7 @@ bool RTPSender::UpdateAudioLevel(uint8_t* rtp_packet,
bool is_voiced,
uint8_t dBov) const {
size_t offset;
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
switch (VerifyExtension(kRtpExtensionAudioLevel, rtp_packet,
rtp_packet_length, rtp_header, kAudioLevelLength,
@@ -1566,7 +1573,7 @@ bool RTPSender::UpdateVideoRotation(uint8_t* rtp_packet,
const RTPHeader& rtp_header,
VideoRotation rotation) const {
size_t offset;
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
switch (VerifyExtension(kRtpExtensionVideoRotation, rtp_packet,
rtp_packet_length, rtp_header, kVideoRotationLength,
@@ -1591,7 +1598,7 @@ void RTPSender::UpdateAbsoluteSendTime(uint8_t* rtp_packet,
const RTPHeader& rtp_header,
int64_t now_ms) const {
size_t offset;
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
switch (VerifyExtension(kRtpExtensionAbsoluteSendTime, rtp_packet,
rtp_packet_length, rtp_header,
@@ -1618,7 +1625,7 @@ uint16_t RTPSender::UpdateTransportSequenceNumber(
size_t rtp_packet_length,
const RTPHeader& rtp_header) const {
size_t offset;
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
switch (VerifyExtension(kRtpExtensionTransportSequenceNumber, rtp_packet,
rtp_packet_length, rtp_header,
@@ -1647,11 +1654,11 @@ void RTPSender::SetSendingStatus(bool enabled) {
// Will be ignored if it's already configured via API.
SetStartTimestamp(RTPtime, false);
} else {
- CriticalSectionScoped lock(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
if (!ssrc_forced_) {
// Generate a new SSRC.
- ssrc_db_.ReturnSSRC(ssrc_);
- ssrc_ = ssrc_db_.CreateSSRC(); // Can't be 0.
+ ssrc_db_->ReturnSSRC(ssrc_);
+ ssrc_ = ssrc_db_->CreateSSRC(); // Can't be 0.
bitrates_->set_ssrc(ssrc_);
}
// Don't initialize seq number if SSRC passed externally.
@@ -1663,22 +1670,22 @@ void RTPSender::SetSendingStatus(bool enabled) {
}
void RTPSender::SetSendingMediaStatus(bool enabled) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
sending_media_ = enabled;
}
bool RTPSender::SendingMedia() const {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
return sending_media_;
}
uint32_t RTPSender::Timestamp() const {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
return timestamp_;
}
void RTPSender::SetStartTimestamp(uint32_t timestamp, bool force) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
if (force) {
start_timestamp_forced_ = true;
start_timestamp_ = timestamp;
@@ -1690,32 +1697,32 @@ void RTPSender::SetStartTimestamp(uint32_t timestamp, bool force) {
}
uint32_t RTPSender::StartTimestamp() const {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
return start_timestamp_;
}
uint32_t RTPSender::GenerateNewSSRC() {
// If configured via API, return 0.
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
if (ssrc_forced_) {
return 0;
}
- ssrc_ = ssrc_db_.CreateSSRC(); // Can't be 0.
+ ssrc_ = ssrc_db_->CreateSSRC(); // Can't be 0.
bitrates_->set_ssrc(ssrc_);
return ssrc_;
}
void RTPSender::SetSSRC(uint32_t ssrc) {
// This is configured via the API.
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
if (ssrc_ == ssrc && ssrc_forced_) {
return; // Since it's same ssrc, don't reset anything.
}
ssrc_forced_ = true;
- ssrc_db_.ReturnSSRC(ssrc_);
- ssrc_db_.RegisterSSRC(ssrc);
+ ssrc_db_->ReturnSSRC(ssrc_);
+ ssrc_db_->RegisterSSRC(ssrc);
ssrc_ = ssrc;
bitrates_->set_ssrc(ssrc_);
if (!sequence_number_forced_) {
@@ -1724,24 +1731,24 @@ void RTPSender::SetSSRC(uint32_t ssrc) {
}
uint32_t RTPSender::SSRC() const {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
return ssrc_;
}
void RTPSender::SetCsrcs(const std::vector<uint32_t>& csrcs) {
assert(csrcs.size() <= kRtpCsrcSize);
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
csrcs_ = csrcs;
}
void RTPSender::SetSequenceNumber(uint16_t seq) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
sequence_number_forced_ = true;
sequence_number_ = seq;
}
uint16_t RTPSender::SequenceNumber() const {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
return sequence_number_;
}
@@ -1818,7 +1825,7 @@ int32_t RTPSender::SetFecParameters(
void RTPSender::BuildRtxPacket(uint8_t* buffer, size_t* length,
uint8_t* buffer_rtx) {
- CriticalSectionScoped cs(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
uint8_t* data_buffer_rtx = buffer_rtx;
// Add RTX header.
RtpUtility::RtpHeaderParser rtp_parser(
@@ -1873,7 +1880,7 @@ uint32_t RTPSender::BitrateSent() const {
void RTPSender::SetRtpState(const RtpState& rtp_state) {
SetStartTimestamp(rtp_state.start_timestamp, true);
- CriticalSectionScoped lock(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
sequence_number_ = rtp_state.sequence_number;
sequence_number_forced_ = true;
timestamp_ = rtp_state.timestamp;
@@ -1883,7 +1890,7 @@ void RTPSender::SetRtpState(const RtpState& rtp_state) {
}
RtpState RTPSender::GetRtpState() const {
- CriticalSectionScoped lock(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
RtpState state;
state.sequence_number = sequence_number_;
@@ -1897,12 +1904,12 @@ RtpState RTPSender::GetRtpState() const {
}
void RTPSender::SetRtxRtpState(const RtpState& rtp_state) {
- CriticalSectionScoped lock(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
sequence_number_rtx_ = rtp_state.sequence_number;
}
RtpState RTPSender::GetRtxRtpState() const {
- CriticalSectionScoped lock(send_critsect_.get());
+ rtc::CritScope lock(&send_critsect_);
RtpState state;
state.sequence_number = sequence_number_rtx_;

Powered by Google App Engine
This is Rietveld 408576698