summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorpbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-04-28 13:00:21 +0000
committerpbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-04-28 13:00:21 +0000
commitc476e64d056c5e342bc5b23eecd493abf6d85d7f (patch)
tree39bf23e0e157d5187654a96d401e00c1fbc70d9e /test
parent33d613a15cd3e57618980fab52c768e0100155c5 (diff)
downloadwebrtc-c476e64d056c5e342bc5b23eecd493abf6d85d7f.tar.gz
Add thread annotations to Call API.
Also constified a lot of pointers and reordered members to make protected members more grouped together. R=kjellander@webrtc.org, stefan@webrtc.org BUG=2770 Review URL: https://webrtc-codereview.appspot.com/15399004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@5998 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'test')
-rw-r--r--test/direct_transport.h2
-rw-r--r--test/fake_encoder.h2
-rw-r--r--test/frame_generator_capturer.h2
-rw-r--r--test/rtp_rtcp_observer.h43
4 files changed, 26 insertions, 23 deletions
diff --git a/test/direct_transport.h b/test/direct_transport.h
index 9dc9e1fc..c40a8c38 100644
--- a/test/direct_transport.h
+++ b/test/direct_transport.h
@@ -49,7 +49,7 @@ class DirectTransport : public newapi::Transport {
scoped_ptr<CriticalSectionWrapper> lock_;
scoped_ptr<EventWrapper> packet_event_;
scoped_ptr<ThreadWrapper> thread_;
- Clock* clock_;
+ Clock* const clock_;
bool shutting_down_;
diff --git a/test/fake_encoder.h b/test/fake_encoder.h
index c0709c12..2a444a10 100644
--- a/test/fake_encoder.h
+++ b/test/fake_encoder.h
@@ -42,7 +42,7 @@ class FakeEncoder : public VideoEncoder {
uint32_t framerate) OVERRIDE;
private:
- Clock* clock_;
+ Clock* const clock_;
VideoCodec config_;
EncodedImageCallback* callback_;
int target_bitrate_kbps_;
diff --git a/test/frame_generator_capturer.h b/test/frame_generator_capturer.h
index 84b3c495..ee3f0e01 100644
--- a/test/frame_generator_capturer.h
+++ b/test/frame_generator_capturer.h
@@ -54,7 +54,7 @@ class FrameGeneratorCapturer : public VideoCapturer {
void InsertFrame();
static bool Run(void* obj);
- Clock* clock_;
+ Clock* const clock_;
bool sending_;
scoped_ptr<EventWrapper> tick_;
diff --git a/test/rtp_rtcp_observer.h b/test/rtp_rtcp_observer.h
index 00422cce..e4486534 100644
--- a/test/rtp_rtcp_observer.h
+++ b/test/rtp_rtcp_observer.h
@@ -53,15 +53,15 @@ class RtpRtcpObserver {
protected:
RtpRtcpObserver(unsigned int event_timeout_ms,
const FakeNetworkPipe::Config& configuration)
- : lock_(CriticalSectionWrapper::CreateCriticalSection()),
+ : crit_(CriticalSectionWrapper::CreateCriticalSection()),
observation_complete_(EventWrapper::Create()),
parser_(RtpHeaderParser::Create()),
- send_transport_(lock_.get(),
+ send_transport_(crit_.get(),
this,
&RtpRtcpObserver::OnSendRtp,
&RtpRtcpObserver::OnSendRtcp,
configuration),
- receive_transport_(lock_.get(),
+ receive_transport_(crit_.get(),
this,
&RtpRtcpObserver::OnReceiveRtp,
&RtpRtcpObserver::OnReceiveRtcp,
@@ -69,15 +69,15 @@ class RtpRtcpObserver {
timeout_ms_(event_timeout_ms) {}
explicit RtpRtcpObserver(unsigned int event_timeout_ms)
- : lock_(CriticalSectionWrapper::CreateCriticalSection()),
+ : crit_(CriticalSectionWrapper::CreateCriticalSection()),
observation_complete_(EventWrapper::Create()),
parser_(RtpHeaderParser::Create()),
- send_transport_(lock_.get(),
+ send_transport_(crit_.get(),
this,
&RtpRtcpObserver::OnSendRtp,
&RtpRtcpObserver::OnSendRtcp,
FakeNetworkPipe::Config()),
- receive_transport_(lock_.get(),
+ receive_transport_(crit_.get(),
this,
&RtpRtcpObserver::OnReceiveRtp,
&RtpRtcpObserver::OnReceiveRtcp,
@@ -89,23 +89,26 @@ class RtpRtcpObserver {
DROP_PACKET,
};
- virtual Action OnSendRtp(const uint8_t* packet, size_t length) {
+ virtual Action OnSendRtp(const uint8_t* packet, size_t length)
+ EXCLUSIVE_LOCKS_REQUIRED(crit_) {
return SEND_PACKET;
}
- virtual Action OnSendRtcp(const uint8_t* packet, size_t length) {
+ virtual Action OnSendRtcp(const uint8_t* packet, size_t length)
+ EXCLUSIVE_LOCKS_REQUIRED(crit_) {
return SEND_PACKET;
}
- virtual Action OnReceiveRtp(const uint8_t* packet, size_t length) {
+ virtual Action OnReceiveRtp(const uint8_t* packet, size_t length)
+ EXCLUSIVE_LOCKS_REQUIRED(crit_) {
return SEND_PACKET;
}
- virtual Action OnReceiveRtcp(const uint8_t* packet, size_t length) {
+ virtual Action OnReceiveRtcp(const uint8_t* packet, size_t length)
+ EXCLUSIVE_LOCKS_REQUIRED(crit_) {
return SEND_PACKET;
}
-
private:
class PacketTransport : public test::DirectTransport {
public:
@@ -118,7 +121,7 @@ class RtpRtcpObserver {
PacketTransportAction on_rtcp,
const FakeNetworkPipe::Config& configuration)
: test::DirectTransport(configuration),
- lock_(lock),
+ crit_(lock),
observer_(observer),
on_rtp_(on_rtp),
on_rtcp_(on_rtcp) {}
@@ -128,7 +131,7 @@ class RtpRtcpObserver {
EXPECT_FALSE(RtpHeaderParser::IsRtcp(packet, static_cast<int>(length)));
Action action;
{
- CriticalSectionScoped crit_(lock_);
+ CriticalSectionScoped lock(crit_);
action = (observer_->*on_rtp_)(packet, length);
}
switch (action) {
@@ -145,7 +148,7 @@ class RtpRtcpObserver {
EXPECT_TRUE(RtpHeaderParser::IsRtcp(packet, static_cast<int>(length)));
Action action;
{
- CriticalSectionScoped crit_(lock_);
+ CriticalSectionScoped lock(crit_);
action = (observer_->*on_rtcp_)(packet, length);
}
switch (action) {
@@ -159,16 +162,16 @@ class RtpRtcpObserver {
}
// Pointer to shared lock instance protecting on_rtp_/on_rtcp_ calls.
- CriticalSectionWrapper* lock_;
+ CriticalSectionWrapper* const crit_;
- RtpRtcpObserver* observer_;
- PacketTransportAction on_rtp_, on_rtcp_;
+ RtpRtcpObserver* const observer_;
+ const PacketTransportAction on_rtp_, on_rtcp_;
};
protected:
- scoped_ptr<CriticalSectionWrapper> lock_;
- scoped_ptr<EventWrapper> observation_complete_;
- scoped_ptr<RtpHeaderParser> parser_;
+ const scoped_ptr<CriticalSectionWrapper> crit_;
+ const scoped_ptr<EventWrapper> observation_complete_;
+ const scoped_ptr<RtpHeaderParser> parser_;
private:
PacketTransport send_transport_, receive_transport_;