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

@ -9,10 +9,9 @@
*/
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
namespace webrtc {
@ -30,7 +29,7 @@ class RtpHeaderParserImpl : public RtpHeaderParser {
bool DeregisterRtpHeaderExtension(RTPExtensionType type) override;
private:
rtc::scoped_ptr<CriticalSectionWrapper> critical_section_;
rtc::CriticalSection critical_section_;
RtpHeaderExtensionMap rtp_header_extension_map_ GUARDED_BY(critical_section_);
};
@ -38,8 +37,7 @@ RtpHeaderParser* RtpHeaderParser::Create() {
return new RtpHeaderParserImpl;
}
RtpHeaderParserImpl::RtpHeaderParserImpl()
: critical_section_(CriticalSectionWrapper::CreateCriticalSection()) {}
RtpHeaderParserImpl::RtpHeaderParserImpl() {}
bool RtpHeaderParser::IsRtcp(const uint8_t* packet, size_t length) {
RtpUtility::RtpHeaderParser rtp_parser(packet, length);
@ -54,7 +52,7 @@ bool RtpHeaderParserImpl::Parse(const uint8_t* packet,
RtpHeaderExtensionMap map;
{
CriticalSectionScoped cs(critical_section_.get());
rtc::CritScope cs(&critical_section_);
rtp_header_extension_map_.GetCopy(&map);
}
@ -67,12 +65,12 @@ bool RtpHeaderParserImpl::Parse(const uint8_t* packet,
bool RtpHeaderParserImpl::RegisterRtpHeaderExtension(RTPExtensionType type,
uint8_t id) {
CriticalSectionScoped cs(critical_section_.get());
rtc::CritScope cs(&critical_section_);
return rtp_header_extension_map_.Register(type, id) == 0;
}
bool RtpHeaderParserImpl::DeregisterRtpHeaderExtension(RTPExtensionType type) {
CriticalSectionScoped cs(critical_section_.get());
rtc::CritScope cs(&critical_section_);
return rtp_header_extension_map_.Deregister(type) == 0;
}
} // namespace webrtc