decodebin3: Do not try to plug a decoder on raw formats
authorThibault Saunier <tsaunier@igalia.com>
Mon, 3 Oct 2022 18:20:53 +0000 (15:20 -0300)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 6 Oct 2022 08:41:49 +0000 (08:41 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3123>

subprojects/gst-integration-testsuites/testsuites/validate.testslist
subprojects/gst-integration-testsuites/testsuites/validate/playbin3/ignore_raw_audio_from_demuxer.validatetest [new file with mode: 0644]
subprojects/gst-plugins-base/gst/playback/gstdecodebin3-parse.c

index bf5d235..f24e1aa 100644 (file)
@@ -943,6 +943,7 @@ validate.test.mp4.qtdemux_reverse_playback_full_gop.reverse_playback_full_gop
 validate.test.mp4.redirect.play_15s
 validate.test.nle.urisource.play
 validate.test.playbin.check_active_stream
+validate.test.playbin3.ignore_raw_audio_from_demuxer
 validate.test.playbin3.sourcebin_check_mixed_static_and_dyanmic_pads
 validate.test.rtp.h264.payloader_fail_nego_force_profile
 validate.test.rtp.h264.payloader_nego_profile
diff --git a/subprojects/gst-integration-testsuites/testsuites/validate/playbin3/ignore_raw_audio_from_demuxer.validatetest b/subprojects/gst-integration-testsuites/testsuites/validate/playbin3/ignore_raw_audio_from_demuxer.validatetest
new file mode 100644 (file)
index 0000000..43e8137
--- /dev/null
@@ -0,0 +1,10 @@
+set-globals, media_dir="$(test_dir)/../../../medias/"
+
+meta,
+    handles-states=true,
+    args = {
+        "uridecodebin3 uri=\"file://$(media_dir)/defaults/mp4/raw_h264.0.mp4\" caps=video/x-raw ! $(videosink) ",
+    }
+
+pause
+stop
index d5b0566..6675aae 100644 (file)
@@ -197,6 +197,16 @@ check_parser_caps_filter (GstDecodebin3 * dbin, GstCaps * caps)
 {
   GList *tmp;
   gboolean res = FALSE;
+  GstCaps *default_raw = gst_static_caps_get (&default_raw_caps);
+
+  if (gst_caps_can_intersect (caps, default_raw)) {
+    GST_INFO_OBJECT (dbin, "Dealing with raw stream from the demuxer, "
+        " we can handle them even if we won't expose then");
+    gst_caps_unref (default_raw);
+
+    return TRUE;
+  }
+  gst_caps_unref (default_raw);
 
   g_mutex_lock (&dbin->factories_lock);
   gst_decode_bin_update_factories_list (dbin);
@@ -223,7 +233,7 @@ check_parser_caps_filter (GstDecodebin3 * dbin, GstCaps * caps)
   }
 beach:
   g_mutex_unlock (&dbin->factories_lock);
-  GST_DEBUG_OBJECT (dbin, "Can intersect : %d", res);
+  GST_DEBUG_OBJECT (dbin, "Can intersect %" GST_PTR_FORMAT ": %d", caps, res);
   return res;
 }
 
@@ -341,9 +351,9 @@ parse_chain_output_probe (GstPad * pad, GstPadProbeInfo * info,
       GstCaps *prop = NULL;
       gst_query_parse_accept_caps (q, &prop);
       /* Fast check against target caps */
-      if (gst_caps_can_intersect (prop, input->dbin->caps))
+      if (gst_caps_can_intersect (prop, input->dbin->caps)) {
         gst_query_set_accept_caps_result (q, TRUE);
-      else {
+      else {
         gboolean accepted = check_parser_caps_filter (input->dbin, prop);
         /* check against caps filter */
         gst_query_set_accept_caps_result (q, accepted);