playbin3: Use STREAMS_SELECTED message to update selected stream types

Application might choose only specific type among all available types
using select-streams event. In this case, it is desired that reconfigure
of playsink to clear unused stream path.

https://bugzilla.gnome.org/show_bug.cgi?id=778015
This commit is contained in:
Seungha Yang 2017-03-16 19:53:11 +09:00 committed by Edward Hervey
parent 3de5fd4342
commit 969ab3f48c

View file

@ -2567,7 +2567,8 @@ gst_play_bin3_handle_message (GstBin * bin, GstMessage * msg)
} else if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_STREAMS_SELECTED) {
GstStreamCollection *collection = NULL;
GstObject *src = GST_MESSAGE_SRC (msg);
gboolean pstate = playbin->do_stream_selections;
GstStreamType chosen_stream_types = 0;
gboolean reconfigure_playsink = FALSE;
gst_message_parse_streams_selected (msg, &collection);
if (collection) {
@ -2584,16 +2585,24 @@ gst_play_bin3_handle_message (GstBin * bin, GstMessage * msg)
stream = gst_message_streams_selected_get_stream (msg, i);
set_selected_stream (playbin, stream);
chosen_stream_types |= gst_stream_get_stream_type (stream);
gst_object_unref (stream);
}
if (pstate)
playbin->do_stream_selections = FALSE;
do_stream_selection (playbin);
if (pstate)
playbin->do_stream_selections = TRUE;
if (playbin->selected_stream_types != chosen_stream_types) {
GST_DEBUG_OBJECT (playbin, "Chosen stream types are changed");
reconfigure_playsink = TRUE;
}
playbin->selected_stream_types = chosen_stream_types;
GST_PLAY_BIN3_UNLOCK (playbin);
gst_object_unref (collection);
if (reconfigure_playsink &&
(playbin->selected_stream_types & ~playbin->active_stream_types &
(GST_STREAM_TYPE_VIDEO | GST_STREAM_TYPE_AUDIO)) == 0) {
no_more_pads_cb (playbin->decodebin, playbin);
}
}
}