libdatachannel icon indicating copy to clipboard operation
libdatachannel copied to clipboard

Sender Report not being sent

Open kuzux opened this issue 4 years ago • 7 comments

While streaming video, I'm currently using an SR Reporter similar to the way it is used in the example https://github.com/paullouisageneau/libdatachannel/blob/master/examples/streamer/main.cpp (I'm calling its startRecording() function once and periodically calling setNeedsToReport())

However, on the receiving end, when calling the getStats method on the peerConnection, I get no StatsReport of type remote-inbound-rtp or remote-outbound-rtp. I'm guessing that is because the browser gets no sender reports to generate these stats. If that is not the reason, how can I tell that the sender reports are actually being received on the browser side?

By the way, the actual issue is that the browser isn't sending any receiver reports (except when sending PLI messages), I just wanted to check that the browser was actually getting the sender reports we were sending before diving deeper into that issue

kuzux avatar Mar 02 '22 15:03 kuzux

RTCP Sender Reports should indeed result in remote-outbound-rtp stats. Does it work with the streamer example? Also, do you have some example code to show how RtcpSrReporter is setup?

paullouisageneau avatar Mar 04 '22 14:03 paullouisageneau

Tried running the streamer example on the same configuration (32 bit windows build). I get remote-outbound-rtp stats from the streamer, but only with kind: audio Screen Shot 2022-03-06 at 22 42 47

As for the code: There are two globals, one for audio and one for video

std::shared_ptr<rtc::RtcpSrReporter> globalSender = nullptr;
std::shared_ptr<rtc::RtcpSrReporter> globalAudioSender = nullptr;

These are initialized (before any connection is established) like

auto srReporter = std::make_shared<rtc::RtcpSrReporter>(rtpConfig);
globalSender = srReporter;

(globalAudioSender is initialized in a similar way)

On track open, we start recording for the reporters

globalSender->rtpConfig->setStartTime(secs, rtc::RtpPacketizationConfig::EpochStart::T1970);
globalAudioSender->rtpConfig->setStartTime(secs, rtc::RtpPacketizationConfig::EpochStart::T1970);

globalSender->startRecording();
globalAudioSender->startRecording();

Finally, while sending video frames, we send a report every n frames (where N is the frames per second)

if (captured % FPS == 0) {
    std::cout << "needs to report\n";
    globalSender->setNeedsToReport();
    globalAudioSender->setNeedsToReport();
}

kuzux avatar Mar 07 '22 07:03 kuzux

Tried running the streamer example on the same configuration (32 bit windows build). I get remote-outbound-rtp stats from the streamer, but only with kind: audio

After testing on my side, remote-outbound-rtp stats are also missing for video. I'm investigating why.

Your setup looks good, it's weird there is no corresponding stats reports in the browser. Is the browser Chrome or Firefox? Could you join the verbose log please?

paullouisageneau avatar Mar 09 '22 16:03 paullouisageneau

The browser is chrome and I've just attached the verbose log (plus my own logging for when setNeedsToReport is called) verboselog.txt

kuzux avatar Mar 10 '22 09:03 kuzux

Thank you, I'm looking into it!

paullouisageneau avatar Mar 11 '22 20:03 paullouisageneau

I'm still stuck on this. What happens in the streamer example is that the sender report for video is ignored by Chrome whereas the one for audio works fine. I think it is the same issue than what you encounter here.

However, I don't know what causes it. It works with Firefox, and the RTCP packet looks good to me. At first I assumed it was an SSRC problem as 1 is used by Chrome as some sort of wildcard, but that's not the issue.

paullouisageneau avatar Mar 23 '22 21:03 paullouisageneau

Is there any update on this about why this happens?

kuzux avatar Aug 29 '22 06:08 kuzux