# DirectTransport RTCP event not emitting

**URL:** <https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697>\
**Category:** mediasoup libraries\
**Created:** [November 28, 2023, 2:45pm UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697 "2023-11-28T14:45:47Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![GithubUser8080](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/githubuser8080/32/1326_2.png) [@GithubUser8080](https://mediasoup.discourse.group/u/GithubUser8080)\
**Post date:** [November 28, 2023, 2:45pm UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697/1 "2023-11-28T14:45:47Z")

</div>

Hi, i would like to use the directtransport functionality for some processing and i need to synchronize all the producer streams in order to know their wallclock relation. I was hoping to do this using RTCP sender report and use the rtp receive time until then. However the ‘rtcp’ event does not seem to be firing periodically even when multiple producers/consumers exist.

---

<div class="post-metadata">

**Author:** ![GithubUser8080](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/githubuser8080/32/1326_2.png) [@GithubUser8080](https://mediasoup.discourse.group/u/GithubUser8080)\
**Post date:** [November 30, 2023, 8:03am UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697/2 "2023-11-30T08:03:37Z")

</div>

Is it possible that the RTCP event only fires upon injecting RTCP and not on incoming producer RTCP?

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [November 30, 2023, 8:16am UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697/3 "2023-11-30T08:16:38Z")

</div>

- You create a DirectTransport.
- You create a Producer in that DirectTransport via directTransport.produce().
- You call producer.send(rtpPacket).
- You now can listen for “rtcp” event in the DirectTransport.

Not sure if that’s what you are doing.

---

<div class="post-metadata">

**Author:** ![GithubUser8080](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/githubuser8080/32/1326_2.png) [@GithubUser8080](https://mediasoup.discourse.group/u/GithubUser8080)\
**Post date:** [November 30, 2023, 8:29am UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697/4 "2023-11-30T08:29:37Z")

</div>

Thank you, however i am not trying to inject RTCP, but capture it in node the same way i can capture producer RTP with DirectTransport consumers. So i was looking for the equivalent of consmer.on(‘rtp’) but for RTCP. Does anything like this exist? If not, does mediasoup provide any api to get a producers sender report for stream synchronization in node?

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [November 30, 2023, 9:36am UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697/5 "2023-11-30T09:36:27Z")

</div>

> [@GithubUser8080](#):
>
> however i am not trying to inject RTCP,

I didn’t say that you need to inject RTCP.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [November 30, 2023, 9:41am UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697/6 "2023-11-30T09:41:00Z")

</div>

> [@GithubUser8080](#):
>
> but capture it in node the same way i can capture producer RTP with DirectTransport consumers. So i was looking for the equivalent of consmer.on(‘rtp’) but for RTCP

No. mediasoup forwards RTP but it consumes and produces RTCP. It’s a RTCP endpoint, not an intermediary node. It doesn’t forward RTCP. In other words:

- Alice has a producer and sends RTP.
- mediasoup receives it.
- Bob consumers it so its consumer gets RTP.
- Alice sends RTCP.
- mediasoup receives it.
- Bob will NOT receive those RTCP packets.
- mediasoup will generate RTCP packets on its own for Bob.

So the ‘rtcp’ event in a DirectTransport emits with RTCP packets that the mediasoup worker needs to deliver to the producers and consumers you created over that DirectTransport.

There is no `consumer.on('rtcp')` because that’s not how RTCP works. A RTCP packet may contain info about many different sending/receiving streams so mediasoup cannot associate RTCP packets to a single producer or consumer.

---

<div class="post-metadata">

**Author:** ![GithubUser8080](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/githubuser8080/32/1326_2.png) [@GithubUser8080](https://mediasoup.discourse.group/u/GithubUser8080)\
**Post date:** [November 30, 2023, 9:43am UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697/7 "2023-11-30T09:43:20Z")

</div>

Correction, i am not trying to inject anything. Only capture. The producers are remote webrtc peers, not directtransport producers.

1. Have router with a lot of Webrtc peers (basically video conference).
2. Create DirectTransport in node.
3. Create a direct transport consumer for each producer.
4. I can capture their RTP with consumer.on(‘rtp’).
5. I would like to capture their RTCP.
6. RTCP event does not ever fire on transport.

The end goal is to be able to determine, on the node application, the time relation between producers, so that i can synchronize their videos in an encoding pipeline.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [November 30, 2023, 9:51am UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697/8 "2023-11-30T09:51:55Z")

</div>

Yes, I know. As said above that’s not the purpose of “RTCP” event. It’s not intended to spy every RTCP packet sent by a producer to mediasoup.

---

<div class="post-metadata">

**Author:** ![GithubUser8080](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/githubuser8080/32/1326_2.png) [@GithubUser8080](https://mediasoup.discourse.group/u/GithubUser8080)\
**Post date:** [November 30, 2023, 10:50am UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697/9 "2023-11-30T10:50:13Z")

</div>

Understood, thank you. As far as i know, external webrtc consumers (such as browser or gstreamer) use these sender reports (that mediasoup generates) to sync multiple streams between them, associating SR NTP with the RTP timestamp. Would you have a suggestion on how to do that in node where we do not have access to those reports? E.g i can not trust that 2 direct consumers receiving ‘RTP’ event at the same time should play the frame at the same time in a theoretical playback.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [November 30, 2023, 10:59am UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697/10 "2023-11-30T10:59:18Z")

</div>

It’s impossible to do that in Node since, as you said, there is no access to those reports. I don’t have any suggestion, sorry. Your use case is the “receive many in mediasoup and make it behave as if it sending a continuous stream to another endpoint that only can consume a single stream”. That’s not covered.

---

<div class="post-metadata">

**Author:** ![GithubUser8080](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/githubuser8080/32/1326_2.png) [@GithubUser8080](https://mediasoup.discourse.group/u/GithubUser8080)\
**Post date:** [November 30, 2023, 11:14am UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697/11 "2023-11-30T11:14:59Z")

</div>

Exactly, i’m trying to fake a dynamic ‘active speaker’ video stream that mangles video rtp from the participant that is the active speaker into a single continuous stream. And i was hoping this would let me get the timing right when changing the input stream. Ok, thanks again for your help.

---

<div class="post-metadata">

**Author:** ![GithubUser8080](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/githubuser8080/32/1326_2.png) [@GithubUser8080](https://mediasoup.discourse.group/u/GithubUser8080)\
**Post date:** [November 30, 2023, 11:46am UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697/12 "2023-11-30T11:46:22Z")

</div>

Just to make sure, would you please confirm that there is no current way to get a wallclock/rtp timestamp association for a stream in mediasoup Node api?

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [November 30, 2023, 11:54am UTC](https://mediasoup.discourse.group/t/directtransport-rtcp-event-not-emitting/5697/13 "2023-11-30T11:54:05Z")

</div>

I confirm.
