Skip to content
Merged
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
8 changes: 8 additions & 0 deletions .changeset/fix_h264_codec_matching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
webrtc-sys: patch
livekit-ffi: patch
libwebrtc: patch
livekit: patch
---

# Fix H.264 codec matching
21 changes: 21 additions & 0 deletions webrtc-sys/src/video_decoder_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,27 @@ std::unique_ptr<webrtc::VideoDecoder> VideoDecoderFactory::Create(
}
}

// IsSameCodec treats H.264 packetization-modes as distinct codecs, so when
// the SFU sends mode=0 but the platform factory only advertises mode=1 the
// strict match above fails. Retry with the factory's packetization-mode so
// only that parameter is relaxed while the profile-level-id check is kept.
if (absl::EqualsIgnoreCase(format.name, cricket::kH264CodecName)) {
for (const auto& factory : factories_) {
for (const auto& sf : factory->GetSupportedFormats()) {
if (!absl::EqualsIgnoreCase(sf.name, cricket::kH264CodecName))
continue;
auto adjusted = format;
auto it = sf.parameters.find("packetization-mode");
if (it != sf.parameters.end())
adjusted.parameters["packetization-mode"] = it->second;
else
adjusted.parameters.erase("packetization-mode");
if (sf.IsSameCodec(adjusted))
return factory->Create(env, adjusted);
}
}
}

if (absl::EqualsIgnoreCase(format.name, cricket::kVp8CodecName))
return webrtc::CreateVp8Decoder(env);
if (absl::EqualsIgnoreCase(format.name, cricket::kVp9CodecName))
Expand Down
Loading