DirectTransport RTP Packets

Hello.

I’m trying to save in disk rtp packets received with DirectTransport from router to later send to different router.

I correctly receive rtp packets and save with it’s timestamp to disk.

My problem is when trying to send with DirectTransport and consumed with webRtcTransport, apparently packets are send correctly and received in browser side, but the video is never seen, the <video> element shows “loading” circle and no frame is played.

I save the rtp packets, the rtpParameters from original producer and I correctly check the consumer.canConsume with the producer asociated with directTransport.

I’ve also tried to send rtp packet from one router to other in realtime (without storing in disk) and the result it’s the same.

Also, I never receive a rtcp packet in the directTransport from the original producer.

Should this work?
I would like to know if I’m doing something wrong or if it can never work.

Thank you.

That’s the problem. Use the consumer.rtpParameters.

But I need the producer id before creating the consumer.

First I create the producer wiith directTransport.

peer.directTransport = await this.router.createDirectTransport();
peer.producer = await peer.directTransport.produce(
                {
                    kind: stored.kind,
                    rtpParameters: stored.rtpParameters
                }
            );

Then I consume that producer with webRtcTransport:

        this.outTransport = await this.router.createWebRtcTransport({  ...  });
        this.consumer = await this.outTransport.consume({
               producerId: peer.producer.id,
               rtpCapabilities: this.rtpCapabilities,
               paused: true
        });

How can I get consumer rtpParameters before creating the producer??

Thank you.

Ok sorry for my last answer, I suppose you were talking about directTransport consumer.

I’ve done, I get this rtpParameters:

{
  codecs: [
    {
      mimeType: 'video/VP8',
      payloadType: 101,
      clockRate: 90000,
      rtcpFeedback: [ { type: "nack", parameter: "" } , { type: "nack", parameter: "pli" }, { type: "ccm", parameter: "fir" } ]
    }
  ],
  headerExtensions: [],
  encodings: [ { ssrc: 414791853, scalabilityMode: 'S3T3' } ],
  rtcp: { cname: '0b43b8ec', reducedSize: true, mux: true },
  mid: '0'
}

But now I get an exception when I create the directTransport producer in the other router:

            peer.directTransport = await this.router.createDirectTransport();
            peer.producer = await peer.directTransport.produce(
                {
                    kind: primerStream.kind,
                    rtpParameters: primerStream.rtpParameters
                }
            );

I get this, but I don’t understand why.

I’ve seen in mediasoup RTP Parameters documentation, that SVC is enabled when scalabilityMode is set in encodings array. I’ve tried to remove that value from the encoding object, and the error disapears, but I have no video. This is the rtpParameters used from consumer (removing the scalabilityMode):

image

I’v also tried to change then rtpParameters received from producer and remove all codecs except codec used by comsumer in it’s rtpParameters, the resulting rtpParameters is this:

But I don’t get video with it.

Any help would be appreciated.

Thank you.

Hello, I finally solved, I write here my solution if somebodys needs it.

I had two problems, first was that I need to use the data for rtpParameters from consumer as said @ibc.

My final rtpParameter used is just this:

image

The other problem was just the “muted” property on the <video> tag in the HTML.

Without the muted property videos waits forever loading, but with the muted property starts inmediatly.

I send video and audio on differente streams, so I don’t need audio on the video element.