00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
#ifndef MN_TFRCSEND_H
00026
#define MN_TFRCSEND_H
00027
00028
#include <sys/types.h>
00029
#include "var_type.h"
00030
#include "MNRTPNetTypes.h"
00031
#include "MNTimeval.h"
00032
#include "MNTimerCall.h"
00033
#include "lcrtp/MNLCRTPdefs.h"
00034
00035
#define M_INITRTT 0
00036
#define M_SLOWSTART 1
00037
#define M_NORMAL 2
00038
#define M_NO_INCREASE 3
00039
00040
00041 class MNTFRCSend
00042 {
00043
u_int32 _packets_sent;
00044
u_int32 _reports_recv;
00045
u_int32 _rtt_cur;
00046
u_int32 _round;
00047
int64 _start;
00048
int64 _end;
00049
int64 _rep_ts;
00050
int64 _adj_ts;
00051
int64 _delay;
00052
int64 _delay_diff;
00053
double _rtt;
00054
double _sqrt_rtt;
00055
double _b_rep;
00056
double _b_act;
00057
double _b_exp;
00058
double _min_bitrate;
00059
double _max_bitrate;
00060
double _max_increase;
00061
double _rate_delta;
00062
int _mode;
00063
int _force_n_mode;
00064
int _cbr;
00065
bool _nready;
00066
bool _first;
00067
Timeval _start_time;
00068
Timeval _old_time;
00069
MNTimer _timer;
00070
MNMutex _timer_mutex;
00071
00076
MNDebugMutex _lock;
00077
00078
TimerCall<MNTFRCSend> _cb;
00079
00080
static int _counter;
00081
int _local_counter;
00082
public:
00083
MNTFRCSend(
MNSelector& sel );
00084
virtual ~MNTFRCSend( );
00085
00086
int init(
double minb,
double maxb);
00087
u_int32 tfrc_prep(
rtp_hdr_ext_tfrc* packet,
00088
Timeval& next_playtime_packet );
00089
void feedback_received(
LCfeedb_tfrc_t* rep );
00090
private:
00091
void update_mode(
u_int32 b_exp );
00092
void update_bexp(
u_int32 b_exp );
00093
void set_timeout( );
00094
void init_time( );
00095
00096
00097
void prepare_packet(
rtp_hdr_ext_tfrc* packet);
00098
void prepare_packet(
MNRope*& packet);
00099
void not_sent( );
00100
void set_cbr(
int cbr );
00101
void wait();
00102
int get_cbr( );
00103
int64 get_time();
00104
00109
inline int64 get_time(
int64 buffered_get_time )
const {
00110
return buffered_get_time;
00111 }
00112
00114
virtual void timer_callback (
void* ref_data,
TimerCallBase* ptr );
00115 };
00116
00117
#endif