{"size": 2300, "ext": "js", "max_stars_repo_path": "src/views/static/audioWorker.js", "max_stars_repo_name": "wangyongxiang0330/monitor-lc-ys", "max_stars_repo_stars_event_min_datetime": "2020-04-09T09:11:28.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-30T07:12:17.000Z", "max_issues_repo_path": "static/audioWorker.js", "max_issues_repo_name": "1x997/monitor-lc-ys", "max_issues_repo_issues_event_min_datetime": "2021-01-05T23:58:13.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-17T09:36:55.000Z", "max_forks_repo_path": "static/audioWorker.js", "max_forks_repo_name": "1x997/monitor-lc-ys", "max_forks_repo_forks_event_min_datetime": "2020-04-25T16:47:54.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-02T07:04:16.000Z"}
{"max_stars_count": 6, "max_issues_count": 2, "max_forks_count": 4, "avg_line_length": 39.6551724138, "max_line_length": 202, "alphanum_fraction": 0.5534782609}
"use strict";

function receiveMessage(a) {
    var b = a.data;
    switch (b.type) {
        case"sdpInfo":
            sdpInfo = b.data.sdpInfo;
            var c = b.data.aacCodecInfo;
            setAudioRtpSession(sdpInfo, c);
            break;
        case"MediaData":
            var d = b.data.rtspInterleave[1];
            if ("undefined" != typeof audioRtpSessionsArray[d]) {
                var e = b.data,
                    f = audioRtpSessionsArray[d].parseRTPData(e.rtspInterleave, e.payload, isBackupCommand, b.info);
                null !== f && "undefined" != typeof f && null !== f.streamData && "undefined" != typeof f.streamData && (f.streamData = null), sendMessage("render", f)
            }
    }
}

function setAudioRtpSession(a, b) {
    for (var c = a, d = 0; d < a.length; d++) if (-1 === c[d].trackID.search("trackID=t")) {
        switch (rtpSession = null, c[d].codecName) {
            case"G.711A":
            case"G.711Mu":
                rtpSession = new G711Session(c[d].codecName), rtpSession.setCodecInfo(c[d]);
                break;
            case"G.726-16":
            case"G.726-24":
            case"G.726-32":
            case"G.726-40":
                var e = parseInt(c[d].codecName.substr(6, 2));
                debug.log(e), rtpSession = new G726Session(e);
                break;
            case"mpeg4-generic":
                rtpSession = new AACSession, debug.log("aacCodecInfo:  " + JSON.stringify(b)), rtpSession.setCodecInfo(b)
        }
        var f = c[d].RtpInterlevedID;
        if (audioRtpSessionsArray[f] = rtpSession, null != rtpSession) return
    }
}

function sendMessage(a, b) {
    var c = {
        type: a,
        codec: b.codec,
        data: b.bufferData,
        rtpTimeStamp: b.rtpTimeStamp,
        samplingRate: b.samplingRate || 8e3
    };
    if ("render" === a) postMessage(c, [b.bufferData.buffer]); else if ("backup" === a) {
        var d = {type: a, data: b};
        postMessage(d)
    } else postMessage(c)
}

importScripts("./public.js", "./g711Session.js", "./g726Session.js", "./aacSession.js", "./Decode/audioDecoderG711.js", "./Decode/audioDecoderG726x.js"), addEventListener("message", receiveMessage, !1);
var audioRtpSessionsArray = [], sdpInfo = null, rtpSession = null, isBackupCommand = !1;