Changeset 258832 in webkit


Ignore:
Timestamp:
Mar 23, 2020 4:03:58 AM (4 years ago)
Author:
cturner@igalia.com
Message:

[GStreamer] Fail gracefully in the absence of a WebVTT encoder.
https://bugs.webkit.org/show_bug.cgi?id=209290

Reviewed by Philippe Normand.

Covered by existing tests.

  • platform/graphics/gstreamer/GStreamerCommon.cpp:

(WebCore::initializeGStreamer): Gets rid of "plugin not found"
errors. It's not an error to have potentially broken AAC decoders,
but it's nice to give a clear warning.

  • platform/graphics/gstreamer/TextCombinerGStreamer.cpp:

(webkit_text_combiner_class_init):
(webkitTextCombinerNew): Check for the "subenc" *plugin*. This
check indirectly tells us the "webvttenc" *element* will exist.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r258831 r258832  
     12020-03-23  Charlie Turner  <cturner@igalia.com>
     2
     3        [GStreamer] Fail gracefully in the absence of a WebVTT encoder.
     4        https://bugs.webkit.org/show_bug.cgi?id=209290
     5
     6        Reviewed by Philippe Normand.
     7
     8        Covered by existing tests.
     9
     10        * platform/graphics/gstreamer/GStreamerCommon.cpp:
     11        (WebCore::initializeGStreamer): Gets rid of "plugin not found"
     12        errors. It's not an error to have potentially broken AAC decoders,
     13        but it's nice to give a clear warning.
     14        * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
     15        (webkit_text_combiner_class_init):
     16        (webkitTextCombinerNew): Check for the "subenc" *plugin*. This
     17        check indirectly tells us the "webvttenc" *element* will exist.
     18
    1192020-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
    220
  • trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp

    r252917 r258832  
    259259        // libav AAC decoders, due to their broken LC support, as reported in:
    260260        // https://ffmpeg.org/pipermail/ffmpeg-devel/2019-July/247063.html
    261         GRefPtr<GstElement> aacDecoder = gst_element_factory_make("fdkaacdec", nullptr);
    262         if (aacDecoder) {
    263             GstElementFactory* factory = gst_element_get_factory(aacDecoder.get());
    264             gst_plugin_feature_set_rank(GST_PLUGIN_FEATURE_CAST(factory), GST_RANK_PRIMARY);
     261        GRefPtr<GstElementFactory> elementFactory = adoptGRef(gst_element_factory_find("fdkaacdec"));
     262        if (elementFactory) {
     263            gst_plugin_feature_set_rank(GST_PLUGIN_FEATURE_CAST(elementFactory.get()), GST_RANK_PRIMARY);
    265264
    266265            const char* const elementNames[] = {"avdec_aac", "avdec_aac_fixed", "avdec_aac_latm"};
    267266            for (unsigned i = 0; i < G_N_ELEMENTS(elementNames); i++) {
    268                 GRefPtr<GstElement> avAACDecoder = gst_element_factory_make(elementNames[i], nullptr);
    269                 if (avAACDecoder)
    270                     gst_plugin_feature_set_rank(GST_PLUGIN_FEATURE_CAST(gst_element_get_factory(avAACDecoder.get())), GST_RANK_MARGINAL);
     267                GRefPtr<GstElementFactory> avAACDecoderFactory = adoptGRef(gst_element_factory_find(elementNames[i]));
     268                if (avAACDecoderFactory)
     269                    gst_plugin_feature_set_rank(GST_PLUGIN_FEATURE_CAST(avAACDecoderFactory.get()), GST_RANK_MARGINAL);
    271270            }
    272         }
     271        } else
     272            WTFLogAlways("WARNING: You might have broken LC support in your AAC decoders, consider installing fdkaacdec");
    273273
    274274#endif
  • trunk/Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp

    r257468 r258832  
    274274
    275275    GRefPtr<GstElementFactory> webVTTEncFactory = adoptGRef(gst_element_factory_find("webvttenc"));
     276    ASSERT(webVTTEncFactory);
    276277    gst_object_unref(gst_plugin_feature_load(GST_PLUGIN_FEATURE(webVTTEncFactory.get())));
    277278    webVTTEncType = gst_element_factory_get_element_type(webVTTEncFactory.get());
     
    293294GstElement* webkitTextCombinerNew()
    294295{
     296    // The combiner relies on webvttenc, fail early if it's not there.
     297    if (!WebCore::isGStreamerPluginAvailable("subenc")) {
     298        WTFLogAlways("WebKit wasn't able to find a WebVTT encoder. Not continuing without platform support for subtitles.");
     299        return nullptr;
     300    }
     301
    295302    return GST_ELEMENT(g_object_new(WEBKIT_TYPE_TEXT_COMBINER, nullptr));
    296303}
Note: See TracChangeset for help on using the changeset viewer.