@@ -106,15 +106,22 @@ std::unique_ptr<webrtc::VideoDecoder> VideoDecoderFactory::Create(
106106 }
107107 }
108108
109- // Platform HW decoders (VideoToolbox, MediaCodec) can decode any H.264
110- // stream regardless of packetization-mode. IsSameCodec treats different
111- // packetization-modes as distinct codecs, so when the SFU sends mode=0 but
112- // the platform factory only advertises mode=1 the strict match above fails.
113- // Retry with a relaxed name-only check before falling through to software.
109+ // IsSameCodec treats H.264 packetization-modes as distinct codecs, so when
110+ // the SFU sends mode=0 but the platform factory only advertises mode=1 the
111+ // strict match above fails. Retry with the factory's packetization-mode so
112+ // only that parameter is relaxed while the profile-level-id check is kept.
114113 if (absl::EqualsIgnoreCase (format.name , cricket::kH264CodecName )) {
115114 for (const auto & factory : factories_) {
116115 for (const auto & sf : factory->GetSupportedFormats ()) {
117- if (absl::EqualsIgnoreCase (sf.name , cricket::kH264CodecName ))
116+ if (!absl::EqualsIgnoreCase (sf.name , cricket::kH264CodecName ))
117+ continue ;
118+ auto adjusted = format;
119+ auto it = sf.parameters .find (" packetization-mode" );
120+ if (it != sf.parameters .end ())
121+ adjusted.parameters [" packetization-mode" ] = it->second ;
122+ else
123+ adjusted.parameters .erase (" packetization-mode" );
124+ if (sf.IsSameCodec (adjusted))
118125 return factory->Create (env, format);
119126 }
120127 }
0 commit comments