mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
playbin: Only check sinks which are in >= GST_STATE_READY
Otherwise we endup with bogus caps intersection (from the pad template caps and not from what the actual hardware/device supports) https://bugzilla.gnome.org/show_bug.cgi?id=738131
This commit is contained in:
parent
e2a693656b
commit
6a2f017bfa
1 changed files with 30 additions and 19 deletions
|
@ -4325,25 +4325,29 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
|
||||||
GstSourceGroup * group)
|
GstSourceGroup * group)
|
||||||
{
|
{
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
GstElement *sink;
|
|
||||||
GstPad *sinkpad = NULL;
|
GstPad *sinkpad = NULL;
|
||||||
|
gboolean activated_sink;
|
||||||
|
|
||||||
GST_SOURCE_GROUP_LOCK (group);
|
GST_SOURCE_GROUP_LOCK (group);
|
||||||
|
|
||||||
if ((sink = group->text_sink))
|
if (group->text_sink &&
|
||||||
sinkpad = gst_element_get_static_pad (sink, "sink");
|
activate_sink (group->playbin, group->text_sink, &activated_sink)) {
|
||||||
if (sinkpad) {
|
sinkpad = gst_element_get_static_pad (group->text_sink, "sink");
|
||||||
GstCaps *sinkcaps;
|
if (sinkpad) {
|
||||||
|
GstCaps *sinkcaps;
|
||||||
|
|
||||||
sinkcaps = gst_pad_query_caps (sinkpad, NULL);
|
sinkcaps = gst_pad_query_caps (sinkpad, NULL);
|
||||||
if (!gst_caps_is_any (sinkcaps))
|
if (!gst_caps_is_any (sinkcaps))
|
||||||
ret = !gst_pad_query_accept_caps (sinkpad, caps);
|
ret = !gst_pad_query_accept_caps (sinkpad, caps);
|
||||||
gst_caps_unref (sinkcaps);
|
gst_caps_unref (sinkcaps);
|
||||||
gst_object_unref (sinkpad);
|
gst_object_unref (sinkpad);
|
||||||
} else {
|
} else {
|
||||||
GstCaps *subcaps = gst_subtitle_overlay_create_factory_caps ();
|
GstCaps *subcaps = gst_subtitle_overlay_create_factory_caps ();
|
||||||
ret = !gst_caps_is_subset (caps, subcaps);
|
ret = !gst_caps_is_subset (caps, subcaps);
|
||||||
gst_caps_unref (subcaps);
|
gst_caps_unref (subcaps);
|
||||||
|
}
|
||||||
|
if (activated_sink)
|
||||||
|
gst_element_set_state (group->text_sink, GST_STATE_NULL);
|
||||||
}
|
}
|
||||||
/* If autoplugging can stop don't do additional checks */
|
/* If autoplugging can stop don't do additional checks */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -4356,8 +4360,10 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
|
||||||
GST_OBJECT_CAST (group->suburidecodebin)))
|
GST_OBJECT_CAST (group->suburidecodebin)))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if ((sink = group->audio_sink)) {
|
if (group->audio_sink &&
|
||||||
sinkpad = gst_element_get_static_pad (sink, "sink");
|
activate_sink (group->playbin, group->audio_sink, &activated_sink)) {
|
||||||
|
|
||||||
|
sinkpad = gst_element_get_static_pad (group->audio_sink, "sink");
|
||||||
if (sinkpad) {
|
if (sinkpad) {
|
||||||
GstCaps *sinkcaps;
|
GstCaps *sinkcaps;
|
||||||
|
|
||||||
|
@ -4367,12 +4373,15 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
|
||||||
gst_caps_unref (sinkcaps);
|
gst_caps_unref (sinkcaps);
|
||||||
gst_object_unref (sinkpad);
|
gst_object_unref (sinkpad);
|
||||||
}
|
}
|
||||||
|
if (activated_sink)
|
||||||
|
gst_element_set_state (group->audio_sink, GST_STATE_NULL);
|
||||||
}
|
}
|
||||||
if (!ret)
|
if (!ret)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if ((sink = group->video_sink)) {
|
if (group->video_sink
|
||||||
sinkpad = gst_element_get_static_pad (sink, "sink");
|
&& activate_sink (group->playbin, group->video_sink, &activated_sink)) {
|
||||||
|
sinkpad = gst_element_get_static_pad (group->video_sink, "sink");
|
||||||
if (sinkpad) {
|
if (sinkpad) {
|
||||||
GstCaps *sinkcaps;
|
GstCaps *sinkcaps;
|
||||||
|
|
||||||
|
@ -4382,6 +4391,8 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
|
||||||
gst_caps_unref (sinkcaps);
|
gst_caps_unref (sinkcaps);
|
||||||
gst_object_unref (sinkpad);
|
gst_object_unref (sinkpad);
|
||||||
}
|
}
|
||||||
|
if (activated_sink)
|
||||||
|
gst_element_set_state (group->video_sink, GST_STATE_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -4628,7 +4639,7 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad,
|
||||||
|
|
||||||
/* now see if we already have a sink element */
|
/* now see if we already have a sink element */
|
||||||
GST_SOURCE_GROUP_LOCK (group);
|
GST_SOURCE_GROUP_LOCK (group);
|
||||||
if (*sinkp) {
|
if (*sinkp && GST_STATE (*sinkp) >= GST_STATE_READY) {
|
||||||
GstElement *sink = gst_object_ref (*sinkp);
|
GstElement *sink = gst_object_ref (*sinkp);
|
||||||
|
|
||||||
if (sink_accepts_caps (playbin, sink, caps)) {
|
if (sink_accepts_caps (playbin, sink, caps)) {
|
||||||
|
|
Loading…
Reference in a new issue