美文网首页
Mediao Soup Demo协议分析

Mediao Soup Demo协议分析

作者: JeffreyLau | 来源:发表于2020-05-24 11:31 被阅读0次
  • 启动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}

相关文章

网友评论

      本文标题:Mediao Soup Demo协议分析

      本文链接:https://www.haomeiwen.com/subject/ekbdahtx.html