Mediao Soup Demo协议分析

  • 启动server服务执行
  • 在mediasoup-demo/server目录下执行如下命令
  • DEBUG="mediasoup ERROR WARN" INTERACTIVE="true" node server.js
response:
{"event":"running","targetId":"20795"}
{"event":"running","targetId":"20797"}
{"event":"running","targetId":"20799"}
{"event":"running","targetId":"20801"}
  • 由于测试设备的CPU为4核心所以启动4个worker

  • targetId表示worker进程对应的pid

  • 在mediasoup-demo/app目录下通过

  • gulp live命令启动应用demo服务,首先会使用如下命令创建

  • 创建路由(房间)createRouter会通过信令服务向C++多媒体服务发送如下指令

request:
{
 "id":1,
    "internal" :{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b"
    },
 "method":"worker.createRouter"
}

response: 
{"accepted":true,"id":1}
  • 通过路由createAudioLevelObserver请求
request:
{
    "data":{
        "interval":800,
        "maxEntries":1,
        "threshold":-80
    },
    "id":2,
    "internal":{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "rtpObserverId":"b4291ace-712e-433f-89b6-637531aa3c86"
    },
    "method":"router.createAudioLevelObserver"
}

{"accepted":true,"id":2}
  • 通过路由发送createPlainTransport请求
request:
{
    "data":{
    "comedia":false,
    "enableSctp":true,
    "enableSrtp":false,
    "isDataChannel":false,
    "listenIp":{
        "ip":"127.0.0.1"
    },
    "maxSctpMessageSize":262144,
    "numSctpStreams":{"MIS":256,"OS":256},
    "rtcpMux":true,
    "srtpCryptoSuite":"AES_CM_128_HMAC_SHA1_80"
    },
    "id":3,
    "internal":{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"5fe4b2ca-58a7-4c41-9ead-978bed1952ab"
    },
    "method":"router.createPlainTransport"
}

response:
{
    "accepted":true,
    "data":{
        "comedia":false,
        "consumerIds":[],
        "dataConsumerIds":[],
        "dataProducerIds":[],
        "id":"5fe4b2ca-58a7-4c41-9ead-978bed1952ab","mapRtxSsrcConsumerId":{},
        "mapSsrcConsumerId":{},
        "producerIds":[],
        "recvRtpHeaderExtensions":{},
        "rtcpMux":true,
        "rtpListener":{
            "midTable":{},
            "ridTable":{},
            "ssrcTable":{}},
        "sctpListener":{
            "streamIdTable":{}
        },
        "sctpParameters":{
            "MIS":256,
            "OS":256,
            "isDataChannel":false,
            "maxMessageSize":262144,
            "port":5000
        },
        "sctpState":"new",
        "traceEventTypes":"",
        "tuple":{"localIp":"127.0.0.1","localPort":44223,"protocol":"udp"}
    },
    "id":3
}
  • 发送transport.connect请求
request:
{
    "data":{
        "ip":"127.0.0.1","port":34397
    },
    "id":4,
    "internal":{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"5fe4b2ca-58a7-4c41-9ead-978bed1952ab"
    },
    "method":"transport.connect"
}

response:
{
    "accepted":true,
    "data":{
        "tuple":{
            "localIp":"127.0.0.1",
            "localPort":44223,
            "protocol":"udp",
            "remoteIp":"127.0.0.1",
            "remotePort":34397
        }
    },
    "id":4
}
response:
{
    "data":{
        "sctpState":"connecting"
    },
    "event":"sctpstatechange",
    "targetId":"5fe4b2ca-58a7-4c41-9ead-978bed1952ab"
}
  • 发送transport.produceData请求
request:
{
    "data":{
        "label":"bot",
        "protocol":"",
        "sctpStreamParameters":{
            "ordered":true,
            "streamId":1
        }
    },
    "id":5,
    "internal":{
        "dataProducerId":"464334d5-6d77-404f-b4e0-3e9dc2708a2f",
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"5fe4b2ca-58a7-4c41-9ead-978bed1952ab"
    },
    "method":"transport.produceData"
}

response:
{
    "accepted":true,
    "data":{
        "id":"464334d5-6d77-404f-b4e0-3e9dc2708a2f",
        "label":"bot",
        "protocol":"",
        "sctpStreamParameters":{
            "ordered":true,
            "streamId":1
        }
    },
    "id":5
}

response:
{
    "data":{
        "sctpState":"connected"
    },
    "event":"sctpstatechange",
    "targetId":"5fe4b2ca-58a7-4c41-9ead-978bed1952ab"
}
  • 通过路由发送createWebRtcTransport
request:
{
    "data":{
        "enableSctp":true,
        "enableTcp":false,
        "enableUdp":true,
        "initialAvailableOutgoingBitrate":1000000,
        "isDataChannel":true,
        "listenIps":[{"ip":"127.0.0.1"}],
        "maxSctpMessageSize":262144,
        "numSctpStreams":{
            "MIS":1024,"OS":1024
        },
        "preferTcp":false,
        "preferUdp":false
    },
    "id":6,
    "internal":{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
    },
    "method":"router.createWebRtcTransport"
}

response:
{
    "accepted":true,
    "data":{
        "consumerIds":[],
        "dataConsumerIds":[],
        "dataProducerIds":[],
        "dtlsParameters":{
            "fingerprints":[{
                "algorithm":"sha-1","value":"xxxx"},{
                "algorithm":"sha-224","value":"xxss"},{
                "algorithm":"sha-256","value":"ddd"},{
                "algorithm":"sha-384","value":"fff"},{
                "algorithm":"sha-512","value":"cccc"}],
            "role":"auto"
        },
        "dtlsState":"new",
        "iceCandidates":[{
            "foundation":"udpcandidate",
            "ip":"127.0.0.1",
            "port":46482,
            "priority":1076302079,
            "protocol":"udp",
            "type":"host"
        }],
        "iceParameters":{
            "iceLite":true,
            "password":"1fs2cmda3czbfe4juktrtjqjc1kw8bdk",
            "usernameFragment":"gajtb1cdube6ql76"
        },
        "iceRole":"controlled",
        "iceState":"new",
        "id":"c640b33b-ced9-4fcb-ba22-956b5079f158",
        "mapRtxSsrcConsumerId":{},
        "mapSsrcConsumerId":{},
        "producerIds":[],
        "recvRtpHeaderExtensions":{},
        "rtpListener":{
            "midTable":{},
            "ridTable":{},
            "ssrcTable":{}
        },
        "sctpListener":{
            "streamIdTable":{}
        },
        "sctpParameters":{
            "MIS":1024,
            "OS":1024,
            "isDataChannel":true,
            "maxMessageSize":262144,
            "port":5000
        },
        "sctpState":"new",
        "traceEventTypes":""
    },
    "id":6
}
  • 发送transport.enableTraceEvent
request:
{
    "data":{
        "types":["bwe"]
    },
    "id":7,
    "internal":{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"c640b33b-ced9-4fcb-ba22-956b5079f158"},
    "method":"transport.enableTraceEvent"
}

response:
{"accepted":true,"id":7}

  • 发送transport.setMaxIncomingBitrate
request:
{
    "data":{
        "bitrate":1500000
    },
    "id":8,
    "internal":{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
    },
    "method":"transport.setMaxIncomingBitrate"
}

response:
{"accepted":true,"id":8}
  • 通过路由发送createWebRtcTransport
{
    "data":{
        "enableSctp":true,
        "enableTcp":false,
        "enableUdp":true,
        "initialAvailableOutgoingBitrate":1000000,
        "isDataChannel":true,
        "listenIps":[{"ip":"127.0.0.1"}],
        "maxSctpMessageSize":262144,
        "numSctpStreams":{
            "MIS":1024,"OS":1024
        },
        "preferTcp":false,
        "preferUdp":false
    },
    "id":9,
    "internal":{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"
    },
    "method":"router.createWebRtcTransport"
}

response:
{
    "accepted":true,
    "data":{
        "consumerIds":[],
        "dataConsumerIds":[],
        "dataProducerIds":[],
        "dtlsParameters":{
            "fingerprints":[{
                "algorithm":"sha-1","value":"@@@"},{
                "algorithm":"sha-224","value":"ddd"},{
                "algorithm":"sha-256","value":"fff"},{
                "algorithm":"sha-384","value":"vvv"},{
                "algorithm":"sha-512","value":"bbb"}],
            "role":"auto"
        },
        "dtlsState":"new",
        "iceCandidates":[{
            "foundation":"udpcandidate",              
            "ip":"127.0.0.1",
            "port":45096,
            "priority":1076302079,
            "protocol":"udp",
            "type":"host"
        }],
        "iceParameters":{
            "iceLite":true,
            "password":"m7pvh81ufyu2dz2pbku4ydercbnbygnq",
            "usernameFragment":"lu8a8bc1m1998uhc"
        },
        "iceRole":"controlled",
        "iceState":"new",
        "id":"5194e86d-5243-4f95-b881-f0e2f9cf1bac",
        "mapRtxSsrcConsumerId":{},
        "mapSsrcConsumerId":{},
        "producerIds":[],
        "recvRtpHeaderExtensions":{},
        "rtpListener":{
            "midTable":{},
            "ridTable":{},
            "ssrcTable":{}
        },
        "sctpListener":{
            "streamIdTable":{}
        },
        "sctpParameters":{
            "MIS":1024,
            "OS":1024,
            "isDataChannel":true,
            "maxMessageSize":262144,
            "port":5000
        },
        "sctpState":"new",
        "traceEventTypes":""
    },
    "id":9
}
  • 发送transport.enableTraceEvent
request:
{
    "data":{
        "types":["bwe"]
    },
    "id":10,
    "internal":{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"},
    "method":"transport.enableTraceEvent"
}

response:
{"accepted":true,"id":10}

  • 发送transport.setMaxIncomingBitrate
request:
{
    "data":{"bitrate":1500000},
    "id":11,
    "internal":{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"
    },
    "method":"transport.setMaxIncomingBitrate"
}

response:
{"accepted":true,"id":11}

  • 发送transport.consumeData
request:
{
    "data":{
        "label":"bot",
        "protocol":"",
        "sctpStreamParameters":{
            "ordered":true,"streamId":0
        }
    },
    "id":12,
    "internal":{
        "dataConsumerId":"64574b7e-1aa5-40b4-816a-16747f2491e1",
        "dataProducerId":"464334d5-6d77-404f-b4e0-3e9dc2708a2f",
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"
    },
    "method":"transport.consumeData"
}

response:
{
    "accepted":true,
    "data":{
        "dataProducerId":"464334d5-6d77-404f-b4e0-3e9dc2708a2f",
        "id":"64574b7e-1aa5-40b4-816a-16747f2491e1",
        "label":"bot",
        "protocol":"",
        "sctpStreamParameters":{
            "ordered":true,"streamId":0
        }
    },
    "id":12
}
  • 发送transport.connect
request:
{
    "data":{
        "dtlsParameters":{
            "fingerprints":[{
                "algorithm":"sha-256","value":"dd"
            }],
            "role":"server"}
    },
    "id":13,
    "internal":{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"c640b33b-ced9-4fcb-ba22-956b5079f158"},
    "method":"transport.connect"
}

response:
{"accepted":true,"data":{"dtlsLocalRole":"client"}

  • 发送transport.connect
request:
{
    "data":{
        "dtlsParameters":{
            "fingerprints":[{
                "algorithm":"sha-256","value":"7bbb"
            }],
            "role":"client"
        }
    },
    "id":14,
    "internal":{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"
    },
    "method":"transport.connect"
}

response:
{"accepted":true,"data":{"dtlsLocalRole":"server"},"id":14}

  • C++层返回信息

{
    "data":{
        "iceSelectedTuple":{
            "localIp":"127.0.0.1",
            "localPort":46482,
            "protocol":"udp",
            "remoteIp":"192.168.2.229",
            "remotePort":60972
        }
    },
    "event":"iceselectedtuplechange",
    "targetId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
}

{
    "data":{
        "iceState":"connected"
    },
    "event":"icestatechange",
    "targetId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
}

{
    "data":{
        "dtlsState":"connecting"
    },
    "event":"dtlsstatechange",
    "targetId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
}

{
    "data":{
        "dtlsRemoteCert":"xx",
        "dtlsState":"connected"
    },
    "event":"dtlsstatechange",
    "targetId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
} 

{
    "data":{
        "sctpState":"connecting"
    },
    "event":"sctpstatechange",
    "targetId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
}

{
    "data":{
        "iceSelectedTuple":{
            "localIp":"127.0.0.1",
            "localPort":45096,
            "protocol":"udp",
            "remoteIp":"192.168.2.229",
            "remotePort":39930
        }
    },
    "event":"iceselectedtuplechange",
    "targetId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"
}

{
    "data":{
        "iceState":"connected"
    },
    "event":"icestatechange",
    "targetId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"
}

{
    "data":{
        "dtlsState":"connecting"
    },
    "event":"dtlsstatechange",
    "targetId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"
}
  • 发送transport.produce
request:
{
    "data":{
        "kind":"audio",
        "paused":false,
        "rtpMapping":{
            "codecs":[{"mappedPayloadType":100,"payloadType":111}],
            "encodings":[{"mappedSsrc":384600302,"ssrc":2068361228}]},
        "rtpParameters":{
            "codecs":[{
                "channels":2,
                "clockRate":48000,
                "mimeType":"audio/opus",
                "parameters":{
                    "minptime":10,
                    "sprop-stereo":1,
                    "usedtx":1,
                    "useinbandfec":1
                },
                "payloadType":111,
                "rtcpFeedback":[{
                    "parameter":"",
                    "type":"transport-cc"}]
            }],
            "encodings":[{"dtx":false,"ssrc":2068361228}],
            "headerExtensions":[{
                "encrypt":false,
                "id":4,"parameters":{},
                "uri":"urn:ietf:params:rtp-hdrext:sdes:mid"
            },{"encrypt":false,"id":2,
               "parameters":{},
               "uri":"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"},{
                "encrypt":false,"id":3,"parameters":{},
                "uri":"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"},{
                "encrypt":false,
                "id":1,
                "parameters":{},
                "uri":"urn:ietf:params:rtp-hdrext:ssrc-audio-level"}],
            "mid":"0",
            "rtcp":{
                "cname":"O1GLW6lUbD+xDQfd","reducedSize":true
            }
        }
    },
    "id":15,"internal":{
        "producerId":"0175199b-9ffd-464f-ad3d-0117702e8b33",
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
    },
    "method":"transport.produce"
}

response:
{"accepted":true,"data":{"type":"simple"},"id":15}

  • 发送rtpObserver.addProducer
request:
{
    "id":16,
    "internal":{
        "producerId":"0175199b-9ffd-464f-ad3d-0117702e8b33",
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "rtpObserverId":"b4291ace-712e-433f-89b6-637531aa3c86"
    },
    "method":"rtpObserver.addProducer"
} 

response:
{"accepted":true,"id":16}
  • C++层返回信息
response:
{"data":{
    "dtlsRemoteCert":"nn",
    "dtlsState":"connected"
  },
 "event":"dtlsstatechange",
 "targetId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"
}

{
    "data":{
        "sctpState":"connecting"
    },
    "event":"sctpstatechange",
    "targetId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"
}

{
    "data":[{"score":10,"ssrc":2068361228}],
    "event":"score",
    "targetId":"0175199b-9ffd-464f-ad3d-0117702e8b33"
}

{
    "data":{
        "iceState":"completed"
    },
    "event":"icestatechange",
    "targetId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
}

{
    "data":{
        "iceState":"completed"
    },
    "event":"icestatechange",
    "targetId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"
}

{
    "data":{
        "sctpState":"connected"
    },
    "event":"sctpstatechange",
    "targetId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"
}

{
    "data":{
        "sctpState":"connected"
    },
    "event":"sctpstatechange",
    "targetId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
}
  • 发送transport.getStats
request:
{
    "id":17,"internal":{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
    },
    "method":"transport.getStats"
}

response:
{
    "accepted":true,"data":[{
        "bytesReceived":1930,
        "bytesSent":1605,
        "dtlsState":"connected",
        "iceRole":"controlled",
        "iceSelectedTuple":{
            "localIp":"127.0.0.1",
            "localPort":46482,
            "protocol":"udp",
            "remoteIp":"192.168.2.229",
            "remotePort":60972
        },
        "iceState":"completed",
        "maxIncomingBitrate":1500000,
        "probationBytesSent":0,
        "probationSendBitrate":0,
        "recvBitrate":15440,
        "rtpBytesReceived":339,
        "rtpBytesSent":0,
        "rtpRecvBitrate":1085,
        "rtpSendBitrate":0,
        "rtxBytesReceived":0,
        "rtxBytesSent":0,
        "rtxRecvBitrate":0,
        "rtxSendBitrate":0,
        "sctpState":"connected",
        "sendBitrate":12840,
        "timestamp":3762455,
        "transportId":"c640b33b-ced9-4fcb-ba22-956b5079f158",
        "type":"webrtc-transport"
    }],
    "id":17
}
  • 发送transport.produceData
request:
{
    "data":{
        "label":"chat",
        "protocol":"",
        "sctpStreamParameters":{
            "maxRetransmits":1,
            "ordered":false,
            "streamId":0
        }
    },
    "id":18,
    "internal":{
        "dataProducerId":"a16fa5b1-e824-45e8-a573-88e4cc801de7",
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"c640b33b-ced9-4fcb-ba22-956b5079f158"},
    "method":"transport.produceData"
}

response:
{
    "accepted":true,
    "data":{
        "id":"a16fa5b1-e824-45e8-a573-88e4cc801de7",
        "label":"chat",
        "protocol":"",
        "sctpStreamParameters":{
            "maxRetransmits":1,
            "ordered":false,
            "streamId":0
        }
    },
    "id":18
}
  • 发送transport.getStats
request:
{
    "id":19,
    "internal":{
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"
    },
    "method":"transport.getStats"
} 

response:
{
    "accepted":true,"data":[{
        "bytesReceived":1994,
        "bytesSent":1932,
        "dtlsState":"connected",
        "iceRole":"controlled",
        "iceSelectedTuple":{
            "localIp":"127.0.0.1",
            "localPort":45096,
            "protocol":"udp",
            "remoteIp":"192.168.2.229",
            "remotePort":39930
        },
        "iceState":"completed",
        "maxIncomingBitrate":1500000,
        "probationBytesSent":0,
        "probationSendBitrate":0,
        "recvBitrate":15952,
        "rtpBytesReceived":0,
        "rtpBytesSent":0,
        "rtpRecvBitrate":0,
        "rtpSendBitrate":0,
        "rtxBytesReceived":0,
        "rtxBytesSent":0,
        "rtxRecvBitrate":0,
        "rtxSendBitrate":0,
        "sctpState":"connected",
        "sendBitrate":15456,
        "timestamp":3762473,
        "transportId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac",
        "type":"webrtc-transport"
    }],
    "id":19
}
  • 发送transport.produceData
request:
{
    "data":{
        "label":"bot",
        "protocol":"",
        "sctpStreamParameters":{
            "maxPacketLifeTime":2000,
            "ordered":false,
            "streamId":1
        }
    },
    "id":20,
    "internal":{
        "dataProducerId":"4c3592b8-4348-459a-9a5f-2814d9caddcf",
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
    },
    "method":"transport.produceData"
}

response:
{
    "accepted":true,
    "data":{
        "id":"4c3592b8-4348-459a-9a5f-2814d9caddcf",
        "label":"bot",
        "protocol":"",
        "sctpStreamParameters":{
            "maxPacketLifeTime":2000,
            "ordered":false,
            "streamId":1
        }
    },
    "id":20
}
  • 发送transport.consumeData
request:
{
    "data":{
        "label":"bot",
        "protocol":"",
        "sctpStreamParameters":{
            "maxPacketLifeTime":2000,
            "ordered":false,
            "streamId":0
        }
    },
    "id":21,
    "internal":{
        "dataConsumerId":"96e0961c-fee3-4b20-b6c2-16db1013012b",
        "dataProducerId":"4c3592b8-4348-459a-9a5f-2814d9caddcf",
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"5fe4b2ca-58a7-4c41-9ead-978bed1952ab"
    },
    "method":"transport.consumeData"
}

response:
{
    "accepted":true,"data":{
        "dataProducerId":"4c3592b8-4348-459a-9a5f-2814d9caddcf",
        "id":"96e0961c-fee3-4b20-b6c2-16db1013012b",
        "label":"bot",
        "protocol":"",
        "sctpStreamParameters":{
            "maxPacketLifeTime":2000,
            "ordered":false,
            "streamId":0
        }
    },
    "id":21
}
  • 发送transport.getStats
request:
{
    "id":22,"internal":{
        "producerId":"0175199b-9ffd-464f-ad3d-0117702e8b33",
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
    },
    "method":"producer.getStats"
}

response:
{
    "accepted":true,
    "data":[{
        "bitrate":944,
        "byteCount":295,
        "firCount":0,
        "fractionLost":0,
        "jitter":122141,
        "kind":"audio",
        "mimeType":"audio/opus",
        "nackCount":0,
        "nackPacketCount":0,
        "packetCount":11,
        "packetsDiscarded":0,
        "packetsLost":0,
        "packetsRepaired":0,
        "packetsRetransmitted":0,
        "pliCount":0,
        "score":10,
        "ssrc":2068361228,
        "timestamp":3762482,
        "type":"inbound-rtp"
    }],
    "id":22
}
  • 发送dataProducer.getStats
request:
{
    "id":23,
    "internal":{
        "dataProducerId":"a16fa5b1-e824-45e8-a573-88e4cc801de7",
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
    },
    "method":"dataProducer.getStats"
}

response:
{
    "accepted":true,"data":[{
        "bytesReceived":0,
        "label":"chat",
        "messagesReceived":0,
        "protocol":"",
        "timestamp":3762526,
        "type":"data-producer"
    }],
    "id":23
}
  • 发送dataProducer.getStats
request:
{
    "id":24,
    "internal":{
        "dataProducerId":"4c3592b8-4348-459a-9a5f-2814d9caddcf",
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
    },
    "method":"dataProducer.getStats"
}

response:
{
    "accepted":true,"data":[{
        "bytesReceived":0,
        "label":"bot",
        "messagesReceived":0,
        "protocol":"",
        "timestamp":3762530,
        "type":"data-producer"
    }],
    "id":24
}
  • 发送dataConsumer.getStats
request:
{
    "id":25,"internal":{
        "dataConsumerId":"64574b7e-1aa5-40b4-816a-16747f2491e1",
        "dataProducerId":"464334d5-6d77-404f-b4e0-3e9dc2708a2f",
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"5194e86d-5243-4f95-b881-f0e2f9cf1bac"
    },
    "method":"dataConsumer.getStats"
}

response:
{"accepted":true,
 "data":[{
    "bytesSent":0,
    "label":"bot",
    "messagesSent":0,
    "protocol":"",
    "timestamp":3762533,
    "type":"data-consumer"
 }],
 "id":25
}
  • 发送transport.produce
request:
{
    "data":{
        "kind":"video",
        "paused":false,
        "rtpMapping":{
            "codecs":[{
                "mappedPayloadType":101,
                "payloadType":96},{
                "mappedPayloadType":102,
                "payloadType":97
            }],
            "encodings":[
            {
                "mappedSsrc":314619191,
                "rid":"r0","scalabilityMode":"S1T3"
            },{ "mappedSsrc":314619192,
               "rid":"r1",
               "scalabilityMode":"S1T3"
              },{
                "mappedSsrc":314619193,
                "rid":"r2",
                "scalabilityMode":"S1T3"
             }
            ]
        },
        "rtpParameters":{
            "codecs":[{
                "clockRate":90000,
                "mimeType":"video/VP8",
                "parameters":{},
                "payloadType":96,
                "rtcpFeedback":[{
                    "parameter":"",
                    "type":"goog-remb"
                },{"parameter":"",
                   "type":
                   "transport-cc"
                  },{
                    "parameter":"fir",
                    "type":"ccm"
                },{"parameter":"",
                   "type":"nack"
                  },{"parameter":"pli",
                     "type":"nack"
                    }]
            },{"clockRate":90000,
               "mimeType":"video/rtx",
               "parameters":{"apt":96},
               "payloadType":97,
               "rtcpFeedback":[]
              }],
            "encodings":[{
                "active":true,
                "dtx":false,
                "rid":"r0",
                "scalabilityMode":"S1T3",
                "scaleResolutionDownBy":4
            },{
                "active":true,
                "dtx":false,
                "rid":"r1",
                "scalabilityMode":"S1T3",
                "scaleResolutionDownBy":2
            },{
                "active":true,
                "dtx":false,
                "rid":"r2",
                "scalabilityMode":"S1T3",
                "scaleResolutionDownBy":1
            }],
            "headerExtensions":[{
                "encrypt":false,
                "id":4,
                "parameters":{},
                "uri":"urn:ietf:params:rtp-hdrext:sdes:mid"
            },{"encrypt":false,
               "id":5,"parameters":{},
               "uri":"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"
              },{"encrypt":false,
                 "id":6,
                 "parameters":{},
                 "uri":"urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"
                },{"encrypt":false,
                   "id":2,
                   "parameters":{},
                   "uri":"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"
                  },{"encrypt":false,
                     "id":3,
                     "parameters":{},
                     "uri":"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"},{"encrypt":false,                                                                           "id":8,                                                                                  "parameters":{},                                                                         "uri":"http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07"},{
                "encrypt":false,
                "id":13,
                "parameters":{},
                "uri":"urn:3gpp:video-orientation"
            },{
                "encrypt":false,
                "id":14,
                "parameters":{},
                "uri":"urn:ietf:params:rtp-hdrext:toffset"
            }],
            "mid":"2",
            "rtcp":{
                "cname":"O1GLW6lUbD+xDQfd",
                "reducedSize":true
            }
        }
    },
    "id":26,
    "internal":{
        "producerId":"ec53243b-4684-4c48-9b46-5d813178623b",
        "routerId":"aaa232b6-f113-4a07-bfb3-8e344936a43b",
        "transportId":"c640b33b-ced9-4fcb-ba22-956b5079f158"
    },
    "method":"transport.produce"
}

response:
{"accepted":true,"data":{"type":"simulcast"},"id":26}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
禁止转载,如需转载请通过简信或评论联系作者。
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 211,290评论 6 491
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,107评论 2 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 156,872评论 0 347
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,415评论 1 283
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,453评论 6 385
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,784评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,927评论 3 406
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,691评论 0 266
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,137评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,472评论 2 326
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,622评论 1 340
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,289评论 4 329
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,887评论 3 312
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,741评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,977评论 1 265
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,316评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,490评论 2 348