-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement REMB Handling #201
Conversation
d1ea31c
to
d734710
Compare
Codecov Report
@@ Coverage Diff @@
## master #201 +/- ##
=========================================
Coverage ? 86.64%
=========================================
Files ? 33
Lines ? 7772
Branches ? 0
=========================================
Hits ? 6734
Misses ? 1038
Partials ? 0
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly minor comments but please take a look at the BO issue
@@ -383,6 +383,10 @@ STATUS createSampleStreamingSession(PSampleConfiguration pSampleConfiguration, P | |||
NULL, | |||
&pSampleStreamingSession->pVideoRtcRtpTransceiver)); | |||
|
|||
CHK_STATUS(transceiverOnBandwidthEstimation(pSampleStreamingSession->pVideoRtcRtpTransceiver, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MINOR: Suggest to think through how the bandwidth handler could differentiate between the transceivers. Either have different handlers for audio and video or in this simple case customData could be the differentiator (bad).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think users will pass a handle to their encoders as customData, and go from there. If I was doing GStreamer I would pass a *GSTElement
and have it configure everytime.
* RtcOnBandwidthEstimation is a KVS specific method | ||
* | ||
*/ | ||
typedef VOID (*RtcOnBandwidthEstimation)(UINT64, DOUBLE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more important question. Can the comment contain the link or something to the RFC describing the DOUBLE?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-00#section-2.2 it is given as a mantissa + exponent. I chose DOUBLE just because of the return value of ldexp
@@ -15,6 +15,11 @@ STATUS onRtcpPacket(PKvsPeerConnection pKvsPeerConnection, PBYTE pBuff, UINT32 b | |||
|
|||
if (rtcpPacket.header.packetType == RTCP_PACKET_TYPE_GENERIC_RTP_FEEDBACK && rtcpPacket.header.receptionReportCount == RTCP_FEEDBACK_MESSAGE_TYPE_NACK) { | |||
CHK_STATUS(resendPacketOnNack(&rtcpPacket, pKvsPeerConnection)); | |||
} else if (rtcpPacket.header.packetType == RTCP_PACKET_TYPE_PAYLOAD_SPECIFIC_FEEDBACK && | |||
rtcpPacket.header.receptionReportCount == RTCP_FEEDBACK_MESSAGE_TYPE_APPLICATION_LAYER_FEEDBACK && | |||
isRembPacket(rtcpPacket.payload, rtcpPacket.payloadLength) == STATUS_SUCCESS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CHK_STATUS(isRembPacket(...))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want it to set the return value. We can have some packets that are this value, and then we just want to skip (but not actually an error). I want to keep iterating the compound packet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, of course. You could use STATUS_SUCCEEDED(isRembPacket(...)). Not a big issue
src/source/PeerConnection/Rtcp.c
Outdated
UINT64 item; | ||
|
||
CHK_STATUS(rembValueGet(pRtcpPacket->payload, pRtcpPacket->payloadLength, &maximumBitRate, NULL, &ssrcListLen)); | ||
CHK(NULL != (pSsrcList = (PUINT32) MEMCALLOC(1, SIZEOF(UINT32) * ssrcListLen)), STATUS_STORE_OUT_OF_MEMORY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How big do you expect the buffer to be? If this is anything less than 100K you can simply use stack buffer without dynamic alloc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
255 * uint32_t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You ok with me doing a uint32_t ssrcList[255] = {}
?
src/source/PeerConnection/Rtcp.c
Outdated
} | ||
|
||
CleanUp: | ||
SAFE_MEMFREE(pSsrcList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of on-the-stack buffer you don't need this line
mantissa &= RTCP_PACKET_REMB_MANTISSA_BITMASK; | ||
|
||
exponent = pPayload[RTCP_PACKET_REMB_IDENTIFIER_OFFSET + 5] >> 2; | ||
maximumBitRate = ldexp(mantissa, exponent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should think of adding these things to PICs #commondefs
5cd45dc
to
8aba01d
Compare
Add new callback to RtcRtpTransceiver 'onBandwidthEstimation'. This is now fired everytime we get an REMB packet. In the future we will also fire this for sender side estimation, but at this time nothing is implemented. Resolves #114
@@ -15,6 +15,11 @@ STATUS onRtcpPacket(PKvsPeerConnection pKvsPeerConnection, PBYTE pBuff, UINT32 b | |||
|
|||
if (rtcpPacket.header.packetType == RTCP_PACKET_TYPE_GENERIC_RTP_FEEDBACK && rtcpPacket.header.receptionReportCount == RTCP_FEEDBACK_MESSAGE_TYPE_NACK) { | |||
CHK_STATUS(resendPacketOnNack(&rtcpPacket, pKvsPeerConnection)); | |||
} else if (rtcpPacket.header.packetType == RTCP_PACKET_TYPE_PAYLOAD_SPECIFIC_FEEDBACK && | |||
rtcpPacket.header.receptionReportCount == RTCP_FEEDBACK_MESSAGE_TYPE_APPLICATION_LAYER_FEEDBACK && | |||
isRembPacket(rtcpPacket.payload, rtcpPacket.payloadLength) == STATUS_SUCCESS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, of course. You could use STATUS_SUCCEEDED(isRembPacket(...)). Not a big issue
Codecov Report
@@ Coverage Diff @@
## master #201 +/- ##
==========================================
- Coverage 86.95% 86.64% -0.32%
==========================================
Files 33 33
Lines 7698 7773 +75
==========================================
+ Hits 6694 6735 +41
- Misses 1004 1038 +34
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #201 +/- ##
=========================================
Coverage ? 86.67%
=========================================
Files ? 33
Lines ? 7769
Branches ? 0
=========================================
Hits ? 6734
Misses ? 1035
Partials ? 0
Continue to review full report at Codecov.
|
Add new callback to RtcRtpTransceiver 'onBandwidthEstimation'.
This is now fired everytime we get an REMB packet. In the future we will
also fire this for sender side estimation, but at this time nothing is
implemented.
Resolves #114