Skip to content

Commit

Permalink
obs-webrtc: Adjust RtcpNackResponder from bitrate
Browse files Browse the repository at this point in the history
Before we improperly used the default value set by libdatachannel. At
higher bitrates the cache would be undersized. Because of the undersized
cache we wouldn't have enough NACK history to fix the stream.
  • Loading branch information
Sean-Der committed Apr 11, 2024
1 parent 3d30a4e commit fceae21
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/obs-webrtc/whip-output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const uint8_t audio_payload_type = 111;
const char *video_mid = "1";
const uint8_t video_payload_type = 96;

// Convert Kbps to 'How many 1500 Byte packets in 5 seconds'
const float videoNackStorageFactor = 125.0 / 1500.0 * 5.0;

WHIPOutput::WHIPOutput(obs_data_t *, obs_output_t *output)
: output(output),
is_av1(false),
Expand Down Expand Up @@ -162,7 +165,8 @@ void WHIPOutput::ConfigureVideoTrack(std::string media_stream_id,

video_sr_reporter = std::make_shared<rtc::RtcpSrReporter>(rtp_config);
packetizer->addToChain(video_sr_reporter);
packetizer->addToChain(std::make_shared<rtc::RtcpNackResponder>());
packetizer->addToChain(std::make_shared<rtc::RtcpNackResponder>(
videoNackStorageFactor * video_bitrate));

Check failure on line 169 in plugins/obs-webrtc/whip-output.cpp

View workflow job for this annotation

GitHub Actions / Build 🧱 / macOS 🍏 (arm64)

use of undeclared identifier 'video_bitrate'

Check failure on line 169 in plugins/obs-webrtc/whip-output.cpp

View workflow job for this annotation

GitHub Actions / Build 🧱 / macOS 🍏 (x86_64)

use of undeclared identifier 'video_bitrate'

video_track = peer_connection->addTrack(video_description);
video_track->setMediaHandler(packetizer);
Expand Down

0 comments on commit fceae21

Please sign in to comment.