Mark all virtual overrides in the hierarchy of Transport as virtual + OVERRIDE.

This also marks all virtual overrides of other classes in the same files. 

This will make a subsequent change I intend to do safer, where I'll change the 
argument types of the base Transport functions, by breaking the compile if I 
miss any overrides. 

This also highlighted a number of unused functions. I've removed some of these. 

TBR=mflodman@webrtc.org, pkasting@chromium.org
BUG=none 
TEST=none

Review URL: https://webrtc-codereview.appspot.com/28709004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7421 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
xians@webrtc.org 2014-10-10 09:42:53 +00:00
parent afede835ee
commit 3cefbc99f4
29 changed files with 222 additions and 443 deletions

View File

@ -206,10 +206,12 @@ class WebRtcVideoEngine : public sigslot::has_slots<>,
bool VerifyApt(const VideoCodec& in, int expected_apt) const; bool VerifyApt(const VideoCodec& in, int expected_apt) const;
// webrtc::TraceCallback implementation. // webrtc::TraceCallback implementation.
virtual void Print(webrtc::TraceLevel level, const char* trace, int length); virtual void Print(webrtc::TraceLevel level,
const char* trace,
int length) OVERRIDE;
// WebRtcVideoEncoderFactory::Observer implementation. // WebRtcVideoEncoderFactory::Observer implementation.
virtual void OnCodecsAvailable(); virtual void OnCodecsAvailable() OVERRIDE;
rtc::Thread* worker_thread_; rtc::Thread* worker_thread_;
rtc::scoped_ptr<ViEWrapper> vie_wrapper_; rtc::scoped_ptr<ViEWrapper> vie_wrapper_;
@ -250,42 +252,44 @@ class WebRtcVideoMediaChannel : public rtc::MessageHandler,
int GetDefaultChannelId() const { return default_channel_id_; } int GetDefaultChannelId() const { return default_channel_id_; }
// VideoMediaChannel implementation // VideoMediaChannel implementation
virtual bool SetRecvCodecs(const std::vector<VideoCodec> &codecs); virtual bool SetRecvCodecs(const std::vector<VideoCodec> &codecs) OVERRIDE;
virtual bool SetSendCodecs(const std::vector<VideoCodec> &codecs); virtual bool SetSendCodecs(const std::vector<VideoCodec> &codecs) OVERRIDE;
virtual bool GetSendCodec(VideoCodec* send_codec); virtual bool GetSendCodec(VideoCodec* send_codec) OVERRIDE;
virtual bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format); virtual bool SetSendStreamFormat(uint32 ssrc,
virtual bool SetRender(bool render); const VideoFormat& format) OVERRIDE;
virtual bool SetSend(bool send); virtual bool SetRender(bool render) OVERRIDE;
virtual bool SetSend(bool send) OVERRIDE;
virtual bool AddSendStream(const StreamParams& sp); virtual bool AddSendStream(const StreamParams& sp) OVERRIDE;
virtual bool RemoveSendStream(uint32 ssrc); virtual bool RemoveSendStream(uint32 ssrc) OVERRIDE;
virtual bool AddRecvStream(const StreamParams& sp); virtual bool AddRecvStream(const StreamParams& sp) OVERRIDE;
virtual bool RemoveRecvStream(uint32 ssrc); virtual bool RemoveRecvStream(uint32 ssrc) OVERRIDE;
virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer); virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) OVERRIDE;
virtual bool GetStats(const StatsOptions& options, VideoMediaInfo* info); virtual bool GetStats(const StatsOptions& options,
virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer); VideoMediaInfo* info) OVERRIDE;
virtual bool SendIntraFrame(); virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) OVERRIDE;
virtual bool RequestIntraFrame(); virtual bool SendIntraFrame() OVERRIDE;
virtual bool RequestIntraFrame() OVERRIDE;
virtual void OnPacketReceived(rtc::Buffer* packet, virtual void OnPacketReceived(rtc::Buffer* packet,
const rtc::PacketTime& packet_time); const rtc::PacketTime& packet_time) OVERRIDE;
virtual void OnRtcpReceived(rtc::Buffer* packet, virtual void OnRtcpReceived(rtc::Buffer* packet,
const rtc::PacketTime& packet_time); const rtc::PacketTime& packet_time) OVERRIDE;
virtual void OnReadyToSend(bool ready); virtual void OnReadyToSend(bool ready) OVERRIDE;
virtual bool MuteStream(uint32 ssrc, bool on); virtual bool MuteStream(uint32 ssrc, bool on) OVERRIDE;
virtual bool SetRecvRtpHeaderExtensions( virtual bool SetRecvRtpHeaderExtensions(
const std::vector<RtpHeaderExtension>& extensions); const std::vector<RtpHeaderExtension>& extensions) OVERRIDE;
virtual bool SetSendRtpHeaderExtensions( virtual bool SetSendRtpHeaderExtensions(
const std::vector<RtpHeaderExtension>& extensions); const std::vector<RtpHeaderExtension>& extensions) OVERRIDE;
virtual int GetRtpSendTimeExtnId() const; virtual int GetRtpSendTimeExtnId() const OVERRIDE;
virtual bool SetMaxSendBandwidth(int bps); virtual bool SetMaxSendBandwidth(int bps) OVERRIDE;
virtual bool SetOptions(const VideoOptions &options); virtual bool SetOptions(const VideoOptions &options) OVERRIDE;
virtual bool GetOptions(VideoOptions *options) const { virtual bool GetOptions(VideoOptions *options) const OVERRIDE {
*options = options_; *options = options_;
return true; return true;
} }
virtual void SetInterface(NetworkInterface* iface); virtual void SetInterface(NetworkInterface* iface) OVERRIDE;
virtual void UpdateAspectRatio(int ratio_w, int ratio_h); virtual void UpdateAspectRatio(int ratio_w, int ratio_h) OVERRIDE;
// Public functions for use by tests and other specialized code. // Public functions for use by tests and other specialized code.
uint32 send_ssrc() const { return 0; } uint32 send_ssrc() const { return 0; }
@ -302,12 +306,15 @@ class WebRtcVideoMediaChannel : public rtc::MessageHandler,
void OnLocalFrameFormat(VideoCapturer* capturer, const VideoFormat* format) { void OnLocalFrameFormat(VideoCapturer* capturer, const VideoFormat* format) {
} }
virtual void OnMessage(rtc::Message* msg); // rtc::MessageHandler:
virtual void OnMessage(rtc::Message* msg) OVERRIDE;
protected: protected:
int GetLastEngineError() { return engine()->GetLastEngineError(); } int GetLastEngineError() { return engine()->GetLastEngineError(); }
virtual int SendPacket(int channel, const void* data, int len);
virtual int SendRTCPPacket(int channel, const void* data, int len); // webrtc::Transport:
virtual int SendPacket(int channel, const void* data, int len) OVERRIDE;
virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE;
// Checks the current bitrate estimate and modifies the bitrates // Checks the current bitrate estimate and modifies the bitrates
// accordingly, including converting kAutoBandwidth to the correct defaults. // accordingly, including converting kAutoBandwidth to the correct defaults.

View File

@ -68,8 +68,9 @@ class WebRtcSoundclipStream : public webrtc::InStream {
: mem_(buf, len), loop_(true) { : mem_(buf, len), loop_(true) {
} }
void set_loop(bool loop) { loop_ = loop; } void set_loop(bool loop) { loop_ = loop; }
virtual int Read(void* buf, int len);
virtual int Rewind(); virtual int Read(void* buf, int len) OVERRIDE;
virtual int Rewind() OVERRIDE;
private: private:
rtc::MemoryStream mem_; rtc::MemoryStream mem_;
@ -79,7 +80,7 @@ class WebRtcSoundclipStream : public webrtc::InStream {
// WebRtcMonitorStream is used to monitor a stream coming from WebRtc. // WebRtcMonitorStream is used to monitor a stream coming from WebRtc.
// For now we just dump the data. // For now we just dump the data.
class WebRtcMonitorStream : public webrtc::OutStream { class WebRtcMonitorStream : public webrtc::OutStream {
virtual bool Write(const void *buf, int len) { virtual bool Write(const void *buf, int len) OVERRIDE {
return true; return true;
} }
}; };
@ -156,7 +157,7 @@ class WebRtcVoiceEngine
int16_t audio10ms[], int16_t audio10ms[],
int length, int length,
int sampling_freq, int sampling_freq,
bool is_stereo); bool is_stereo) OVERRIDE;
// For tracking WebRtc channels. Needed because we have to pause them // For tracking WebRtc channels. Needed because we have to pause them
// all when switching devices. // all when switching devices.
@ -207,8 +208,15 @@ class WebRtcVoiceEngine
// allows us to selectively turn on and off different options easily // allows us to selectively turn on and off different options easily
// at any time. // at any time.
bool ApplyOptions(const AudioOptions& options); bool ApplyOptions(const AudioOptions& options);
virtual void Print(webrtc::TraceLevel level, const char* trace, int length);
virtual void CallbackOnError(int channel, int errCode); // webrtc::TraceCallback:
virtual void Print(webrtc::TraceLevel level,
const char* trace,
int length) OVERRIDE;
// webrtc::VoiceEngineObserver:
virtual void CallbackOnError(int channel, int errCode) OVERRIDE;
// Given the device type, name, and id, find device id. Return true and // Given the device type, name, and id, find device id. Return true and
// set the output parameter rtc_id if successful. // set the output parameter rtc_id if successful.
bool FindWebRtcAudioDeviceId( bool FindWebRtcAudioDeviceId(
@ -306,7 +314,7 @@ class WebRtcMediaChannel : public T, public webrtc::Transport {
protected: protected:
// implements Transport interface // implements Transport interface
virtual int SendPacket(int channel, const void *data, int len) { virtual int SendPacket(int channel, const void *data, int len) OVERRIDE {
rtc::Buffer packet(data, len, kMaxRtpPacketLen); rtc::Buffer packet(data, len, kMaxRtpPacketLen);
if (!T::SendPacket(&packet)) { if (!T::SendPacket(&packet)) {
return -1; return -1;
@ -314,7 +322,7 @@ class WebRtcMediaChannel : public T, public webrtc::Transport {
return len; return len;
} }
virtual int SendRTCPPacket(int channel, const void *data, int len) { virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE {
rtc::Buffer packet(data, len, kMaxRtpPacketLen); rtc::Buffer packet(data, len, kMaxRtpPacketLen);
return T::SendRtcp(&packet) ? len : -1; return T::SendRtcp(&packet) ? len : -1;
} }

View File

@ -41,7 +41,7 @@ class VerifyingRtxReceiver : public NullRtpData
virtual int32_t OnReceivedPayloadData( virtual int32_t OnReceivedPayloadData(
const uint8_t* data, const uint8_t* data,
const uint16_t size, const uint16_t size,
const webrtc::WebRtcRTPHeader* rtp_header) { const webrtc::WebRtcRTPHeader* rtp_header) OVERRIDE {
if (!sequence_numbers_.empty()) if (!sequence_numbers_.empty())
EXPECT_EQ(kTestSsrc, rtp_header->header.ssrc); EXPECT_EQ(kTestSsrc, rtp_header->header.ssrc);
sequence_numbers_.push_back(rtp_header->header.sequenceNumber); sequence_numbers_.push_back(rtp_header->header.sequenceNumber);
@ -56,7 +56,7 @@ class TestRtpFeedback : public NullRtpFeedback {
virtual ~TestRtpFeedback() {} virtual ~TestRtpFeedback() {}
virtual void OnIncomingSSRCChanged(const int32_t id, virtual void OnIncomingSSRCChanged(const int32_t id,
const uint32_t ssrc) { const uint32_t ssrc) OVERRIDE {
rtp_rtcp_->SetRemoteSSRC(ssrc); rtp_rtcp_->SetRemoteSSRC(ssrc);
} }
@ -95,7 +95,7 @@ class RtxLoopBackTransport : public webrtc::Transport {
packet_loss_ = 0; packet_loss_ = 0;
} }
virtual int SendPacket(int channel, const void *data, int len) { virtual int SendPacket(int channel, const void *data, int len) OVERRIDE {
count_++; count_++;
const unsigned char* ptr = static_cast<const unsigned char*>(data); const unsigned char* ptr = static_cast<const unsigned char*>(data);
uint32_t ssrc = (ptr[8] << 24) + (ptr[9] << 16) + (ptr[10] << 8) + ptr[11]; uint32_t ssrc = (ptr[8] << 24) + (ptr[9] << 16) + (ptr[10] << 8) + ptr[11];
@ -146,7 +146,7 @@ class RtxLoopBackTransport : public webrtc::Transport {
return len; return len;
} }
virtual int SendRTCPPacket(int channel, const void *data, int len) { virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE {
if (module_->IncomingRtcpPacket((const uint8_t*)data, len) == 0) { if (module_->IncomingRtcpPacket((const uint8_t*)data, len) == 0) {
return len; return len;
} }
@ -175,7 +175,7 @@ class RtpRtcpRtxNackTest : public ::testing::Test {
fake_clock(123456) {} fake_clock(123456) {}
~RtpRtcpRtxNackTest() {} ~RtpRtcpRtxNackTest() {}
virtual void SetUp() { virtual void SetUp() OVERRIDE {
RtpRtcp::Configuration configuration; RtpRtcp::Configuration configuration;
configuration.id = kTestId; configuration.id = kTestId;
configuration.audio = false; configuration.audio = false;
@ -280,7 +280,7 @@ class RtpRtcpRtxNackTest : public ::testing::Test {
receiver_.sequence_numbers_.sort(); receiver_.sequence_numbers_.sort();
} }
virtual void TearDown() { virtual void TearDown() OVERRIDE {
delete rtp_rtcp_module_; delete rtp_rtcp_module_;
} }

View File

@ -30,12 +30,14 @@ class TestTransport : public Transport {
rtcp_receiver_(rtcp_receiver) { rtcp_receiver_(rtcp_receiver) {
} }
virtual int SendPacket(int /*channel*/, const void* /*data*/, int /*len*/) { virtual int SendPacket(int /*channel*/,
const void* /*data*/,
int /*len*/) OVERRIDE {
return -1; return -1;
} }
virtual int SendRTCPPacket(int /*channel*/, virtual int SendRTCPPacket(int /*channel*/,
const void *packet, const void *packet,
int packetLength) { int packetLength) OVERRIDE {
RTCPUtility::RTCPParserV2 rtcpParser((uint8_t*)packet, RTCPUtility::RTCPParserV2 rtcpParser((uint8_t*)packet,
(int32_t)packetLength, (int32_t)packetLength,
true); // Allow non-compound RTCP true); // Allow non-compound RTCP
@ -71,8 +73,8 @@ class RtcpFormatRembTest : public ::testing::Test {
system_clock_, system_clock_,
kMimdControl, kMimdControl,
kRemoteBitrateEstimatorMinBitrateBps)) {} kRemoteBitrateEstimatorMinBitrateBps)) {}
virtual void SetUp(); virtual void SetUp() OVERRIDE;
virtual void TearDown(); virtual void TearDown() OVERRIDE;
OverUseDetectorOptions over_use_detector_options_; OverUseDetectorOptions over_use_detector_options_;
Clock* system_clock_; Clock* system_clock_;

View File

@ -39,20 +39,24 @@ class TestTransport : public Transport,
void SetRTCPReceiver(RTCPReceiver* rtcp_receiver) { void SetRTCPReceiver(RTCPReceiver* rtcp_receiver) {
rtcp_receiver_ = rtcp_receiver; rtcp_receiver_ = rtcp_receiver;
} }
virtual int SendPacket(int /*ch*/, const void* /*data*/, int /*len*/) { virtual int SendPacket(int /*ch*/,
const void* /*data*/,
int /*len*/) OVERRIDE {
ADD_FAILURE(); // FAIL() gives a compile error. ADD_FAILURE(); // FAIL() gives a compile error.
return -1; return -1;
} }
// Injects an RTCP packet into the receiver. // Injects an RTCP packet into the receiver.
virtual int SendRTCPPacket(int /* ch */, const void *packet, int packet_len) { virtual int SendRTCPPacket(int /* ch */,
const void *packet,
int packet_len) OVERRIDE {
ADD_FAILURE(); ADD_FAILURE();
return 0; return 0;
} }
virtual int OnReceivedPayloadData(const uint8_t* payloadData, virtual int OnReceivedPayloadData(const uint8_t* payloadData,
const uint16_t payloadSize, const uint16_t payloadSize,
const WebRtcRTPHeader* rtpHeader) { const WebRtcRTPHeader* rtpHeader) OVERRIDE {
ADD_FAILURE(); ADD_FAILURE();
return 0; return 0;
} }
@ -818,7 +822,7 @@ TEST_F(RtcpReceiverTest, Callbacks) {
virtual ~RtcpCallbackImpl() {} virtual ~RtcpCallbackImpl() {}
virtual void StatisticsUpdated(const RtcpStatistics& statistics, virtual void StatisticsUpdated(const RtcpStatistics& statistics,
uint32_t ssrc) { uint32_t ssrc) OVERRIDE {
stats_ = statistics; stats_ = statistics;
ssrc_ = ssrc; ssrc_ = ssrc;
} }

View File

@ -227,11 +227,15 @@ class TestTransport : public Transport,
void SetRTCPReceiver(RTCPReceiver* rtcp_receiver) { void SetRTCPReceiver(RTCPReceiver* rtcp_receiver) {
rtcp_receiver_ = rtcp_receiver; rtcp_receiver_ = rtcp_receiver;
} }
virtual int SendPacket(int /*ch*/, const void* /*data*/, int /*len*/) { virtual int SendPacket(int /*ch*/,
const void* /*data*/,
int /*len*/) OVERRIDE {
return -1; return -1;
} }
virtual int SendRTCPPacket(int /*ch*/, const void *packet, int packet_len) { virtual int SendRTCPPacket(int /*ch*/,
const void *packet,
int packet_len) OVERRIDE {
RTCPUtility::RTCPParserV2 rtcpParser((uint8_t*)packet, RTCPUtility::RTCPParserV2 rtcpParser((uint8_t*)packet,
(int32_t)packet_len, (int32_t)packet_len,
true); // Allow non-compound RTCP true); // Allow non-compound RTCP
@ -263,7 +267,7 @@ class TestTransport : public Transport,
virtual int OnReceivedPayloadData(const uint8_t* payloadData, virtual int OnReceivedPayloadData(const uint8_t* payloadData,
const uint16_t payloadSize, const uint16_t payloadSize,
const WebRtcRTPHeader* rtpHeader) { const WebRtcRTPHeader* rtpHeader) OVERRIDE {
return 0; return 0;
} }
RTCPReceiver* rtcp_receiver_; RTCPReceiver* rtcp_receiver_;

View File

@ -39,10 +39,10 @@ class RtcpRttStatsTestImpl : public RtcpRttStats {
RtcpRttStatsTestImpl() : rtt_ms_(0) {} RtcpRttStatsTestImpl() : rtt_ms_(0) {}
virtual ~RtcpRttStatsTestImpl() {} virtual ~RtcpRttStatsTestImpl() {}
virtual void OnRttUpdate(uint32_t rtt_ms) { virtual void OnRttUpdate(uint32_t rtt_ms) OVERRIDE {
rtt_ms_ = rtt_ms; rtt_ms_ = rtt_ms;
} }
virtual uint32_t LastProcessedRtt() const { virtual uint32_t LastProcessedRtt() const OVERRIDE {
return rtt_ms_; return rtt_ms_;
} }
uint32_t rtt_ms_; uint32_t rtt_ms_;
@ -65,7 +65,7 @@ class SendTransport : public Transport,
clock_ = clock; clock_ = clock;
delay_ms_ = delay_ms; delay_ms_ = delay_ms;
} }
virtual int SendPacket(int /*ch*/, const void* data, int len) { virtual int SendPacket(int /*ch*/, const void* data, int len) OVERRIDE {
RTPHeader header; RTPHeader header;
scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data), EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data),
@ -75,7 +75,7 @@ class SendTransport : public Transport,
last_rtp_header_ = header; last_rtp_header_ = header;
return len; return len;
} }
virtual int SendRTCPPacket(int /*ch*/, const void *data, int len) { virtual int SendRTCPPacket(int /*ch*/, const void *data, int len) OVERRIDE {
if (clock_) { if (clock_) {
clock_->AdvanceTimeMilliseconds(delay_ms_); clock_->AdvanceTimeMilliseconds(delay_ms_);
} }
@ -348,7 +348,7 @@ class RtpSendingTestTransport : public Transport {
public: public:
void ResetCounters() { bytes_received_.clear(); } void ResetCounters() { bytes_received_.clear(); }
virtual int SendPacket(int channel, const void* data, int length) { virtual int SendPacket(int channel, const void* data, int length) OVERRIDE {
RTPHeader header; RTPHeader header;
scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data), EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data),
@ -359,7 +359,9 @@ class RtpSendingTestTransport : public Transport {
return length; return length;
} }
virtual int SendRTCPPacket(int channel, const void* data, int length) { virtual int SendRTCPPacket(int channel,
const void* data,
int length) OVERRIDE {
return length; return length;
} }

View File

@ -64,14 +64,14 @@ class LoopbackTransportTest : public webrtc::Transport {
public: public:
LoopbackTransportTest() LoopbackTransportTest()
: packets_sent_(0), last_sent_packet_len_(0), total_bytes_sent_(0) {} : packets_sent_(0), last_sent_packet_len_(0), total_bytes_sent_(0) {}
virtual int SendPacket(int channel, const void *data, int len) { virtual int SendPacket(int channel, const void *data, int len) OVERRIDE {
packets_sent_++; packets_sent_++;
memcpy(last_sent_packet_, data, len); memcpy(last_sent_packet_, data, len);
last_sent_packet_len_ = len; last_sent_packet_len_ = len;
total_bytes_sent_ += static_cast<size_t>(len); total_bytes_sent_ += static_cast<size_t>(len);
return len; return len;
} }
virtual int SendRTCPPacket(int channel, const void *data, int len) { virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE {
return -1; return -1;
} }
int packets_sent_; int packets_sent_;
@ -93,7 +93,7 @@ class RtpSenderTest : public ::testing::Test {
SendPacket(_, _, _, _, _, _)).WillRepeatedly(testing::Return(true)); SendPacket(_, _, _, _, _, _)).WillRepeatedly(testing::Return(true));
} }
virtual void SetUp() { virtual void SetUp() OVERRIDE {
rtp_sender_.reset(new RTPSender(0, false, &fake_clock_, &transport_, NULL, rtp_sender_.reset(new RTPSender(0, false, &fake_clock_, &transport_, NULL,
&mock_paced_sender_, NULL, NULL, NULL)); &mock_paced_sender_, NULL, NULL, NULL));
rtp_sender_->SetSequenceNumber(kSeqNum); rtp_sender_->SetSequenceNumber(kSeqNum);
@ -799,7 +799,7 @@ TEST_F(RtpSenderTest, FrameCountCallbacks) {
virtual void FrameCountUpdated(FrameType frame_type, virtual void FrameCountUpdated(FrameType frame_type,
uint32_t frame_count, uint32_t frame_count,
const unsigned int ssrc) { const unsigned int ssrc) OVERRIDE {
++num_calls_; ++num_calls_;
ssrc_ = ssrc; ssrc_ = ssrc;
switch (frame_type) { switch (frame_type) {
@ -859,7 +859,8 @@ TEST_F(RtpSenderTest, BitrateCallbacks) {
: BitrateStatisticsObserver(), num_calls_(0), ssrc_(0), bitrate_() {} : BitrateStatisticsObserver(), num_calls_(0), ssrc_(0), bitrate_() {}
virtual ~TestCallback() {} virtual ~TestCallback() {}
virtual void Notify(const BitrateStatistics& stats, uint32_t ssrc) { virtual void Notify(const BitrateStatistics& stats,
uint32_t ssrc) OVERRIDE {
++num_calls_; ++num_calls_;
ssrc_ = ssrc; ssrc_ = ssrc;
bitrate_ = stats; bitrate_ = stats;
@ -923,7 +924,7 @@ class RtpSenderAudioTest : public RtpSenderTest {
protected: protected:
RtpSenderAudioTest() {} RtpSenderAudioTest() {}
virtual void SetUp() { virtual void SetUp() OVERRIDE {
payload_ = kAudioPayload; payload_ = kAudioPayload;
rtp_sender_.reset(new RTPSender(0, true, &fake_clock_, &transport_, NULL, rtp_sender_.reset(new RTPSender(0, true, &fake_clock_, &transport_, NULL,
&mock_paced_sender_, NULL, NULL, NULL)); &mock_paced_sender_, NULL, NULL, NULL));
@ -939,7 +940,7 @@ TEST_F(RtpSenderTest, StreamDataCountersCallbacks) {
virtual ~TestCallback() {} virtual ~TestCallback() {}
virtual void DataCountersUpdated(const StreamDataCounters& counters, virtual void DataCountersUpdated(const StreamDataCounters& counters,
uint32_t ssrc) { uint32_t ssrc) OVERRIDE {
ssrc_ = ssrc; ssrc_ = ssrc;
counters_ = counters; counters_ = counters;
} }

View File

@ -46,7 +46,6 @@ _payloadType(0),
_loadGenerator(NULL), _loadGenerator(NULL),
_isSender(false), _isSender(false),
_isReceiver(false), _isReceiver(false),
_timeOut(false),
_sendRecCB(NULL), _sendRecCB(NULL),
_lastBytesReceived(0), _lastBytesReceived(0),
_lastTime(-1) _lastTime(-1)
@ -290,22 +289,6 @@ int32_t TestSenderReceiver::SetPacketTimeout(const uint32_t timeoutMS)
} }
void TestSenderReceiver::OnPacketTimeout(const int32_t id)
{
CriticalSectionScoped lock(_critSect);
_timeOut = true;
}
void TestSenderReceiver::OnReceivedPacket(const int32_t id,
const RtpRtcpPacketType packetType)
{
// do nothing
//printf("OnReceivedPacket\n");
}
int32_t TestSenderReceiver::OnReceivedPayloadData(const uint8_t* payloadData, int32_t TestSenderReceiver::OnReceivedPayloadData(const uint8_t* payloadData,
const uint16_t payloadSize, const uint16_t payloadSize,
const webrtc::WebRtcRTPHeader* rtpHeader) const webrtc::WebRtcRTPHeader* rtpHeader)

View File

@ -68,8 +68,6 @@ public:
int32_t SetPacketTimeout(const uint32_t timeoutMS); int32_t SetPacketTimeout(const uint32_t timeoutMS);
bool timeOutTriggered () { return (_timeOut); };
// Inherited from RtpFeedback // Inherited from RtpFeedback
virtual int32_t OnInitializeDecoder( virtual int32_t OnInitializeDecoder(
const int32_t id, const int32_t id,
@ -81,14 +79,6 @@ public:
return 0; return 0;
} }
virtual void OnPacketTimeout(const int32_t id);
virtual void OnReceivedPacket(const int32_t id,
const RtpRtcpPacketType packetType);
virtual void OnPeriodicDeadOrAlive(const int32_t id,
const RTPAliveType alive) {};
virtual void OnIncomingSSRCChanged(const int32_t id, virtual void OnIncomingSSRCChanged(const int32_t id,
const uint32_t SSRC) OVERRIDE {} const uint32_t SSRC) OVERRIDE {}
@ -159,7 +149,6 @@ private:
TestLoadGenerator* _loadGenerator; TestLoadGenerator* _loadGenerator;
bool _isSender; bool _isSender;
bool _isReceiver; bool _isReceiver;
bool _timeOut;
SendRecCB * _sendRecCB; SendRecCB * _sendRecCB;
uint32_t _lastBytesReceived; uint32_t _lastBytesReceived;
int64_t _lastTime; int64_t _lastTime;

View File

@ -43,7 +43,7 @@ class LoopBackTransport : public webrtc::Transport {
void DropEveryNthPacket(int n) { void DropEveryNthPacket(int n) {
_packetLoss = n; _packetLoss = n;
} }
virtual int SendPacket(int channel, const void *data, int len) { virtual int SendPacket(int channel, const void *data, int len) OVERRIDE {
_count++; _count++;
if (_packetLoss > 0) { if (_packetLoss > 0) {
if ((_count % _packetLoss) == 0) { if ((_count % _packetLoss) == 0) {
@ -70,7 +70,7 @@ class LoopBackTransport : public webrtc::Transport {
} }
return len; return len;
} }
virtual int SendRTCPPacket(int channel, const void *data, int len) { virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE {
if (_rtpRtcpModule->IncomingRtcpPacket((const uint8_t*)data, len) < 0) { if (_rtpRtcpModule->IncomingRtcpPacket((const uint8_t*)data, len) < 0) {
return -1; return -1;
} }
@ -91,7 +91,7 @@ class TestRtpReceiver : public NullRtpData {
virtual int32_t OnReceivedPayloadData( virtual int32_t OnReceivedPayloadData(
const uint8_t* payloadData, const uint8_t* payloadData,
const uint16_t payloadSize, const uint16_t payloadSize,
const webrtc::WebRtcRTPHeader* rtpHeader) { const webrtc::WebRtcRTPHeader* rtpHeader) OVERRIDE {
EXPECT_LE(payloadSize, sizeof(_payloadData)); EXPECT_LE(payloadSize, sizeof(_payloadData));
memcpy(_payloadData, payloadData, payloadSize); memcpy(_payloadData, payloadData, payloadSize);
memcpy(&_rtpHeader, rtpHeader, sizeof(_rtpHeader)); memcpy(&_rtpHeader, rtpHeader, sizeof(_rtpHeader));

View File

@ -28,7 +28,7 @@ class VerifyingAudioReceiver : public NullRtpData {
virtual int32_t OnReceivedPayloadData( virtual int32_t OnReceivedPayloadData(
const uint8_t* payloadData, const uint8_t* payloadData,
const uint16_t payloadSize, const uint16_t payloadSize,
const webrtc::WebRtcRTPHeader* rtpHeader) { const webrtc::WebRtcRTPHeader* rtpHeader) OVERRIDE {
if (rtpHeader->header.payloadType == 98 || if (rtpHeader->header.payloadType == 98 ||
rtpHeader->header.payloadType == 99) { rtpHeader->header.payloadType == 99) {
EXPECT_EQ(4, payloadSize); EXPECT_EQ(4, payloadSize);
@ -67,7 +67,7 @@ class RTPCallback : public NullRtpFeedback {
const char payloadName[RTP_PAYLOAD_NAME_SIZE], const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const int frequency, const int frequency,
const uint8_t channels, const uint8_t channels,
const uint32_t rate) { const uint32_t rate) OVERRIDE {
if (payloadType == 96) { if (payloadType == 96) {
EXPECT_EQ(test_rate, rate) << EXPECT_EQ(test_rate, rate) <<
"The rate should be 64K for this payloadType"; "The rate should be 64K for this payloadType";
@ -76,28 +76,6 @@ class RTPCallback : public NullRtpFeedback {
} }
}; };
class AudioFeedback : public NullRtpAudioFeedback {
virtual void OnReceivedTelephoneEvent(const int32_t id,
const uint8_t event,
const bool end) {
static uint8_t expectedEvent = 0;
if (end) {
uint8_t oldEvent = expectedEvent-1;
if (expectedEvent == 32) {
oldEvent = 15;
}
EXPECT_EQ(oldEvent, event);
} else {
EXPECT_EQ(expectedEvent, event);
expectedEvent++;
}
if (expectedEvent == 16) {
expectedEvent = 32;
}
}
};
class RtpRtcpAudioTest : public ::testing::Test { class RtpRtcpAudioTest : public ::testing::Test {
protected: protected:
RtpRtcpAudioTest() : fake_clock(123456) { RtpRtcpAudioTest() : fake_clock(123456) {
@ -110,8 +88,8 @@ class RtpRtcpAudioTest : public ::testing::Test {
} }
~RtpRtcpAudioTest() {} ~RtpRtcpAudioTest() {}
virtual void SetUp() { virtual void SetUp() OVERRIDE {
audioFeedback = new AudioFeedback(); audioFeedback = new NullRtpAudioFeedback();
data_receiver1 = new VerifyingAudioReceiver(); data_receiver1 = new VerifyingAudioReceiver();
data_receiver2 = new VerifyingAudioReceiver(); data_receiver2 = new VerifyingAudioReceiver();
rtp_callback = new RTPCallback(); rtp_callback = new RTPCallback();
@ -155,7 +133,7 @@ class RtpRtcpAudioTest : public ::testing::Test {
rtp_receiver1_.get(), receive_statistics1_.get()); rtp_receiver1_.get(), receive_statistics1_.get());
} }
virtual void TearDown() { virtual void TearDown() OVERRIDE {
delete module1; delete module1;
delete module2; delete module2;
delete transport1; delete transport1;
@ -179,7 +157,7 @@ class RtpRtcpAudioTest : public ::testing::Test {
VerifyingAudioReceiver* data_receiver2; VerifyingAudioReceiver* data_receiver2;
LoopBackTransport* transport1; LoopBackTransport* transport1;
LoopBackTransport* transport2; LoopBackTransport* transport2;
AudioFeedback* audioFeedback; NullRtpAudioFeedback* audioFeedback;
RTPCallback* rtp_callback; RTPCallback* rtp_callback;
uint32_t test_ssrc; uint32_t test_ssrc;
uint32_t test_timestamp; uint32_t test_timestamp;

View File

@ -75,8 +75,8 @@ class RTPSendCallback_SizeTest : public webrtc::Transport
public: public:
// constructor input: (receive side) rtp module to send encoded data to // constructor input: (receive side) rtp module to send encoded data to
RTPSendCallback_SizeTest() : _maxPayloadSize(0), _payloadSizeSum(0), _nPackets(0) {} RTPSendCallback_SizeTest() : _maxPayloadSize(0), _payloadSizeSum(0), _nPackets(0) {}
virtual int SendPacket(int channel, const void *data, int len); virtual int SendPacket(int channel, const void *data, int len) OVERRIDE;
virtual int SendRTCPPacket(int channel, const void *data, int len) {return 0;} virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE {return 0;}
void SetMaxPayloadSize(uint32_t maxPayloadSize); void SetMaxPayloadSize(uint32_t maxPayloadSize);
void Reset(); void Reset();
float AveragePayloadSize() const; float AveragePayloadSize() const;
@ -90,7 +90,7 @@ class VCMEncComplete_KeyReqTest : public webrtc::VCMPacketizationCallback
{ {
public: public:
VCMEncComplete_KeyReqTest(webrtc::VideoCodingModule &vcm) : _vcm(vcm), _seqNo(0), _timeStamp(0) {} VCMEncComplete_KeyReqTest(webrtc::VideoCodingModule &vcm) : _vcm(vcm), _seqNo(0), _timeStamp(0) {}
int32_t SendData( virtual int32_t SendData(
const webrtc::FrameType frameType, const webrtc::FrameType frameType,
const uint8_t payloadType, const uint8_t payloadType,
uint32_t timeStamp, uint32_t timeStamp,
@ -98,7 +98,7 @@ public:
const uint8_t* payloadData, const uint8_t* payloadData,
const uint32_t payloadSize, const uint32_t payloadSize,
const webrtc::RTPFragmentationHeader& fragmentationHeader, const webrtc::RTPFragmentationHeader& fragmentationHeader,
const webrtc::RTPVideoHeader* videoHdr); const webrtc::RTPVideoHeader* videoHdr) OVERRIDE;
private: private:
webrtc::VideoCodingModule& _vcm; webrtc::VideoCodingModule& _vcm;
uint16_t _seqNo; uint16_t _seqNo;

View File

@ -52,7 +52,7 @@ class TransportCallback:public RTPSendCompleteCallback
// Add packets to list // Add packets to list
// Incorporate network conditions - delay and packet loss // Incorporate network conditions - delay and packet loss
// Actual transmission will occur on a separate thread // Actual transmission will occur on a separate thread
int SendPacket(int channel, const void *data, int len); virtual int SendPacket(int channel, const void *data, int len) OVERRIDE;
// Send to the receiver packets which are ready to be submitted // Send to the receiver packets which are ready to be submitted
int TransportPackets(); int TransportPackets();
}; };

View File

@ -44,14 +44,14 @@ public:
void RegisterTransportCallback(VCMPacketizationCallback* transport); void RegisterTransportCallback(VCMPacketizationCallback* transport);
// Process encoded data received from the encoder, pass stream to the // Process encoded data received from the encoder, pass stream to the
// VCMReceiver module // VCMReceiver module
int32_t SendData(const FrameType frameType, virtual int32_t SendData(const FrameType frameType,
const uint8_t payloadType, const uint8_t payloadType,
const uint32_t timeStamp, const uint32_t timeStamp,
int64_t capture_time_ms, int64_t capture_time_ms,
const uint8_t* payloadData, const uint8_t* payloadData,
const uint32_t payloadSize, const uint32_t payloadSize,
const RTPFragmentationHeader& fragmentationHeader, const RTPFragmentationHeader& fragmentationHeader,
const RTPVideoHeader* videoHdr); const RTPVideoHeader* videoHdr) OVERRIDE;
// Register exisitng VCM. Currently - encode and decode under same module. // Register exisitng VCM. Currently - encode and decode under same module.
void RegisterReceiverVCM(VideoCodingModule *vcm) {_VCMReceiver = vcm;} void RegisterReceiverVCM(VideoCodingModule *vcm) {_VCMReceiver = vcm;}
// Return size of last encoded frame data (all frames in the sequence) // Return size of last encoded frame data (all frames in the sequence)
@ -101,14 +101,14 @@ public:
virtual ~VCMRTPEncodeCompleteCallback() {} virtual ~VCMRTPEncodeCompleteCallback() {}
// Process encoded data received from the encoder, pass stream to the // Process encoded data received from the encoder, pass stream to the
// RTP module // RTP module
int32_t SendData(const FrameType frameType, virtual int32_t SendData(const FrameType frameType,
const uint8_t payloadType, const uint8_t payloadType,
const uint32_t timeStamp, const uint32_t timeStamp,
int64_t capture_time_ms, int64_t capture_time_ms,
const uint8_t* payloadData, const uint8_t* payloadData,
const uint32_t payloadSize, const uint32_t payloadSize,
const RTPFragmentationHeader& fragmentationHeader, const RTPFragmentationHeader& fragmentationHeader,
const RTPVideoHeader* videoHdr); const RTPVideoHeader* videoHdr) OVERRIDE;
// Return size of last encoded frame. Value good for one call // Return size of last encoded frame. Value good for one call
// (resets to zero after call to inform test of frame drop) // (resets to zero after call to inform test of frame drop)
float EncodedBytes(); float EncodedBytes();
@ -144,7 +144,7 @@ public:
_decodedFile(decodedFile), _decodedBytes(0) {} _decodedFile(decodedFile), _decodedBytes(0) {}
virtual ~VCMDecodeCompleteCallback() {} virtual ~VCMDecodeCompleteCallback() {}
// Write decoded frame into file // Write decoded frame into file
int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame); virtual int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame) OVERRIDE;
int32_t DecodedBytes(); int32_t DecodedBytes();
private: private:
FILE* _decodedFile; FILE* _decodedFile;
@ -165,9 +165,9 @@ public:
void SetRtpModule(RtpRtcp* rtp_module) { _rtp = rtp_module; } void SetRtpModule(RtpRtcp* rtp_module) { _rtp = rtp_module; }
// Send Packet to receive side RTP module // Send Packet to receive side RTP module
virtual int SendPacket(int channel, const void *data, int len); virtual int SendPacket(int channel, const void *data, int len) OVERRIDE;
// Send RTCP Packet to receive side RTP module // Send RTCP Packet to receive side RTP module
virtual int SendRTCPPacket(int channel, const void *data, int len); virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE;
// Set percentage of channel loss in the network // Set percentage of channel loss in the network
void SetLossPct(double lossPct); void SetLossPct(double lossPct);
// Set average size of burst loss // Set average size of burst loss
@ -209,8 +209,8 @@ class PacketRequester: public VCMPacketRequestCallback
public: public:
PacketRequester(RtpRtcp& rtp) : PacketRequester(RtpRtcp& rtp) :
_rtp(rtp) {} _rtp(rtp) {}
int32_t ResendPackets(const uint16_t* sequenceNumbers, virtual int32_t ResendPackets(const uint16_t* sequenceNumbers,
uint16_t length); uint16_t length) OVERRIDE;
private: private:
webrtc::RtpRtcp& _rtp; webrtc::RtpRtcp& _rtp;
}; };
@ -219,7 +219,7 @@ private:
class KeyFrameReqTest: public VCMFrameTypeCallback class KeyFrameReqTest: public VCMFrameTypeCallback
{ {
public: public:
int32_t RequestKeyFrame(); virtual int32_t RequestKeyFrame() OVERRIDE;
}; };
@ -228,8 +228,8 @@ class SendStatsTest: public webrtc::VCMSendStatisticsCallback
{ {
public: public:
SendStatsTest() : _framerate(15), _bitrate(500) {} SendStatsTest() : _framerate(15), _bitrate(500) {}
int32_t SendStatistics(const uint32_t bitRate, virtual int32_t SendStatistics(const uint32_t bitRate,
const uint32_t frameRate); const uint32_t frameRate) OVERRIDE;
void set_framerate(uint32_t frameRate) {_framerate = frameRate;} void set_framerate(uint32_t frameRate) {_framerate = frameRate;}
void set_bitrate(uint32_t bitrate) {_bitrate = bitrate;} void set_bitrate(uint32_t bitrate) {_bitrate = bitrate;}
private: private:
@ -245,12 +245,12 @@ public:
VideoProtectionCallback(); VideoProtectionCallback();
virtual ~VideoProtectionCallback(); virtual ~VideoProtectionCallback();
void RegisterRtpModule(RtpRtcp* rtp) {_rtp = rtp;} void RegisterRtpModule(RtpRtcp* rtp) {_rtp = rtp;}
int32_t ProtectionRequest( virtual int32_t ProtectionRequest(
const FecProtectionParams* delta_fec_params, const FecProtectionParams* delta_fec_params,
const FecProtectionParams* key_fec_params, const FecProtectionParams* key_fec_params,
uint32_t* sent_video_rate_bps, uint32_t* sent_video_rate_bps,
uint32_t* sent_nack_rate_bps, uint32_t* sent_nack_rate_bps,
uint32_t* sent_fec_rate_bps); uint32_t* sent_fec_rate_bps) OVERRIDE;
FecProtectionParams DeltaFecParameters() const; FecProtectionParams DeltaFecParameters() const;
FecProtectionParams KeyFecParameters() const; FecProtectionParams KeyFecParameters() const;
private: private:

View File

@ -21,10 +21,12 @@ class TransportAdapter : public webrtc::Transport {
public: public:
explicit TransportAdapter(newapi::Transport* transport); explicit TransportAdapter(newapi::Transport* transport);
virtual int SendPacket(int /*channel*/, const void* packet, int length) virtual int SendPacket(int /*channel*/,
OVERRIDE; const void* packet,
virtual int SendRTCPPacket(int /*channel*/, const void* packet, int length) int length) OVERRIDE;
OVERRIDE; virtual int SendRTCPPacket(int /*channel*/,
const void* packet,
int length) OVERRIDE;
void Enable(); void Enable();
void Disable(); void Disable();

View File

@ -25,11 +25,13 @@ class RtcpCollectorTransport : public webrtc::Transport {
RtcpCollectorTransport() : packets_() {} RtcpCollectorTransport() : packets_() {}
virtual ~RtcpCollectorTransport() {} virtual ~RtcpCollectorTransport() {}
virtual int SendPacket(int /*channel*/, const void* /*data*/, int /*len*/) { virtual int SendPacket(int /*channel*/,
const void* /*data*/,
int /*len*/) OVERRIDE {
EXPECT_TRUE(false); EXPECT_TRUE(false);
return 0; return 0;
} }
virtual int SendRTCPPacket(int channel, const void* data, int len) { virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE {
const uint8_t* buf = static_cast<const uint8_t*>(data); const uint8_t* buf = static_cast<const uint8_t*>(data);
webrtc::RtpUtility::RtpHeaderParser parser(buf, len); webrtc::RtpUtility::RtpHeaderParser parser(buf, len);
if (parser.RTCP()) { if (parser.RTCP()) {
@ -105,13 +107,13 @@ class ViENetworkTest : public testing::Test {
ViENetworkTest() : vie_("ViENetworkTest"), channel_(-1), transport() {} ViENetworkTest() : vie_("ViENetworkTest"), channel_(-1), transport() {}
virtual ~ViENetworkTest() {} virtual ~ViENetworkTest() {}
virtual void SetUp() { virtual void SetUp() OVERRIDE {
EXPECT_EQ(0, vie_.base->CreateChannel(channel_)); EXPECT_EQ(0, vie_.base->CreateChannel(channel_));
EXPECT_EQ(0, vie_.rtp_rtcp->SetRembStatus(channel_, false, true)); EXPECT_EQ(0, vie_.rtp_rtcp->SetRembStatus(channel_, false, true));
EXPECT_EQ(0, vie_.network->RegisterSendTransport(channel_, transport)); EXPECT_EQ(0, vie_.network->RegisterSendTransport(channel_, transport));
} }
virtual void TearDown() { virtual void TearDown() OVERRIDE {
EXPECT_EQ(0, vie_.network->DeregisterSendTransport(channel_)); EXPECT_EQ(0, vie_.network->DeregisterSendTransport(channel_));
} }

View File

@ -85,8 +85,8 @@ public:
TbExternalTransport::SsrcChannelMap* receive_channels); TbExternalTransport::SsrcChannelMap* receive_channels);
~TbExternalTransport(void); ~TbExternalTransport(void);
virtual int SendPacket(int channel, const void *data, int len); virtual int SendPacket(int channel, const void *data, int len) OVERRIDE;
virtual int SendRTCPPacket(int channel, const void *data, int len); virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE;
// Should only be called before/after traffic is being processed. // Should only be called before/after traffic is being processed.
// Only one observer can be set (multiple calls will overwrite each other). // Only one observer can be set (multiple calls will overwrite each other).

View File

@ -40,8 +40,8 @@ class ViESender: public Transport {
int StopRTPDump(); int StopRTPDump();
// Implements Transport. // Implements Transport.
virtual int SendPacket(int vie_id, const void* data, int len); virtual int SendPacket(int vie_id, const void* data, int len) OVERRIDE;
virtual int SendRTCPPacket(int vie_id, const void* data, int len); virtual int SendRTCPPacket(int vie_id, const void* data, int len) OVERRIDE;
private: private:
const int32_t channel_id_; const int32_t channel_id_;

View File

@ -395,116 +395,6 @@ Channel::OnInitializeDecoder(
return 0; return 0;
} }
void
Channel::OnPacketTimeout(int32_t id)
{
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::OnPacketTimeout(id=%d)", id);
CriticalSectionScoped cs(_callbackCritSectPtr);
if (_voiceEngineObserverPtr)
{
if (channel_state_.Get().receiving || _externalTransport)
{
int32_t channel = VoEChannelId(id);
assert(channel == _channelId);
// Ensure that next OnReceivedPacket() callback will trigger
// a VE_PACKET_RECEIPT_RESTARTED callback.
_rtpPacketTimedOut = true;
// Deliver callback to the observer
WEBRTC_TRACE(kTraceInfo, kTraceVoice,
VoEId(_instanceId,_channelId),
"Channel::OnPacketTimeout() => "
"CallbackOnError(VE_RECEIVE_PACKET_TIMEOUT)");
_voiceEngineObserverPtr->CallbackOnError(channel,
VE_RECEIVE_PACKET_TIMEOUT);
}
}
}
void
Channel::OnReceivedPacket(int32_t id,
RtpRtcpPacketType packetType)
{
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::OnReceivedPacket(id=%d, packetType=%d)",
id, packetType);
assert(VoEChannelId(id) == _channelId);
// Notify only for the case when we have restarted an RTP session.
if (_rtpPacketTimedOut && (kPacketRtp == packetType))
{
CriticalSectionScoped cs(_callbackCritSectPtr);
if (_voiceEngineObserverPtr)
{
int32_t channel = VoEChannelId(id);
assert(channel == _channelId);
// Reset timeout mechanism
_rtpPacketTimedOut = false;
// Deliver callback to the observer
WEBRTC_TRACE(kTraceInfo, kTraceVoice,
VoEId(_instanceId,_channelId),
"Channel::OnPacketTimeout() =>"
" CallbackOnError(VE_PACKET_RECEIPT_RESTARTED)");
_voiceEngineObserverPtr->CallbackOnError(
channel,
VE_PACKET_RECEIPT_RESTARTED);
}
}
}
void
Channel::OnPeriodicDeadOrAlive(int32_t id,
RTPAliveType alive)
{
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::OnPeriodicDeadOrAlive(id=%d, alive=%d)", id, alive);
{
CriticalSectionScoped cs(&_callbackCritSect);
if (!_connectionObserver)
return;
}
int32_t channel = VoEChannelId(id);
assert(channel == _channelId);
// Use Alive as default to limit risk of false Dead detections
bool isAlive(true);
// Always mark the connection as Dead when the module reports kRtpDead
if (kRtpDead == alive)
{
isAlive = false;
}
// It is possible that the connection is alive even if no RTP packet has
// been received for a long time since the other side might use VAD/DTX
// and a low SID-packet update rate.
if ((kRtpNoRtp == alive) && channel_state_.Get().playing)
{
// Detect Alive for all NetEQ states except for the case when we are
// in PLC_CNG state.
// PLC_CNG <=> background noise only due to long expand or error.
// Note that, the case where the other side stops sending during CNG
// state will be detected as Alive. Dead is is not set until after
// missing RTCP packets for at least twelve seconds (handled
// internally by the RTP/RTCP module).
isAlive = (_outputSpeechType != AudioFrame::kPLCCNG);
}
// Send callback to the registered observer
if (_connectionObserver)
{
CriticalSectionScoped cs(&_callbackCritSect);
if (_connectionObserverPtr)
{
_connectionObserverPtr->OnPeriodicDeadOrAlive(channel, isAlive);
}
}
}
int32_t int32_t
Channel::OnReceivedPayloadData(const uint8_t* payloadData, Channel::OnReceivedPayloadData(const uint8_t* payloadData,
uint16_t payloadSize, uint16_t payloadSize,
@ -862,7 +752,6 @@ Channel::Channel(int32_t channelId,
_rtpDumpOut(*RtpDump::CreateRtpDump()), _rtpDumpOut(*RtpDump::CreateRtpDump()),
_outputAudioLevel(), _outputAudioLevel(),
_externalTransport(false), _externalTransport(false),
_audioLevel_dBov(0),
_inputFilePlayerPtr(NULL), _inputFilePlayerPtr(NULL),
_outputFilePlayerPtr(NULL), _outputFilePlayerPtr(NULL),
_outputFileRecorderPtr(NULL), _outputFileRecorderPtr(NULL),
@ -902,7 +791,6 @@ Channel::Channel(int32_t channelId,
_oldVadDecision(-1), _oldVadDecision(-1),
_sendFrameType(0), _sendFrameType(0),
_rtcpObserverPtr(NULL), _rtcpObserverPtr(NULL),
_externalPlayout(false),
_externalMixing(false), _externalMixing(false),
_mixFileWithMicrophone(false), _mixFileWithMicrophone(false),
_rtcpObserver(false), _rtcpObserver(false),
@ -915,11 +803,6 @@ Channel::Channel(int32_t channelId,
_lastLocalTimeStamp(0), _lastLocalTimeStamp(0),
_lastPayloadType(0), _lastPayloadType(0),
_includeAudioLevelIndication(false), _includeAudioLevelIndication(false),
_rtpPacketTimedOut(false),
_rtpPacketTimeOutIsEnabled(false),
_rtpTimeOutSeconds(0),
_connectionObserver(false),
_connectionObserverPtr(NULL),
_outputSpeechType(AudioFrame::kNormalSpeech), _outputSpeechType(AudioFrame::kNormalSpeech),
vie_network_(NULL), vie_network_(NULL),
video_channel_(-1), video_channel_(-1),

View File

@ -351,83 +351,69 @@ public:
void SetVideoEngineBWETarget(ViENetwork* vie_network, int video_channel); void SetVideoEngineBWETarget(ViENetwork* vie_network, int video_channel);
// From AudioPacketizationCallback in the ACM // From AudioPacketizationCallback in the ACM
int32_t SendData(FrameType frameType, virtual int32_t SendData(
FrameType frameType,
uint8_t payloadType, uint8_t payloadType,
uint32_t timeStamp, uint32_t timeStamp,
const uint8_t* payloadData, const uint8_t* payloadData,
uint16_t payloadSize, uint16_t payloadSize,
const RTPFragmentationHeader* fragmentation); const RTPFragmentationHeader* fragmentation) OVERRIDE;
// From ACMVADCallback in the ACM // From ACMVADCallback in the ACM
int32_t InFrameType(int16_t frameType); virtual int32_t InFrameType(int16_t frameType) OVERRIDE;
int32_t OnRxVadDetected(int vadDecision); int32_t OnRxVadDetected(int vadDecision);
// From RtpData in the RTP/RTCP module // From RtpData in the RTP/RTCP module
int32_t OnReceivedPayloadData(const uint8_t* payloadData, virtual int32_t OnReceivedPayloadData(
const uint8_t* payloadData,
uint16_t payloadSize, uint16_t payloadSize,
const WebRtcRTPHeader* rtpHeader); const WebRtcRTPHeader* rtpHeader) OVERRIDE;
virtual bool OnRecoveredPacket(const uint8_t* packet,
bool OnRecoveredPacket(const uint8_t* packet, int packet_length); int packet_length) OVERRIDE;
// From RtpFeedback in the RTP/RTCP module // From RtpFeedback in the RTP/RTCP module
int32_t OnInitializeDecoder( virtual int32_t OnInitializeDecoder(
int32_t id, int32_t id,
int8_t payloadType, int8_t payloadType,
const char payloadName[RTP_PAYLOAD_NAME_SIZE], const char payloadName[RTP_PAYLOAD_NAME_SIZE],
int frequency, int frequency,
uint8_t channels, uint8_t channels,
uint32_t rate); uint32_t rate) OVERRIDE;
virtual void OnIncomingSSRCChanged(int32_t id,
void OnPacketTimeout(int32_t id); uint32_t ssrc) OVERRIDE;
virtual void OnIncomingCSRCChanged(int32_t id,
void OnReceivedPacket(int32_t id, RtpRtcpPacketType packetType); uint32_t CSRC, bool added) OVERRIDE;
virtual void ResetStatistics(uint32_t ssrc) OVERRIDE;
void OnPeriodicDeadOrAlive(int32_t id,
RTPAliveType alive);
void OnIncomingSSRCChanged(int32_t id,
uint32_t ssrc);
void OnIncomingCSRCChanged(int32_t id,
uint32_t CSRC, bool added);
void ResetStatistics(uint32_t ssrc);
// From RtcpFeedback in the RTP/RTCP module // From RtcpFeedback in the RTP/RTCP module
void OnApplicationDataReceived(int32_t id, virtual void OnApplicationDataReceived(int32_t id,
uint8_t subType, uint8_t subType,
uint32_t name, uint32_t name,
uint16_t length, uint16_t length,
const uint8_t* data); const uint8_t* data) OVERRIDE;
// From RtpAudioFeedback in the RTP/RTCP module // From RtpAudioFeedback in the RTP/RTCP module
void OnReceivedTelephoneEvent(int32_t id, virtual void OnPlayTelephoneEvent(int32_t id,
uint8_t event,
bool endOfEvent);
void OnPlayTelephoneEvent(int32_t id,
uint8_t event, uint8_t event,
uint16_t lengthMs, uint16_t lengthMs,
uint8_t volume); uint8_t volume) OVERRIDE;
// From Transport (called by the RTP/RTCP module) // From Transport (called by the RTP/RTCP module)
int SendPacket(int /*channel*/, const void *data, int len); virtual int SendPacket(int /*channel*/, const void *data, int len) OVERRIDE;
int SendRTCPPacket(int /*channel*/, const void *data, int len); virtual int SendRTCPPacket(int /*channel*/,
const void *data,
int len) OVERRIDE;
// From MixerParticipant // From MixerParticipant
int32_t GetAudioFrame(int32_t id, AudioFrame& audioFrame); virtual int32_t GetAudioFrame(int32_t id, AudioFrame& audioFrame) OVERRIDE;
int32_t NeededFrequency(int32_t id); virtual int32_t NeededFrequency(int32_t id) OVERRIDE;
// From MonitorObserver
void OnPeriodicProcess();
// From FileCallback // From FileCallback
void PlayNotification(int32_t id, virtual void PlayNotification(int32_t id, uint32_t durationMs) OVERRIDE;
uint32_t durationMs); virtual void RecordNotification(int32_t id, uint32_t durationMs) OVERRIDE;
void RecordNotification(int32_t id, virtual void PlayFileEnded(int32_t id) OVERRIDE;
uint32_t durationMs); virtual void RecordFileEnded(int32_t id) OVERRIDE;
void PlayFileEnded(int32_t id);
void RecordFileEnded(int32_t id);
uint32_t InstanceId() const uint32_t InstanceId() const
{ {
@ -530,7 +516,6 @@ private:
scoped_ptr<int16_t[]> mono_recording_audio_; scoped_ptr<int16_t[]> mono_recording_audio_;
// Downsamples to the codec rate if necessary. // Downsamples to the codec rate if necessary.
PushResampler<int16_t> input_resampler_; PushResampler<int16_t> input_resampler_;
uint8_t _audioLevel_dBov;
FilePlayer* _inputFilePlayerPtr; FilePlayer* _inputFilePlayerPtr;
FilePlayer* _outputFilePlayerPtr; FilePlayer* _outputFilePlayerPtr;
FileRecorder* _outputFileRecorderPtr; FileRecorder* _outputFileRecorderPtr;
@ -582,7 +567,6 @@ private:
int32_t _sendFrameType; // Send data is voice, 1-voice, 0-otherwise int32_t _sendFrameType; // Send data is voice, 1-voice, 0-otherwise
VoERTCPObserver* _rtcpObserverPtr; VoERTCPObserver* _rtcpObserverPtr;
// VoEBase // VoEBase
bool _externalPlayout;
bool _externalMixing; bool _externalMixing;
bool _mixFileWithMicrophone; bool _mixFileWithMicrophone;
bool _rtcpObserver; bool _rtcpObserver;
@ -599,11 +583,6 @@ private:
int8_t _lastPayloadType; int8_t _lastPayloadType;
bool _includeAudioLevelIndication; bool _includeAudioLevelIndication;
// VoENetwork // VoENetwork
bool _rtpPacketTimedOut;
bool _rtpPacketTimeOutIsEnabled;
uint32_t _rtpTimeOutSeconds;
bool _connectionObserver;
VoEConnectionObserver* _connectionObserverPtr;
AudioFrame::SpeechType _outputSpeechType; AudioFrame::SpeechType _outputSpeechType;
ViENetwork* vie_network_; ViENetwork* vie_network_;
int video_channel_; int video_channel_;

View File

@ -1,28 +0,0 @@
/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MOCK_VOE_CONNECTION_OBSERVER_H_
#define MOCK_VOE_CONNECTION_OBSERVER_H_
#include "webrtc/voice_engine/include/voe_network.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace webrtc {
class MockVoeConnectionObserver : public VoEConnectionObserver {
public:
MOCK_METHOD2(OnPeriodicDeadOrAlive, void(int channel,
bool alive));
};
}
#endif // MOCK_VOE_CONNECTION_OBSERVER_H_

View File

@ -40,19 +40,6 @@ namespace webrtc {
class VoiceEngine; class VoiceEngine;
// VoEConnectionObserver
class WEBRTC_DLLEXPORT VoEConnectionObserver
{
public:
// This method will be called peridically and deliver dead-or-alive
// notifications for a specified |channel| when the observer interface
// has been installed and activated.
virtual void OnPeriodicDeadOrAlive(int channel, bool alive) = 0;
protected:
virtual ~VoEConnectionObserver() {}
};
// VoENetwork // VoENetwork
class WEBRTC_DLLEXPORT VoENetwork class WEBRTC_DLLEXPORT VoENetwork
{ {

View File

@ -139,8 +139,8 @@ class my_transportation : public Transport
netw(network) { netw(network) {
} }
int SendPacket(int channel,const void *data,int len); virtual int SendPacket(int channel,const void *data,int len) OVERRIDE;
int SendRTCPPacket(int channel, const void *data, int len); virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE;
private: private:
VoENetwork * netw; VoENetwork * netw;
}; };

View File

@ -23,8 +23,10 @@ class FakeExternalTransport : public webrtc::Transport {
public: public:
explicit FakeExternalTransport(webrtc::VoENetwork* ptr); explicit FakeExternalTransport(webrtc::VoENetwork* ptr);
virtual ~FakeExternalTransport(); virtual ~FakeExternalTransport();
int SendPacket(int channel, const void *data, int len);
int SendRTCPPacket(int channel, const void *data, int len); virtual int SendPacket(int channel, const void *data, int len) OVERRIDE;
virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE;
void SetDelayStatus(bool enabled, unsigned int delayInMs = 100); void SetDelayStatus(bool enabled, unsigned int delayInMs = 100);
webrtc::VoENetwork* my_network_; webrtc::VoENetwork* my_network_;

View File

@ -35,12 +35,12 @@ class LoopBackTransport : public webrtc::Transport {
~LoopBackTransport() { thread_->Stop(); } ~LoopBackTransport() { thread_->Stop(); }
virtual int SendPacket(int channel, const void* data, int len) { virtual int SendPacket(int channel, const void* data, int len) OVERRIDE {
StorePacket(Packet::Rtp, channel, data, len); StorePacket(Packet::Rtp, channel, data, len);
return len; return len;
} }
virtual int SendRTCPPacket(int channel, const void* data, int len) { virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE {
StorePacket(Packet::Rtcp, channel, data, len); StorePacket(Packet::Rtcp, channel, data, len);
return len; return len;
} }

View File

@ -29,7 +29,7 @@ class ExtensionVerifyTransport : public webrtc::Transport {
audio_level_id_(-1), audio_level_id_(-1),
absolute_sender_time_id_(-1) {} absolute_sender_time_id_(-1) {}
virtual int SendPacket(int channel, const void* data, int len) { virtual int SendPacket(int channel, const void* data, int len) OVERRIDE {
webrtc::RTPHeader header; webrtc::RTPHeader header;
if (parser_->Parse(reinterpret_cast<const uint8_t*>(data), if (parser_->Parse(reinterpret_cast<const uint8_t*>(data),
static_cast<size_t>(len), static_cast<size_t>(len),
@ -54,7 +54,7 @@ class ExtensionVerifyTransport : public webrtc::Transport {
return len; return len;
} }
virtual int SendRTCPPacket(int channel, const void* data, int len) { virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE {
return len; return len;
} }
@ -93,12 +93,12 @@ class ExtensionVerifyTransport : public webrtc::Transport {
class SendRtpRtcpHeaderExtensionsTest : public BeforeStreamingFixture { class SendRtpRtcpHeaderExtensionsTest : public BeforeStreamingFixture {
protected: protected:
virtual void SetUp() { virtual void SetUp() OVERRIDE {
EXPECT_EQ(0, voe_network_->DeRegisterExternalTransport(channel_)); EXPECT_EQ(0, voe_network_->DeRegisterExternalTransport(channel_));
EXPECT_EQ(0, voe_network_->RegisterExternalTransport(channel_, EXPECT_EQ(0, voe_network_->RegisterExternalTransport(channel_,
verifying_transport_)); verifying_transport_));
} }
virtual void TearDown() { virtual void TearDown() OVERRIDE {
PausePlaying(); PausePlaying();
} }
@ -176,7 +176,7 @@ class MockViENetwork : public webrtc::ViENetwork {
class ReceiveRtpRtcpHeaderExtensionsTest : public BeforeStreamingFixture { class ReceiveRtpRtcpHeaderExtensionsTest : public BeforeStreamingFixture {
protected: protected:
virtual void SetUp() { virtual void SetUp() OVERRIDE {
EXPECT_EQ(0, EXPECT_EQ(0,
voe_rtp_rtcp_->SetSendAbsoluteSenderTimeStatus(channel_, true, 11)); voe_rtp_rtcp_->SetSendAbsoluteSenderTimeStatus(channel_, true, 11));
EXPECT_EQ(0, EXPECT_EQ(0,

View File

@ -53,28 +53,6 @@ char* TcharToChar(TCHAR* str, int len)
#endif #endif
} }
// ----------------------------------------------------------------------------
// VoEConnectionObserver
// ----------------------------------------------------------------------------
class ConnectionObserver : public VoEConnectionObserver
{
public:
ConnectionObserver();
virtual void OnPeriodicDeadOrAlive(int channel, bool alive);
};
ConnectionObserver::ConnectionObserver()
{
}
void ConnectionObserver::OnPeriodicDeadOrAlive(int channel, bool alive)
{
CString str;
str.Format(_T("OnPeriodicDeadOrAlive(channel=%d) => alive=%d"), channel, alive);
OutputDebugString(str);
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// VoiceEngineObserver // VoiceEngineObserver
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -151,8 +129,8 @@ class MyTransport : public Transport
{ {
public: public:
MyTransport(VoENetwork* veNetwork); MyTransport(VoENetwork* veNetwork);
virtual int SendPacket(int channel, const void *data, int len); virtual int SendPacket(int channel, const void *data, int len) OVERRIDE;
virtual int SendRTCPPacket(int channel, const void *data, int len); virtual int SendRTCPPacket(int channel, const void *data, int len) OVERRIDE;
private: private:
VoENetwork* _veNetworkPtr; VoENetwork* _veNetworkPtr;
}; };
@ -1115,7 +1093,6 @@ CWinTestDlg::CWinTestDlg(CWnd* pParent /*=NULL*/)
_veRtpRtcpPtr = VoERTP_RTCP::GetInterface(_vePtr); _veRtpRtcpPtr = VoERTP_RTCP::GetInterface(_vePtr);
_transportPtr = new MyTransport(_veNetworkPtr); _transportPtr = new MyTransport(_veNetworkPtr);
_externalMediaPtr = new MediaProcessImpl(); _externalMediaPtr = new MediaProcessImpl();
_connectionObserverPtr = new ConnectionObserver();
_rxVadObserverPtr = new RxCallback(); _rxVadObserverPtr = new RxCallback();
} }
@ -1131,7 +1108,6 @@ CWinTestDlg::CWinTestDlg(CWnd* pParent /*=NULL*/)
CWinTestDlg::~CWinTestDlg() CWinTestDlg::~CWinTestDlg()
{ {
if (_connectionObserverPtr) delete _connectionObserverPtr;
if (_externalMediaPtr) delete _externalMediaPtr; if (_externalMediaPtr) delete _externalMediaPtr;
if (_transportPtr) delete _transportPtr; if (_transportPtr) delete _transportPtr;
if (_rxVadObserverPtr) delete _rxVadObserverPtr; if (_rxVadObserverPtr) delete _rxVadObserverPtr;

View File

@ -96,7 +96,6 @@
#include "webrtc/voice_engine/include/voe_rtp_rtcp.h" #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
class MediaProcessImpl; class MediaProcessImpl;
class ConnectionObserver;
class RxCallback; class RxCallback;
class MyTransport; class MyTransport;
@ -161,7 +160,6 @@ private:
MyTransport* _transportPtr; MyTransport* _transportPtr;
MediaProcessImpl* _externalMediaPtr; MediaProcessImpl* _externalMediaPtr;
ConnectionObserver* _connectionObserverPtr;
RxCallback* _rxVadObserverPtr; RxCallback* _rxVadObserverPtr;
private: private: