validate: Use presence of STREAM_START to detect track switching

When doing a track switch, the only reliable way to detect that it
happened is whether a new STREAM_START arrives.
Relying on a DISCONT buffer is not satisfactory, since there might
not have been an element setting that flag upstream.

Checking whether the first buffer after a STREAM_START has the
DISCONT flag properly set should be done in parallel
This commit is contained in:
Edward Hervey 2015-11-23 15:11:58 +01:00 committed by Edward Hervey
parent 0799397768
commit e5f381b96a

View file

@ -257,15 +257,13 @@ _execute_set_subtitles (GstValidateScenario * scenario,
} }
static GstPadProbeReturn static GstPadProbeReturn
_check_pad_selection_done (GstPad * pad, GstPadProbeInfo * info, _check_pad_event_selection_done (GstPad * pad, GstPadProbeInfo * info,
GstValidateAction * action) GstValidateAction * action)
{ {
if (GST_BUFFER_FLAG_IS_SET (info->data, GST_BUFFER_FLAG_DISCONT)) { if (GST_EVENT_TYPE (info->data) == GST_EVENT_STREAM_START) {
gst_validate_action_set_done (action); gst_validate_action_set_done (action);
return GST_PAD_PROBE_REMOVE; return GST_PAD_PROBE_REMOVE;
} }
return GST_PAD_PROBE_OK; return GST_PAD_PROBE_OK;
} }
@ -350,8 +348,9 @@ _execute_switch_track (GstValidateScenario * scenario,
if (srcpad) { if (srcpad) {
gst_pad_add_probe (srcpad, gst_pad_add_probe (srcpad,
GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
(GstPadProbeCallback) _check_pad_selection_done, action, NULL); (GstPadProbeCallback) _check_pad_event_selection_done, action,
NULL);
gst_object_unref (srcpad); gst_object_unref (srcpad);
res = GST_VALIDATE_EXECUTE_ACTION_ASYNC; res = GST_VALIDATE_EXECUTE_ACTION_ASYNC;