Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MNLCRTPdefs.h

Go to the documentation of this file.
00001 /* Copyright (C) 2000 KOM/Darmstadt University of Technology 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef MNLCRTPDEFS_H 00025 #define MNLCRTPDEFS_H 00026 00027 /* MNLCRTPdefs.h 00028 * standard LCRTP definitions 00029 */ 00030 00031 #include <stdlib.h> 00032 #include <unistd.h> 00033 #include <sys/time.h> 00034 00035 #include "mnstream.h" 00036 #include "var_type.h" 00037 #include "MNMsg.h" 00038 #include "MNRTPutildefs.h" 00039 #include "MNLCRTPRangeList.h" 00040 00041 /* LCRTP defs */ 00042 enum LCState_t 00043 { 00044 LC_NORMAL = 1, 00045 LC_RERECORDING = 2, 00046 LC_RESENDING = 3 00047 }; 00048 00049 #define LC_REPEAT_TIMEOUTS 10 00050 00051 struct lcstreamer_send_t : public streamer_send_t 00052 { 00053 MNLCRTPRangeList* rangeList; 00054 LossRange_t* actual_range; 00055 LCState_t lcstate; 00056 int timeout_counter; 00057 bool fragment; 00058 struct timeval last_codec_timeout; 00059 u_int64 report_bytes_lost; 00060 00061 lcstreamer_send_t() 00062 { 00063 rangeList = NULL; 00064 lcstate = LC_NORMAL; 00065 timeout_counter = 0; 00066 fragment = false; 00067 actual_range = NULL; 00068 last_codec_timeout.tv_sec = 0; 00069 last_codec_timeout.tv_usec = 0; 00070 report_bytes_lost=0; 00071 } 00072 00073 virtual ~lcstreamer_send_t() 00074 { 00075 if (rangeList != NULL) delete rangeList; 00076 } 00077 }; 00078 00079 class lcstreamer_recv_t : public streamer_recv_t 00080 { 00081 bool _lc_received; 00082 u_int64 _last_bytecount_and_data; 00083 LCState_t _lcstate; 00084 u_int32 _timeout_counter; 00085 00091 bool _getting_resend_data; 00092 u_int64 _last_losslist_send_range; 00093 00094 public: 00095 lcstreamer_recv_t( MediaState mstate ) 00096 : streamer_recv_t( mstate ) 00097 , _lc_received( false ) 00098 , _last_bytecount_and_data( 0 ) 00099 , _lcstate( LC_NORMAL ) 00100 , _timeout_counter( 0 ) 00101 , _getting_resend_data( false ) 00102 , _last_losslist_send_range( 0 ) 00103 { 00104 } 00105 00106 virtual ~lcstreamer_recv_t() {}; 00107 00108 inline bool getLCReceived( ) const { 00109 return _lc_received; 00110 } 00111 00112 inline void setLCReceived( bool v ) { 00113 _lc_received = v; 00114 } 00115 00116 inline LCState_t getLCState( ) const { 00117 return _lcstate; 00118 } 00119 00120 inline void setLCState( LCState_t l ) { 00121 _lcstate = l; 00122 } 00123 00124 inline u_int64 get_last_bytecount_and_data( ) const { 00125 return _last_bytecount_and_data; 00126 } 00127 00128 inline void set_last_bytecount_and_data( u_int64 v ) { 00129 _last_bytecount_and_data = v; 00130 } 00131 00132 inline void incLCTimeoutCounter( ) { 00133 _timeout_counter += 1; 00134 } 00135 00136 inline u_int32 getLCTimeoutCounter( ) const { 00137 return _timeout_counter; 00138 } 00139 00140 inline void setGettingResendData( ) { 00141 _getting_resend_data = true; 00142 } 00143 00144 inline bool getGettingResendData( ) const { 00145 return _getting_resend_data; 00146 } 00147 00148 inline void clearLastLosslistSendRange( ) { 00149 _last_losslist_send_range = 0; 00150 } 00151 00152 inline void setLastLosslistSendRange( u_int64 byte ) { 00153 _last_losslist_send_range = byte; 00154 } 00155 00156 inline u_int64 getLastLosslistSendRange( ) { 00157 return _last_losslist_send_range; 00158 } 00159 00160 inline void startLCRecording( u_int64 bytecount ) { 00161 _getting_resend_data = false; 00162 _last_losslist_send_range = 0; 00163 _last_bytecount_and_data = bytecount; 00164 _lcstate = LC_RERECORDING; 00165 _timeout_counter = 0; 00166 } 00167 }; 00168 00169 /* RTCP app types */ 00170 #define LCEND_TYPE 1 00171 #define LCLISTFRAG_TYPE 2 /* We now distinguish between fragments of a losslist */ 00172 #define LCLISTLAST_TYPE 3 /* and the last element of the losslist */ 00173 #define LCTFRC_TYPE 4 /* Experimental for TFRC support - MZ */ 00174 00175 #define LCSEND_SIZE 2 00176 struct LCsend_t 00177 { 00178 u_int64 bytecount; 00179 }; 00180 00181 #define LCEND_SIZE 2 00182 #define LCEND_TIMEOUT 3 00183 struct LCend_t 00184 { 00185 u_int64 bytecount; 00186 }; 00187 00188 struct LCLossList_item_t 00189 { 00190 u_int64 begin_range; 00191 u_int64 end_range; 00192 }; 00193 00194 #define LCLIST_TIMEOUT 1 00195 struct LCsend_list_t 00196 { 00197 u_int32 ssrc; 00198 LCLossList_item_t lossList_item[1]; 00199 }; 00200 00201 /* Experimental for TFRC - MZ */ 00202 struct LCfeedb_tfrc_t 00203 { 00204 u_int32 ssrc; 00205 u_int32 seqnum; 00206 u_int32 timestamp; 00207 u_int32 b_rep; 00208 u_int32 b_exp; 00209 }; 00210 00211 /* X sending types */ 00212 #define LCRTP_TYPE 242 /* just a number */ 00213 #define TFRCRTP_TYPE 243 /* Experimental for TFRC - MZ */ 00214 #define LCRTP_RESEND 211 /* just an other number */ 00215 #define TFRCRTP_RESEND 212 /* Experimental for TFRC - MZ */ 00216 00217 /* Errors */ 00218 #define LCRTP_LOSSLIST_TIMEOUT -200 00219 #define LCRTP_LOSSLIST_NOTRECORDING -201 00220 #define LCRTP_RESEND_TIMEOUT -202 00221 #define LCRTP_LOSSLIST_OK -203 00222 #define LCRTP_LOSSLIST_NO_SSRC -204 00223 #define LCRTP_LOSSLIST_NO_BUILT -205 00224 #define LCRTP_LOSSLIST_TOO_LONG -206 00225 00226 #endif 00227

Generated on Sun Mar 6 13:35:49 2005 for Komssys by doxygen 1.3.8