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

Conversation

sirknightj
Copy link
Contributor

@sirknightj sirknightj commented Dec 4, 2024

Issue #, if available:
-N/A

What was changed?

  • Rolling buffer configuration for audio and video streams in the sample Master WebRTC client application was updated to better fit the sample frames, for H.264, H.265 [video] and opus [audio].
  • This uses the new optional configuration API introduced in Memory Optimization - Rolling Buffer #2077.

Why was it changed?

  • Reduce the memory usage of the sample application. The default rolling buffers are too big, causing extra RTP packets to get stored for the retransmitter (nacks) that the other peer would have considered too old to get retransmitted.

How was it changed?

  • Reduced the bitrate in the rolling buffer parameter for the sample frames.
  • Added calls to configure transceiver rolling buffers with the new parameters, for audio and video separately.

What testing was done for the changes?

  • Ran the updated master sample Ingenic T31, M1 Mac and Ubuntu EC2 and checked the playback (more than the past 3 seconds when the rolling buffer fills up) with the JS and to check for regressions.
  • Added some print statements when the rolling buffer fills up (not committed) to confirm it takes longer than 3 seconds.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sirknightj sirknightj force-pushed the rolling-buffer-sample-frames branch from a407dbb to b576787 Compare December 5, 2024 17:23
@sirknightj sirknightj merged commit 12ef84a into develop Dec 5, 2024
39 checks passed
@sirknightj sirknightj deleted the rolling-buffer-sample-frames branch December 5, 2024 18:02
// to be smaller than the default settings (plus some extra for padding).
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants