Skip to content

Commit 8944013

Browse files
GStreamerRegistryScanner: Auto-detect USAC support via GStreamer registry
Add a fallback check for USAC (xHE-AAC) codec support by probing the GStreamer registry for a decoder matching "audio/mpeg, mpegversion=(int)4, stream-format=(string)usac". The stream-format=usac caps field is not part of the standard GStreamer audio/mpeg caps definition, but some custom audio sinks advertise it, so it can be used as an indicator of USAC decoding capability. The WEBKIT_GST_CAN_PLAY_USAC environment variable still takes precedence as a manual override.
1 parent b8dd887 commit 8944013

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,10 @@ void GStreamerRegistryScanner::initializeDecoders(const GStreamerRegistryScanner
499499
// USAC AOT, is not yet widely available enough to be enabled by default.
500500
const char* value = g_getenv("WEBKIT_GST_CAN_PLAY_USAC");
501501
bool canPlayUsac = value && (!g_strcmp0(value, "true") || !g_strcmp0(value, "1"));
502+
if (!value) {
503+
// Env is not set. Fall back to gst elements query
504+
canPlayUsac = factories.hasElementForMediaType(ElementFactories::Type::AudioDecoder, "audio/mpeg, mpegversion=(int)4, stream-format=(string)usac"_s).isSupported;
505+
}
502506
if (canPlayUsac)
503507
m_decoderCodecMap.add("mp4a.40.42"_s, result); // MPEG-4 Extended HE-AAC and xHE-AAC (USAC AOT)
504508
}

0 commit comments

Comments
 (0)