blob: 46a1448fcdd799d3810dd055f33f53a5f91b6622 [file] [log] [blame]
/*
* Copyright (c) 2011 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.
*/
//
// tb_external_transport.h
//
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_EXTERNAL_TRANSPORT_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_EXTERNAL_TRANSPORT_H_
#include <list>
#include "common_types.h"
namespace webrtc
{
class CriticalSectionWrapper;
class EventWrapper;
class ThreadWrapper;
class ViENetwork;
}
class TbExternalTransport: public webrtc::Transport
{
public:
TbExternalTransport(webrtc::ViENetwork& vieNetwork);
~TbExternalTransport(void);
virtual int SendPacket(int channel, const void *data, int len);
virtual int SendRTCPPacket(int channel, const void *data, int len);
WebRtc_Word32 SetPacketLoss(WebRtc_Word32 lossRate); // Rate in %
void SetNetworkDelay(WebRtc_Word64 delayMs);
void SetSSRCFilter(WebRtc_UWord32 SSRC);
void ClearStats();
void GetStats(WebRtc_Word32& numRtpPackets,
WebRtc_Word32& numDroppedPackets,
WebRtc_Word32& numRtcpPackets);
void SetTemporalToggle(unsigned char layers);
void EnableSSRCCheck();
unsigned int ReceivedSSRC();
void EnableSequenceNumberCheck();
unsigned short GetFirstSequenceNumber();
protected:
static bool ViEExternalTransportRun(void* object);
bool ViEExternalTransportProcess();
private:
WebRtc_Word64 NowMs();
enum
{
KMaxPacketSize = 1650
};
enum
{
KMaxWaitTimeMs = 100
};
typedef struct
{
WebRtc_Word8 packetBuffer[KMaxPacketSize];
WebRtc_Word32 length;
WebRtc_Word32 channel;
WebRtc_Word64 receiveTime;
} VideoPacket;
webrtc::ViENetwork& _vieNetwork;
webrtc::ThreadWrapper& _thread;
webrtc::EventWrapper& _event;
webrtc::CriticalSectionWrapper& _crit;
webrtc::CriticalSectionWrapper& _statCrit;
WebRtc_Word32 _lossRate;
WebRtc_Word64 _networkDelayMs;
WebRtc_Word32 _rtpCount;
WebRtc_Word32 _rtcpCount;
WebRtc_Word32 _dropCount;
std::list<VideoPacket*> _rtpPackets;
std::list<VideoPacket*> _rtcpPackets;
unsigned char _temporalLayers;
unsigned short _seqNum;
unsigned short _sendPID;
unsigned char _receivedPID;
bool _switchLayer;
unsigned char _currentRelayLayer;
unsigned int _lastTimeMs;
bool _checkSSRC;
WebRtc_UWord32 _lastSSRC;
bool _filterSSRC;
WebRtc_UWord32 _SSRC;
bool _checkSequenceNumber;
WebRtc_UWord16 _firstSequenceNumber;
};
#endif // WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_EXTERNAL_TRANSPORT_H_