00001
#include "RetransRecvCommon.h"
00002
#include "sh/SH.h"
00003
#include "MNTimerCall.h"
00004
#include "lcrtp/MNLCRTPLossList.h"
00005
#include "sh/MNRTPDecoderSH.h"
00006
00007
namespace SH
00008 {
00009
00010 class LossList :
public RetransRecvCommon
00011 {
00012
class TL :
public TimerCall<LossList>
00013 {
00014
u_int32 _ssrc;
00015
public:
00016 TL(
u_int32 ssrc,
00017
LossList* t,
00018
TimerCall<LossList>::callback cb )
00019 :
TimerCall<LossList>( TimerCallBase::DontClean, t, cb )
00020 , _ssrc( ssrc )
00021 {
00022 }
00023
inline u_int32 getSsrc( )
const {
00024
return _ssrc;
00025 }
00026
00027
inline void setSsrc(
u_int32 s ) {
00028 _ssrc = s;
00029 }
00030 };
00031
00033
bool _isStreaming;
00034
00035
RTPDecoderSH& _pushReportInterface;
00036
MNMutex _mutex;
00037
public:
00038 MNTimer _timer;
00039 MNTimer _timeout_timer;
00040 MNLCRTPLossList*
_l;
00041 TL
_cb;
00042 TL
_timer_call;
00043 int32 _list_timeout;
00044 u_int32 _repeat_timeouts;
00045 lcstreamer_recv_t _StreamDesc;
00046 bool _first_time;
00047
public:
00048
LossList(
RTPDecoderSH* caller,
MNSelector& sel );
00049
virtual ~LossList( );
00054
void init(
int32 list_timeout,
u_int32 repeat_timeouts );
00055
void uninit( );
00056
00057 inline void startStreaming( ) {
00058 _isStreaming =
true;
00059 }
00060
00061 inline void stopStreaming( ) {
00062
_timer.
terminate_timer( );
00063 _isStreaming =
false;
00064 }
00070
void init_timeout(
struct timeval& lossList_timeout );
00075
void insert_rel_timeout_timer(
bool inCallback );
00086
void insert_lc_gap(
u_int32 ssrc,
00087
u_int64 from,
00088
u_int64 to );
00106
bool schedule_send_list(
u_int32 ssrc,
00107
bool inCallback );
00116
void schedule_retrans_timer(
bool inCallback );
00125
void schedule_transtrans_timer_again(
bool inCallback );
00126 inline void lock( ) {
00127 _mutex.
lock( );
00128 }
00129
00130 inline void unlock( ) {
00131 _mutex.
unlock( );
00132 }
00148
bool process_lc_packet(
u_int32 ssrc,
00149
u_int64 bytecount,
00150
int32 rd_len );
00155
int64 sendLossList( );
00156
void evalLCRTCPPacket(
u_int32 ssrc,
00157
void* data,
00158
int len,
00159
int subtype,
00160
char* name,
00161
bool inCallback );
00162
DataPtr evalLCRTPPacket(
MNRTPPacketPtr packet,
00163
MNRope*& payload,
00164 u_int64_t& bytecount );
00165
private:
00166
void timer_callback(
void* ref_data,
TimerCallBase* ptr );
00167
void timeout_callback(
void* ref_data,
TimerCallBase* ptr );
00168
00170
inline bool isStreaming( )
const {
00171
return _isStreaming;
00172 }
00173
private:
00175
LossList(
const LossList& );
00177 LossList& operator=(
const LossList& );
00178 };
00179
00180 };