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

obs-webrtc: Various WHIP patches #10577

Merged
merged 3 commits into from
May 12, 2024
Merged
Changes from all 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
20 changes: 15 additions & 5 deletions plugins/obs-webrtc/whip-output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void WHIPOutput::ConfigureVideoTrack(std::string media_stream_id,
packetizer = std::make_shared<rtc::H264RtpPacketizer>(
rtc::H264RtpPacketizer::Separator::StartSequence,
rtp_config, MAX_VIDEO_FRAGMENT_SIZE);
#if ENABLE_HEVC
#ifdef ENABLE_HEVC
} else if (strcmp("hevc", codec) == 0) {
video_description.addH265Codec(video_payload_type);
packetizer = std::make_shared<rtc::H265RtpPacketizer>(
Expand Down Expand Up @@ -583,12 +583,12 @@ void WHIPOutput::Send(void *data, uintptr_t size, uint64_t duration,
// Set new timestamp
rtp_config->timestamp = rtp_config->timestamp + elapsed_timestamp;

// get elapsed time in clock rate from last RTCP sender report
// Get elapsed time in clock rate from last RTCP sender report
auto report_elapsed_timestamp =
rtp_config->timestamp -
rtcp_sr_reporter->lastReportedTimestamp();

// check if last report was at least 1 second ago
// Check if last report was at least 1 second ago
if (rtp_config->timestampToSeconds(report_elapsed_timestamp) > 1)
rtcp_sr_reporter->setNeedsToReport();

Expand All @@ -604,6 +604,13 @@ void register_whip_output()
{
const uint32_t base_flags = OBS_OUTPUT_ENCODED | OBS_OUTPUT_SERVICE;

const char *audio_codecs = "opus";
#ifdef ENABLE_HEVC
const char *video_codecs = "h264;hevc;av1";
#else
const char *video_codecs = "h264;av1";
#endif
RytoEX marked this conversation as resolved.
Show resolved Hide resolved

struct obs_output_info info = {};
info.id = "whip_output";
info.flags = OBS_OUTPUT_AV | base_flags;
Expand Down Expand Up @@ -638,17 +645,20 @@ void register_whip_output()
info.get_connect_time_ms = [](void *priv_data) -> int {
return static_cast<WHIPOutput *>(priv_data)->GetConnectTime();
};
info.encoded_video_codecs = "h264;av1";
info.encoded_audio_codecs = "opus";
info.encoded_video_codecs = video_codecs;
info.encoded_audio_codecs = audio_codecs;
info.protocols = "WHIP";

obs_register_output(&info);

info.id = "whip_output_video";
info.flags = OBS_OUTPUT_VIDEO | base_flags;
info.encoded_audio_codecs = nullptr;
obs_register_output(&info);

info.id = "whip_output_audio";
info.flags = OBS_OUTPUT_AUDIO | base_flags;
info.encoded_video_codecs = nullptr;
info.encoded_audio_codecs = audio_codecs;
obs_register_output(&info);
}
Loading