| 1 | package cz.vutbr.feec.session.rtprtcp.internal; |
| 2 | |
| 3 | /** |
| 4 | * The Class SourceExt. |
| 5 | */ |
| 6 | public class SourceExt { |
| 7 | |
| 8 | /** The ssrc. */ |
| 9 | long ssrc; |
| 10 | |
| 11 | /** The rtp_ip. */ |
| 12 | int rtp_ip; |
| 13 | |
| 14 | /** The rtp_port. */ |
| 15 | int rtp_port; |
| 16 | |
| 17 | /** The rtcp_ip. */ |
| 18 | int rtcp_ip; |
| 19 | |
| 20 | /** The rtcp_port. */ |
| 21 | int rtcp_port; |
| 22 | |
| 23 | // boolean we_sent; |
| 24 | /** The is sender. */ |
| 25 | private boolean isSender = false; |
| 26 | |
| 27 | /** The bye requested. */ |
| 28 | public boolean byeRequested = false; |
| 29 | |
| 30 | /** The DLSR. */ |
| 31 | public double DLSR; |
| 32 | |
| 33 | // RTCP |
| 34 | /** The time of last RTCP arrival. */ |
| 35 | public long timeOfLastRTCPArrival; |
| 36 | |
| 37 | /** The time of last RTCP sent. */ |
| 38 | public long timeOfLastRTCPSent; |
| 39 | // RTP |
| 40 | /** The time of last RTP arrival. */ |
| 41 | public long timeOfLastRTPArrival; |
| 42 | |
| 43 | /** The time of last RTP sent. */ |
| 44 | public long timeOfLastRTPSent; |
| 45 | |
| 46 | // SR |
| 47 | /** The time of last SR arrival. */ |
| 48 | public long timeOfLastSRArrival; /* time of the last sender report */ |
| 49 | |
| 50 | /** The time of last SR sent. */ |
| 51 | public long timeOfLastSRSent; /* time of the last sender report */ |
| 52 | |
| 53 | /** The BYE. */ |
| 54 | public String BYE = ""; |
| 55 | |
| 56 | /** The CNAME. */ |
| 57 | public String CNAME = ""; |
| 58 | |
| 59 | /** The NAME. */ |
| 60 | public String NAME= ""; |
| 61 | |
| 62 | /** The EMAIL. */ |
| 63 | public String EMAIL= ""; |
| 64 | |
| 65 | /** The PHONE. */ |
| 66 | public String PHONE= ""; |
| 67 | |
| 68 | /** The LOC. */ |
| 69 | public String LOC= ""; |
| 70 | |
| 71 | /** The TOOL. */ |
| 72 | public String TOOL= ""; |
| 73 | |
| 74 | /** The NOTE. */ |
| 75 | public String NOTE= ""; |
| 76 | |
| 77 | /** The PRIV. */ |
| 78 | public String PRIV= ""; |
| 79 | |
| 80 | /** |
| 81 | * Checks if is validated. |
| 82 | * |
| 83 | * @return true, if is validated |
| 84 | */ |
| 85 | protected boolean isValidated() { |
| 86 | return probation == 0; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Sets the validated. |
| 91 | * |
| 92 | * @param value the validated |
| 93 | */ |
| 94 | protected void setValidated(boolean value) { |
| 95 | if(value){ |
| 96 | this.probation = 0; |
| 97 | } else { |
| 98 | this.probation = Source.MIN_SEQUENTIAL; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | // private members |
| 103 | /** The m_timeout. */ |
| 104 | int m_timeout; |
| 105 | |
| 106 | /** The s_timeout. */ |
| 107 | int s_timeout; |
| 108 | |
| 109 | /** The ignore. */ |
| 110 | boolean ignore; |
| 111 | |
| 112 | /** The probation. */ |
| 113 | int probation; |
| 114 | |
| 115 | /** |
| 116 | * Gets the SSRC. |
| 117 | * |
| 118 | * @return the SSRC |
| 119 | */ |
| 120 | public long getSSRC() { |
| 121 | return ssrc; |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * This value is updated on every RTCP transmission. |
| 126 | * |
| 127 | * @return true if last sent RTP packet has been sent in interval of 2*T |
| 128 | */ |
| 129 | public boolean isSender(){ |
| 130 | return isSender; |
| 131 | // return timeOfLastRTPArrival + 2*T >= System.currentTimeMillis(); |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * Sets the sender. |
| 136 | * |
| 137 | * @param isSender the sender |
| 138 | */ |
| 139 | public void setSender(boolean isSender) { |
| 140 | this.isSender = isSender; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * Sets the SSRC. |
| 145 | * |
| 146 | * @param ssrc the SSRC |
| 147 | */ |
| 148 | public void setSSRC(long ssrc) { |
| 149 | this.ssrc = ssrc; |
| 150 | } |
| 151 | } |