Skip to content
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

Samples: Fit the RTP transceiver rolling buffers to fit the set of sample frames #2089

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions samples/Common.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,10 @@ STATUS createSampleStreamingSession(PSampleConfiguration pSampleConfiguration, P
CHK_STATUS(addTransceiver(pSampleStreamingSession->pPeerConnection, &videoTrack, &videoRtpTransceiverInit,
&pSampleStreamingSession->pVideoRtcRtpTransceiver));

CHK_STATUS(configureTransceiverRollingBuffer(pSampleStreamingSession->pVideoRtcRtpTransceiver, &videoTrack,
pSampleConfiguration->videoRollingBufferDurationSec,
pSampleConfiguration->videoRollingBufferBitratebps));

CHK_STATUS(transceiverOnBandwidthEstimation(pSampleStreamingSession->pVideoRtcRtpTransceiver, (UINT64) pSampleStreamingSession,
sampleBandwidthEstimationHandler));

Expand All @@ -544,6 +548,10 @@ STATUS createSampleStreamingSession(PSampleConfiguration pSampleConfiguration, P
CHK_STATUS(addTransceiver(pSampleStreamingSession->pPeerConnection, &audioTrack, &audioRtpTransceiverInit,
&pSampleStreamingSession->pAudioRtcRtpTransceiver));

CHK_STATUS(configureTransceiverRollingBuffer(pSampleStreamingSession->pAudioRtcRtpTransceiver, &audioTrack,
pSampleConfiguration->audioRollingBufferDurationSec,
pSampleConfiguration->audioRollingBufferBitratebps));

CHK_STATUS(transceiverOnBandwidthEstimation(pSampleStreamingSession->pAudioRtcRtpTransceiver, (UINT64) pSampleStreamingSession,
sampleBandwidthEstimationHandler));
// twcc bandwidth estimation
Expand Down
4 changes: 4 additions & 0 deletions samples/Samples.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ typedef struct {
SIGNALING_CLIENT_HANDLE signalingClientHandle;
RTC_CODEC audioCodec;
RTC_CODEC videoCodec;
DOUBLE videoRollingBufferDurationSec;
DOUBLE videoRollingBufferBitratebps;
DOUBLE audioRollingBufferDurationSec;
DOUBLE audioRollingBufferBitratebps;
PBYTE pAudioFrameBuffer;
UINT32 audioBufferSize;
PBYTE pVideoFrameBuffer;
Expand Down
14 changes: 14 additions & 0 deletions samples/kvsWebRTCClientMaster.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ INT32 main(INT32 argc, CHAR* argv[])
pSampleConfiguration->audioCodec = audioCodec;
pSampleConfiguration->videoCodec = videoCodec;

// Configure the RTP rolling buffer sizes for the set of pre-canned sample frames (add a bit extra for padding)
sirknightj marked this conversation as resolved.
Show resolved Hide resolved
if (pSampleConfiguration->videoCodec == RTC_CODEC_H264_PROFILE_42E01F_LEVEL_ASYMMETRY_ALLOWED_PACKETIZATION_MODE) {
pSampleConfiguration->videoRollingBufferDurationSec = 3;
pSampleConfiguration->videoRollingBufferBitratebps = 1.4 * 1024 * 1024;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: In the other samples this is not set, meaning default values are used. Since CALLOC is used for the sample configuration, these values are 0 everywhere else. Calling configureTransceiverRollingBuffer with 0's (or also not calling it at all) will use the default values.

} else if (pSampleConfiguration->videoCodec == RTC_CODEC_H265) {
pSampleConfiguration->videoRollingBufferDurationSec = 3;
pSampleConfiguration->videoRollingBufferBitratebps = 462 * 1024;
}

if (pSampleConfiguration->audioCodec == RTC_CODEC_OPUS) {
pSampleConfiguration->audioRollingBufferDurationSec = 3;
pSampleConfiguration->audioRollingBufferBitratebps = 512 * 1024;
}

if (argc > 2 && STRNCMP(argv[2], "1", 2) == 0) {
pSampleConfiguration->channelInfo.useMediaStorage = TRUE;
}
Expand Down
Loading