<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="generator" content="pdf2htmlEX">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css">
<link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css">
<link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/622b7c883d2fbb00075a52d3/raw.css">
<script src="https://static.pudn.com/base/js/compatibility.min.js"></script>
<script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script>
<script>
try{
pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({});
}catch(e){}
</script>
<title></title>
</head>
<body>
<div id="sidebar" style="display: none">
<div id="outline">
</div>
</div>
<div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/622b7c883d2fbb00075a52d3/bg1.jpg"><div class="c x0 y1 w2 h2"><div class="t m0 x1 h3 y2 ff1 fs0 fc0 sc0 ls0 ws0">package<span class="ff2 fc1"> video.rtp.test;</span></div><div class="t m0 x1 h3 y3 ff1 fs0 fc0 sc0 ls0 ws0">public<span class="ff2 fc1"> </span>class<span class="ff2 fc1"> RtpPacket {</span></div><div class="t m0 x1 h4 y4 ff2 fs0 fc2 sc0 ls0 ws0">// RTP packet buffer containing both the RTP he<span class="_ _0"></span>ader and </div><div class="t m0 x1 h4 y5 ff2 fs0 fc2 sc0 ls0 ws0">payload</div><div class="t m0 x2 h3 y6 ff1 fs0 fc0 sc0 ls0 ws0">byte<span class="ff2 fc1">[] <span class="fc3">packet</span>;</span></div><div class="t m0 x2 h4 y7 ff2 fs0 fc2 sc0 ls0 ws0">/* RTP packet length */</div><div class="t m0 x2 h3 y8 ff1 fs0 fc0 sc0 ls0 ws0">int<span class="ff2 fc1"> <span class="fc3">packet_len</span>;</span></div><div class="t m0 x2 h4 y9 ff2 fs0 fc4 sc0 ls0 ws0">/** Creates a new RTP packe<span class="_ _0"></span>t */</div><div class="t m0 x2 h3 ya ff1 fs0 fc0 sc0 ls0 ws0">public<span class="ff2 fc1"> RtpPacket(</span>byte<span class="ff2 fc1">[] buffer, </span>int<span class="ff2 fc1"> packet_length) {</span></div><div class="t m0 x3 h4 yb ff2 fs0 fc3 sc0 ls0 ws0">packet<span class="fc1"> = buffer;</span></div><div class="t m0 x3 h4 yc ff2 fs0 fc3 sc0 ls0 ws0">packet_len<span class="fc1"> = packet_length;</span></div><div class="t m0 x3 h3 yd ff1 fs0 fc0 sc0 ls0 ws0">if<span class="ff2 fc1"> (<span class="fc3">packet_len</span> < 12)</span></div><div class="t m0 x4 h4 ye ff2 fs0 fc3 sc0 ls0 ws0">packet_len<span class="fc1"> = 12;</span></div><div class="t m0 x3 h4 yf ff2 fs0 fc1 sc0 ls0 ws0">init(0x0F);</div><div class="t m0 x2 h4 y10 ff2 fs0 fc1 sc0 ls0 ws0">}</div><div class="t m0 x2 h4 y11 ff2 fs0 fc2 sc0 ls0 ws0">/* RTP header length */</div><div class="t m0 x2 h4 y12 ff2 fs0 fc2 sc0 ls0 ws0">// int header_len;</div><div class="t m0 x2 h4 y13 ff2 fs0 fc4 sc0 ls0 ws0">/** Gets the RTP packet */</div><div class="t m0 x2 h3 y14 ff1 fs0 fc0 sc0 ls0 ws0">public<span class="ff2 fc1"> </span>byte<span class="ff2 fc1">[] getPacket() {</span></div><div class="t m0 x3 h3 y15 ff1 fs0 fc0 sc0 ls0 ws0">return<span class="ff2 fc1"> <span class="fc3">packet</span>; }</span></div><div class="t m0 x2 h4 y16 ff2 fs0 fc4 sc0 ls0 ws0">/** Gets the RTP packet len<span class="_ _0"></span>gth */</div><div class="t m0 x2 h3 y17 ff1 fs0 fc0 sc0 ls0 ws0">public<span class="ff2 fc1"> </span>int<span class="ff2 fc1"> getLength() {</span></div><div class="t m0 x3 h3 y18 ff1 fs0 fc0 sc0 ls0 ws0">return<span class="ff2 fc1"> <span class="fc3">packet_len</span>;<span class="_ _1"> </span>}</span></div><div class="t m0 x2 h4 y19 ff2 fs0 fc4 sc0 ls0 ws0">/** Gets the RTP header len<span class="_ _0"></span>gth */</div><div class="t m0 x2 h3 y1a ff1 fs0 fc0 sc0 ls0 ws0">public<span class="ff2 fc1"> </span>int<span class="ff2 fc1"> getHeaderLength() {</span></div></div></div><div class="pi" data-data='{"ctm":[1.611850,0.000000,0.000000,1.611850,0.000000,0.000000]}'></div></div>
</body>
</html>
<div id="pf2" class="pf w0 h0" data-page-no="2"><div class="pc pc2 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/622b7c883d2fbb00075a52d3/bg2.jpg"><div class="c x0 y1 w2 h2"><div class="t m0 x3 h3 y2 ff1 fs0 fc0 sc0 ls0 ws0">if<span class="ff2 fc1"> (<span class="fc3">packet_len</span> >= 12)</span></div><div class="t m0 x4 h3 y3 ff1 fs0 fc0 sc0 ls0 ws0">return<span class="ff2 fc1"> 12 + 4 * getCscrCount(<span class="_ _0"></span>);</span></div><div class="t m0 x3 h3 y4 ff1 fs0 fc0 sc0 ls0 ws0">else</div><div class="t m0 x4 h3 y5 ff1 fs0 fc0 sc0 ls0 ws0">return<span class="ff2 fc1"> <span class="fc3">packet_len</span>; <span class="fc2">// broken packet</span></span></div><div class="t m0 x2 h4 y6 ff2 fs0 fc1 sc0 ls0 ws0">}</div><div class="t m0 x2 h4 y7 ff2 fs0 fc4 sc0 ls0 ws0">/** Gets the RTP header len<span class="_ _0"></span>gth */</div><div class="t m0 x2 h3 y8 ff1 fs0 fc0 sc0 ls0 ws0">public<span class="ff2 fc1"> </span>int<span class="ff2 fc1"> getPayloadLength() {</span></div><div class="t m0 x3 h3 y9 ff1 fs0 fc0 sc0 ls0 ws0">if<span class="ff2 fc1"> (<span class="fc3">packet_len</span> >= 12)</span></div><div class="t m0 x4 h3 ya ff1 fs0 fc0 sc0 ls0 ws0">return<span class="ff2 fc1"> <span class="fc3">packet_len</span> - getHeaderLength(<span class="_ _0"></span>);</span></div><div class="t m0 x3 h3 yb ff1 fs0 fc0 sc0 ls0 ws0">else</div><div class="t m0 x4 h3 yc ff1 fs0 fc0 sc0 ls0 ws0">return<span class="ff2 fc1"> 0; <span class="fc2">// broken packet</span></span></div><div class="t m0 x2 h4 yd ff2 fs0 fc1 sc0 ls0 ws0">}</div><div class="t m0 x2 h4 ye ff2 fs0 fc4 sc0 ls0 ws0">/** Sets the RTP payload length */</div><div class="t m0 x2 h3 yf ff1 fs0 fc0 sc0 ls0 ws0">public<span class="ff2 fc1"> </span>void<span class="ff2 fc1"> setPayloadLength(</span>int<span class="ff2 fc1"> len) {</span></div><div class="t m0 x3 h4 y10 ff2 fs0 fc3 sc0 ls0 ws0">packet_len<span class="fc1"> = getHeaderLength(<span class="_ _0"></span>) + len;</span></div><div class="t m0 x2 h4 y11 ff2 fs0 fc1 sc0 ls0 ws0">}</div><div class="t m0 x2 h4 y12 ff2 fs0 fc4 sc0 ls0 ws0">/** Gets the version (V) */</div><div class="t m0 x2 h3 y13 ff1 fs0 fc0 sc0 ls0 ws0">public<span class="ff2 fc1"> </span>int<span class="ff2 fc1"> getVersion() {</span></div><div class="t m0 x3 h3 y14 ff1 fs0 fc0 sc0 ls0 ws0">if<span class="ff2 fc1"> (<span class="fc3">packet_len</span> >= 12)</span></div><div class="t m0 x4 h3 y15 ff1 fs0 fc0 sc0 ls0 ws0">return<span class="ff2 fc1"> (<span class="fc3">packet</span>[0] >> 6 & 0x03);</span></div><div class="t m0 x3 h3 y16 ff1 fs0 fc0 sc0 ls0 ws0">else</div><div class="t m0 x4 h3 y17 ff1 fs0 fc0 sc0 ls0 ws0">return<span class="ff2 fc1"> 0; <span class="fc2">// broken packet</span></span></div><div class="t m0 x2 h4 y18 ff2 fs0 fc1 sc0 ls0 ws0">}</div><div class="t m0 x2 h4 y19 ff2 fs0 fc4 sc0 ls0 ws0">/** Sets the version (V) */</div><div class="t m0 x2 h3 y1a ff1 fs0 fc0 sc0 ls0 ws0">public<span class="ff2 fc1"> </span>void<span class="ff2 fc1"> setVersion(</span>int<span class="ff2 fc1"> v) {</span></div></div></div><div class="pi" data-data='{"ctm":[1.611850,0.000000,0.000000,1.611850,0.000000,0.000000]}'></div></div>
<div id="pf3" class="pf w0 h0" data-page-no="3"><div class="pc pc3 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/622b7c883d2fbb00075a52d3/bg3.jpg"><div class="c x0 y1 w2 h2"><div class="t m0 x3 h3 y2 ff1 fs0 fc0 sc0 ls0 ws0">if<span class="ff2 fc1"> (<span class="fc3">packet_len</span> >= 12)</span></div><div class="t m0 x4 h3 y3 ff2 fs0 fc3 sc0 ls0 ws0">packet<span class="fc1">[0] = (<span class="ff1 fc0">byte</span>) ((</span>packet<span class="fc1">[0] & 0x3F) | ((v & 0x<span class="_ _0"></span>03) </span></div><div class="t m0 x1 h4 y4 ff2 fs0 fc1 sc0 ls0 ws0"><< 6));</div><div class="t m0 x2 h4 y5 ff2 fs0 fc1 sc0 ls0 ws0">}</div><div class="t m0 x2 h4 y6 ff2 fs0 fc4 sc0 ls0 ws0">/** Whether has paddi<span class="_ _0"></span>ng (P) */</div><div class="t m0 x2 h3 y7 ff1 fs0 fc0 sc0 ls0 ws0">public<span class="ff2 fc1"> </span>boolean<span class="ff2 fc1"> hasPadding() {</span></div><div class="t m0 x3 h3 y8 ff1 fs0 fc0 sc0 ls0 ws0">if<span class="ff2 fc1"> (<span class="fc3">packet_len</span> >= 12)</span></div><div class="t m0 x4 h3 y9 ff1 fs0 fc0 sc0 ls0 ws0">return<span class="ff2 fc1"> <span class="ff3">getBit</span>(<span class="fc3">packet</span>[0], 5);</span></div><div class="t m0 x3 h3 ya ff1 fs0 fc0 sc0 ls0 ws0">else</div><div class="t m0 x4 h3 yb ff1 fs0 fc0 sc0 ls0 ws0">return<span class="ff2 fc1"> </span>false<span class="ff2 fc1">; <span class="fc2">// broken packet</span></span></div><div class="t m0 x2 h4 yc ff2 fs0 fc1 sc0 ls0 ws0">}</div><div class="t m0 x2 h4 yd ff2 fs0 fc4 sc0 ls0 ws0">/** Set padding (P) */</div><div class="t m0 x2 h3 ye ff1 fs0 fc0 sc0 ls0 ws0">public<span class="ff2 fc1"> </span>void<span class="ff2 fc1"> setPadding(</span>boolean<span class="ff2 fc1"> p) {</span></div><div class="t m0 x3 h3 yf ff1 fs0 fc0 sc0 ls0 ws0">if<span class="ff2 fc1"> (<span class="fc3">packet_len</span> >= 12)</span></div><div class="t m0 x4 h4 y10 ff2 fs0 fc3 sc0 ls0 ws0">packet<span class="fc1">[0] = <span class="ff3">setBit</span>(p, </span>packet<span class="fc1">[0], 5);</span></div><div class="t m0 x2 h4 y11 ff2 fs0 fc1 sc0 ls0 ws0">}</div><div class="t m0 x2 h4 y12 ff2 fs0 fc4 sc0 ls0 ws0">/** Whether has exten<span class="_ _0"></span>sion (X) */</div><div class="t m0 x2 h3 y13 ff1 fs0 fc0 sc0 ls0 ws0">public<span class="ff2 fc1"> </span>boolean<span class="ff2 fc1"> hasExtension() {</span></div><div class="t m0 x3 h3 y14 ff1 fs0 fc0 sc0 ls0 ws0">if<span class="ff2 fc1"> (<span class="fc3">packet_len</span> >= 12)</span></div><div class="t m0 x4 h3 y15 ff1 fs0 fc0 sc0 ls0 ws0">return<span class="ff2 fc1"> <span class="ff3">getBit</span>(<span class="fc3">packet</span>[0], 4);</span></div><div class="t m0 x3 h3 y16 ff1 fs0 fc0 sc0 ls0 ws0">else</div><div class="t m0 x4 h3 y17 ff1 fs0 fc0 sc0 ls0 ws0">return<span class="ff2 fc1"> </span>false<span class="ff2 fc1">; <span class="fc2">// broken packet</span></span></div><div class="t m0 x2 h4 y18 ff2 fs0 fc1 sc0 ls0 ws0">}</div><div class="t m0 x2 h4 y19 ff2 fs0 fc4 sc0 ls0 ws0">/** Set extension (X) */</div><div class="t m0 x2 h3 y1a ff1 fs0 fc0 sc0 ls0 ws0">public<span class="ff2 fc1"> </span>void<span class="ff2 fc1"> setExtension(</span>boolean<span class="ff2 fc1"> x) {</span></div></div></div><div class="pi" data-data='{"ctm":[1.611850,0.000000,0.000000,1.611850,0.000000,0.000000]}'></div></div>