|
|
"use strict";var G726Session=function(a){function b(){e=new G726xAudioDecoder(f),this.firstTime=0,this.lastMSW=0}var c=0,d=0,e=null,f=a,g={seconds:null,useconds:null};return b.prototype={parseRTPData:function(a,b,h){var i=b[22],j=b.subarray(24+i,b.length-8);c=(b[21]<<8)+b[20];var k=(b[19]<<24)+(b[18]<<16)+(b[17]<<8)+b[16]>>>0,l=Date.UTC("20"+(k>>26),(k>>22&15)-1,k>>17&31,k>>12&31,k>>6&63,63&k)/1e3;if(l-=28800,0==this.firstTime)this.firstTime=l,this.lastMSW=0,d=(b[21]<<8)+b[20],g.seconds=l,g.useconds=0;else{var m,n=(b[21]<<8)+b[20];m=n>d?n-d:n+65535-d,this.lastMSW+=m,l>this.firstTime&&(this.lastMSW-=1e3),this.firstTime=l,g.seconds=l,g.useconds=this.lastMSW,d=n}for(var o=e.decode(j),p=new Float32Array(o.length),q=0;q<o.length;q++)p[q]=o[q]/Math.pow(2,15);var r={codec:"G726",bufferData:p,rtpTimeStamp:1e3*g.seconds+g.useconds};return h===!0&&(r.bitrate=f,r.streamData=j),r},setCodecInfo:function(){debug.log("Set codec info. for G726")}},new b};
|