Skip to content
Draft
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,39 @@ private class RtxCodecConfigWithLegacy(
}
}

open class H264CodecConfig(base: String, name: String) : RtxCodecConfig(base, name) {
private val profileLevelId: String by config {
"$base.profile-level-id".from(JitsiConfig.newConfig)
}

fun profileLevelId(): String = profileLevelId
}

private class H264CodecConfigWithLegacy(
legacyBase: String,
newBase: String,
name: String
) : H264CodecConfig(newBase, name) {
override val enabled: Boolean by config {
"$legacyBase.ENABLE_$name".from(JitsiConfig.legacyConfig)
"$newBase.enabled".from(JitsiConfig.newConfig)
}

override val pt: Int by config {
"$legacyBase.${name}_PT".from(JitsiConfig.legacyConfig)
"$newBase.pt".from(JitsiConfig.newConfig)
}

override val rtxPt: Int by config {
"$legacyBase.${name}_RTX_PT".from(JitsiConfig.legacyConfig)
"$newBase.rtx-pt".from(JitsiConfig.newConfig)
}

override val enableRemb: Boolean by config {
"$newBase.enable-remb".from(JitsiConfig.newConfig)
}
}

class OpusConfig : CodecConfig("jicofo.codec.audio.opus", "opus") {
private val minptime: Int by config {
"$base.minptime".from(JitsiConfig.newConfig)
Expand Down Expand Up @@ -124,7 +157,7 @@ class Config {
val vp9: RtxCodecConfig = RtxCodecConfigWithLegacy(LEGACY_BASE, "jicofo.codec.video.vp9", "VP9")

@JvmField
val h264: RtxCodecConfig = RtxCodecConfigWithLegacy(LEGACY_BASE, "jicofo.codec.video.h264", "H264")
val h264: H264CodecConfig = H264CodecConfigWithLegacy(LEGACY_BASE, "jicofo.codec.video.h264", "H264")

@JvmField
val opus = OpusConfig()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ class CodecUtil {
// fail to enable h264, if the encoding name is in lower case.
val h264 = createPayloadTypeExtension(config.h264.pt(), "H264", 90000)
h264.addVideoExtensions(options, config.h264)
h264.addParameterExtension("profile-level-id", "42e01f;level-asymmetry-allowed=1;packetization-mode=1;")
h264.addParameterExtension(
"profile-level-id",
"${config.h264.profileLevelId()};level-asymmetry-allowed=1;packetization-mode=1;"
)

add(h264)
}
Expand Down
5 changes: 5 additions & 0 deletions jicofo-common/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ jicofo {
// Payload type for the associated RTX stream. Set to -1 to disable RTX.
rtx-pt = 99
enable-remb = true
// The H.264 profile-level-id advertised in offers. The default (Constrained Baseline, level 3.1) is kept
// for compatibility, but note that some platform encoders do not advertise CBP and browsers match profiles
// exactly, resulting in a software-encode fallback (e.g. macOS VideoToolbox, which only advertises
// Baseline/Main/High -- offering "42001f" instead enables hardware encode there).
profile-level-id = "42e01f"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,20 @@ class CodecUtilTest : ShouldSpec() {
val h264 = CodecUtil.createVideoPayloadTypeExtensions().find { it.name == "H264" }
h264!!.id shouldBe 123
}
context("Default profile-level-id") {
val h264 = CodecUtil.createVideoPayloadTypeExtensions().find { it.name == "H264" }
h264!!.parameters.any {
it.name == "profile-level-id" &&
it.value == "42e01f;level-asymmetry-allowed=1;packetization-mode=1;"
} shouldBe true
}
withNewConfig("jicofo.codec.video.h264.profile-level-id=\"42001f\"") {
val h264 = CodecUtil.createVideoPayloadTypeExtensions().find { it.name == "H264" }
h264!!.parameters.any {
it.name == "profile-level-id" &&
it.value == "42001f;level-asymmetry-allowed=1;packetization-mode=1;"
} shouldBe true
}
}
}
context("Audio") {
Expand Down