decodebin3: support decoding regardless of property 21/294821/2 accepted/tizen/unified/20230711.091724
authorEunhye Choi <eunhae1.choi@samsung.com>
Tue, 27 Jun 2023 05:59:20 +0000 (14:59 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Tue, 27 Jun 2023 06:22:19 +0000 (15:22 +0900)
- support decoding regardless of property setting.
- sw decoder have higher priority if force-sw-decoders property is set.
- if there is no sw decoder when the force-sw-decoders-for-audio/video is enabled,
  use hw decoder instead.

Change-Id: I829fe390e5cb8bf21149c036e3b1ce9d5ae70f85

packaging/gstreamer.spec
subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c

index fe69ab834dd977c792d55f0dc3d12ac90a97896a..d0c4937f484ada3a16d6429700ecddd0e84ca6d3 100644 (file)
@@ -62,7 +62,7 @@
 
 Name:           %{_name}
 Version:        1.22.0
-Release:        31
+Release:        32
 Summary:        Streaming-Media Framework Runtime
 License:        LGPL-2.0+
 Group:          Multimedia/Framework
index 061ea3011dc485a00c654c379c75fb33d0810f11..82cc065862edafe54aca74b0d2c6ca29a3fd9865 100644 (file)
@@ -256,6 +256,9 @@ struct _GstDecodebin3
   GList *factories;
   /* Only DECODER factories */
   GList *decoder_factories;
+#ifdef TIZEN_FEATURE_FORCE_SW_DECODER
+  GList *skipped_decoder_factories;
+#endif
   /* DECODABLE but not DECODER factories */
   GList *decodable_factories;
 
@@ -538,6 +541,9 @@ static void free_multiqueue_slot_async (GstDecodebin3 * dbin,
 
 static GstStreamCollection *get_merged_collection (GstDecodebin3 * dbin);
 static void update_requested_selection (GstDecodebin3 * dbin);
+#ifdef TIZEN_FEATURE_FORCE_SW_DECODER
+static GList *create_decoder_factory_list (GstDecodebin3 * dbin, GstCaps * caps);
+#endif
 
 /* FIXME: Really make all the parser stuff a self-contained helper object */
 #include "gstdecodebin3-parse.c"
@@ -777,6 +783,10 @@ gst_decodebin3_dispose (GObject * object)
     g_list_free (dbin->decoder_factories);
     dbin->decoder_factories = NULL;
   }
+#ifdef TIZEN_FEATURE_FORCE_SW_DECODER
+  if (dbin->skipped_decoder_factories)
+    g_clear_pointer(&dbin->skipped_decoder_factories, g_list_free);
+#endif
   if (dbin->decodable_factories) {
     g_list_free (dbin->decodable_factories);
     dbin->decodable_factories = NULL;
@@ -1331,12 +1341,16 @@ is_parsebin_required_for_input (GstDecodebin3 * dbin, DecodebinInput * input,
     GList *decoder_list;
     /* If the incoming caps are compatible with a decoder, we don't need to
      * process it before */
+#ifdef TIZEN_FEATURE_FORCE_SW_DECODER
+    decoder_list = create_decoder_factory_list (dbin, newcaps);
+#else
     g_mutex_lock (&dbin->factories_lock);
     gst_decode_bin_update_factories_list (dbin);
     decoder_list =
         gst_element_factory_list_filter (dbin->decoder_factories, newcaps,
         GST_PAD_SINK, TRUE);
     g_mutex_unlock (&dbin->factories_lock);
+#endif
     if (decoder_list) {
       GST_FIXME_OBJECT (sinkpad, "parsebin not needed (available decoders) !");
       gst_plugin_feature_list_free (decoder_list);
@@ -1594,6 +1608,10 @@ gst_decode_bin_update_factories_list (GstDecodebin3 * dbin)
     /* Filter decoder and other decodables */
     dbin->decoder_factories = NULL;
     dbin->decodable_factories = NULL;
+#ifdef TIZEN_FEATURE_FORCE_SW_DECODER
+    if (dbin->skipped_decoder_factories)
+      g_clear_pointer(&dbin->skipped_decoder_factories, g_list_free);
+#endif
     for (tmp = dbin->factories; tmp; tmp = tmp->next) {
       GstElementFactory *fact = (GstElementFactory *) tmp->data;
       if (gst_element_factory_list_is_type (fact,
@@ -1608,7 +1626,9 @@ gst_decode_bin_update_factories_list (GstDecodebin3 * dbin)
           dbin->decoder_factories =
               g_list_append (dbin->decoder_factories, fact);
         } else {
-          GST_WARNING("%s is skipped", GST_OBJECT_NAME(fact));
+          GST_DEBUG ("%s is added into skipped list", GST_OBJECT_NAME(fact));
+          dbin->skipped_decoder_factories =
+              g_list_append (dbin->skipped_decoder_factories, fact);
         }
 #endif
       } else {
@@ -2797,6 +2817,13 @@ create_decoder_factory_list (GstDecodebin3 * dbin, GstCaps * caps)
   gst_decode_bin_update_factories_list (dbin);
   res = gst_element_factory_list_filter (dbin->decoder_factories,
       caps, GST_PAD_SINK, TRUE);
+#ifdef TIZEN_FEATURE_FORCE_SW_DECODER
+  if (!res && dbin->skipped_decoder_factories) {
+    GST_DEBUG ("try with skipped decoders");
+    res = gst_element_factory_list_filter (dbin->skipped_decoder_factories,
+        caps, GST_PAD_SINK, TRUE);
+  }
+#endif
   g_mutex_unlock (&dbin->factories_lock);
   return res;
 }