hdoru
(Hüseyin)
February 2, 2021, 4:16pm
1
hello everyone
gst-launch-1.0 audiotestsrc ! audioresample ! audio/x-raw,channels=2,rate=48000 ! opusenc bitrate=20000 ! rtpopuspay pt=101 ssrc=1112223 ! udpsink host=127.0.0.1 port=20157
gstreamer sending rtp packet to mediasoup
MediaSoup PlainTransport =>
this.AudioProducer = await this.AudioPlainTransPort.produce(
{
kind : 'audio',
rtpParameters :
{
codecs :
[
{
mimeType : 'audio/opus',
clockRate : 48000,
payloadType : 101,
channels : 2,
rtcpFeedback : [ ],
parameters : { 'sprop-stereo': 1 }
}
],
encodings : [ { ssrc: 1112223 } ]
},
paused: false
});
but AudioProducer stats is empty
this.AudioProducer.getStats()
.then(stats => console.warn("this.AudioProducer => "+JSON.stringify(stats)));
output
this.AudioProducer => []
ibc
(Iñaki Baz Castillo)
February 2, 2021, 4:23pm
2
There are tons of debugs and log tags in mediasoup to diagnose what is wrong with received RTP (if any). Use them.
hdoru
(Hüseyin)
February 2, 2021, 4:59pm
3
mediasoup:Router createPlainTransport() +60ms
mediasoup:Channel request() [method:router.createPlainTransport, id:10] +17ms
mediasoup:Channel request succeeded [method:router.createPlainTransport, id:10] +1ms
mediasoup:Transport constructor() +49ms
mediasoup:PlainTransport constructor() +72ms
mediasoup:PlainTransport connect() +0ms
mediasoup:Channel request() [method:transport.connect, id:11] +0ms
mediasoup:Transport consume() +0ms
mediasoup:Channel request() [method:transport.consume, id:12] +0ms
mediasoup:Channel request succeeded [method:transport.connect, id:11] +1ms
mediasoup:Channel request succeeded [method:transport.consume, id:12] +0ms
mediasoup:Consumer constructor() +19ms
mediasoup:Consumer resume() +0ms
mediasoup:Channel request() [method:consumer.resume, id:13] +0ms
mediasoup:Channel request succeeded [method:consumer.resume, id:13] +1ms
mediasoup:Router createWebRtcTransport() +3ms
mediasoup:Channel request() [method:router.createWebRtcTransport, id:12] +1ms
mediasoup:Channel request succeeded [method:router.createWebRtcTransport, id:12] +1ms
mediasoup:Transport constructor() +5ms
mediasoup:WebRtcTransport constructor() +37ms
mediasoup:Transport consume() +2ms
mediasoup:Channel request() [method:transport.consume, id:13] +4ms
mediasoup:Channel request succeeded [method:transport.consume, id:13] +1ms
mediasoup:Consumer constructor() +8ms
mediasoup:WebRtcTransport connect() +9ms
mediasoup:Channel request() [method:transport.connect, id:14] +5ms
mediasoup:Channel request succeeded [method:transport.connect, id:14] +0ms
mediasoup:Producer getStats() +2s
mediasoup:Channel request() [method:producer.getStats, id:15] +986ms
mediasoup:Channel request succeeded [method:producer.getStats, id:15] +1ms
this.AudioProducer => []
mediasoup:Consumer getStats() +2s
mediasoup:Channel request() [method:consumer.getStats, id:16] +1s
mediasoup:Channel request succeeded [method:consumer.getStats, id:16] +1ms
this.audioConsumer => [{“bitrate”:0,“byteCount”:0,“firCount”:0,“fractionLost”:0,“kind”:“audio”,“mimeType”:“audio/opus”,“nackCount”:0,“nackPacketCount”:0,“packetCount”:0,“packetsDiscarded”:0,“packetsLost”:0,“packetsRepaired”:0,“packetsRetransmitted”:0,“pliCount”:0,“score”:10,“ssrc”:327253245,“timestamp”:1351609,“type”:“outbound-rtp”}]
mediasoup:Producer getStats() +2s
mediasoup:Channel request() [method:producer.getStats, id:17] +990ms
mediasoup:Channel request succeeded [method:producer.getStats, id:17] +0ms
this.AudioProducer => []
hdoru
(Hüseyin)
February 2, 2021, 5:00pm
4
export DEBUG=“mediasoup*” && npm run startserver
"worker": {
"rtcMinPort": 20000,
"rtcMaxPort": 65535,
"logLevel": "debug",
"logTags:": [
"info",
"ice",
"dtls",
"rtp",
"srtp",
"rtcp",
"rtx",
"bwe",
"score",
"simulcast",
"svc"
]
}
no error in logs
hdoru
(Hüseyin)
February 3, 2021, 9:04am
5
#!/usr/bin/env bash
AUDIO_SSRC=1112223
AUDIO_PT=100
MEDIA_FILE='/home/hd/Downloads/hd2.mp4'
audioTransportPort=55517
audioTransportRtcpPort=55928
gst-launch-1.0 rtpbin name=rtpbin filesrc location=${MEDIA_FILE} ! qtdemux name=demux demux.audio_0 ! queue ! decodebin ! audioresample ! audioconvert ! opusenc ! rtpopuspay pt=100 ssrc=1112223 ! rtpbin.send_rtp_sink_1 rtpbin.send_rtp_src_1 ! udpsink host=127.0.0.1 port=${audioTransportPort} rtpbin.send_rtcp_src_1 ! udpsink host=127.0.0.1 port=${audioTransportRtcpPort} sync=false async=false
this.AudioPlainTransPort = await this.Router.createPlainTransport(
{
listenIp : '127.0.0.1',
rtcpMux : false,
comedia : true
});
const audioRtpPort = this.AudioPlainTransPort.tuple.localPort;
const audioRtcpPort = this.AudioPlainTransPort.rtcpTuple.localPort;
const ip = this.AudioPlainTransPort.tuple.localIp;
console.log("audio ip =>>>"+ip);
console.log("audio rtp port =>>>"+audioRtpPort);
console.log("audio rtcp port =>>>"+audioRtcpPort);
var random_ssrc = Date.now();
this.AudioProducer = await this.AudioPlainTransPort.produce(
{
kind : 'audio',
rtpParameters :
{
codecs :
[
{
mimeType : 'audio/opus',
clockRate : 48000,
payloadType : 100,
channels : 2,
rtcpFeedback : [ ],
parameters : { 'sprop-stereo': 1}
}
],
encodings : [ { ssrc: 1112223 } ]
}
});
console.log( "id "+this.AudioProducer.id+" audio :"+JSON.stringify(this.AudioProducer.rtpParameters ));
setInterval(() =>
{
if(this.AudioProducer != null)
{
this.AudioProducer.getStats()
.then(stats => console.warn("this.AudioProducer => "+JSON.stringify(stats)));
}
}, 2000);
output
audio ip =>>>127.0.0.1
audio rtp port =>>>55517
audio rtcp port =>>>55928
id 492fd75c-c160-47f1-9aa7-1178e59c8180 audio :{"codecs":[{"mimeType":"audio/opus","clockRate":48000,"payloadType":100,"channels":2,"rtcpFeedback":[],"parameters":{"sprop-stereo":1}}],"encodings":[{"ssrc":1112223,"dtx":false}],"headerExtensions":[],"rtcp":{"reducedSize":true,"cname":"768b7cdf"}}
It working this way