mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 09:41:07 +00:00
nlecomposition: Let parent compositions tell if they will send initialization seeks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5035>
This commit is contained in:
parent
daa1519e3d
commit
63ce3c8da6
8 changed files with 108 additions and 9 deletions
|
@ -219,7 +219,6 @@ typedef struct
|
|||
{
|
||||
GMutex lock;
|
||||
gboolean needs_initialization_seek;
|
||||
gboolean answered;
|
||||
} NleCompositionQueryNeedsInitializationSeek;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
|
@ -1063,13 +1062,15 @@ nle_composition_handle_message (GstBin * bin, GstMessage * message)
|
|||
&& GST_MESSAGE_SRC (message) != GST_OBJECT_CAST (comp)) {
|
||||
NleCompositionQueryNeedsInitializationSeek *q;
|
||||
|
||||
/* First let parents answer */
|
||||
GST_BIN_CLASS (parent_class)->handle_message (bin, message);
|
||||
|
||||
gst_structure_get (structure, "query",
|
||||
NLE_TYPE_COMPOSITION_QUERY_NEEDS_INITIALIZATION_SEEK, &q, NULL);
|
||||
g_assert (q);
|
||||
|
||||
g_mutex_lock (&q->lock);
|
||||
if (!q->answered || q->needs_initialization_seek) {
|
||||
q->answered = TRUE;
|
||||
if (q->needs_initialization_seek) {
|
||||
q->needs_initialization_seek = priv->stack_initialization_seek == NULL;
|
||||
}
|
||||
g_mutex_unlock (&q->lock);
|
||||
|
@ -1781,6 +1782,7 @@ nle_composition_query_needs_topelevel_initializing_seek (NleComposition * comp)
|
|||
{
|
||||
NleCompositionQueryNeedsInitializationSeek *q =
|
||||
g_atomic_rc_box_new0 (NleCompositionQueryNeedsInitializationSeek);
|
||||
q->needs_initialization_seek = TRUE;
|
||||
|
||||
GstMessage *m = gst_message_new_element (GST_OBJECT_CAST (comp),
|
||||
gst_structure_new (QUERY_NEEDS_INITIALIZATION_SEEK_MESSAGE_STRUCT_NAME,
|
||||
|
@ -1794,12 +1796,7 @@ nle_composition_query_needs_topelevel_initializing_seek (NleComposition * comp)
|
|||
|
||||
gboolean res = TRUE;
|
||||
g_mutex_lock (&q->lock);
|
||||
if (q->answered) {
|
||||
res = q->needs_initialization_seek;
|
||||
if (!res) {
|
||||
GST_INFO_OBJECT (comp, "Parent composition is going to seek us");
|
||||
}
|
||||
}
|
||||
res = q->needs_initialization_seek;
|
||||
g_mutex_unlock (&q->lock);
|
||||
g_atomic_rc_box_release (q);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ endif
|
|||
tests = [
|
||||
'nle/simple_source_playback',
|
||||
'nle/simple_source_in_composition_playback',
|
||||
'nle/ensure_no_unnecessary_stack_init_seeks',
|
||||
]
|
||||
|
||||
env = environment()
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
# Sets up 3 levels of nested composition and verify the dataflow.
|
||||
# This allows us to verify that we do not end up seeking nested
|
||||
# timelines unnecessarily.
|
||||
meta,
|
||||
handles-states=true,
|
||||
ignore-eos=true,
|
||||
args={
|
||||
"nlecomposition name=compo ! video/x-raw,format=(string)YUY2,framerate=(fraction)30/1,height=(int)240,interlace-mode=(string)progressive, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, width=(int)320 ! videoconvert ! $(videosink)",
|
||||
},
|
||||
configs = {
|
||||
"$(validateflow), pad=overlay:src, buffers-checksum=as-id, ignored-event-types={ tag }, ignored-fields = \"buffer={meta}\"",
|
||||
"$(validateflow), pad=source_L0:src, buffers-checksum=as-id, ignored-event-types={ tag }",
|
||||
"$(validateflow), pad=source_L1:src, buffers-checksum=as-id, ignored-event-types={ tag }",
|
||||
"$(validateflow), pad=source_L2:src, buffers-checksum=as-id, ignored-event-types={ tag }",
|
||||
"$(validateflow), pad=source_L3:src, buffers-checksum=as-id, ignored-event-types={ tag }",
|
||||
}
|
||||
|
||||
nle-add-child, object-name="compo", desc="nlesource name=source_L0 inpoint=0 duration=200000000"
|
||||
nle-add-child, object-name="source_L0", desc="nlecomposition name=compo_L1"
|
||||
nle-add-child, object-name="compo_L1", desc="nlesource name=source_L1 inpoint=0 duration=200000000"
|
||||
nle-add-child, object-name="source_L1", desc="nlecomposition name=compo_L2"
|
||||
nle-add-child, object-name="compo_L2", desc="nlesource name=source_L2 inpoint=0 duration=200000000"
|
||||
nle-add-child, object-name="source_L2", desc="nlecomposition name=compo_L3"
|
||||
nle-add-child, object-name="compo_L3", desc="nlesource name=source_L3 inpoint=200000000 duration=200000000"
|
||||
nle-add-child, object-name="source_L3", desc="videotestsrc ! timeoverlay name=overlay"
|
||||
|
||||
play
|
||||
check-position, on-message=eos, expected-position=0.2
|
||||
|
||||
stop
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1;
|
||||
event caps: video/x-raw, format=(string)YUY2, framerate=(fraction)30/1, height=(int)240, interlace-mode=(string)progressive, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, width=(int)320;
|
||||
event flush-start: (no structure)
|
||||
event flush-stop: GstEventFlushStop, reset-time=(boolean)true;
|
||||
event segment: format=TIME, start=0:00:00.200000000, offset=0:00:00.000000000, stop=0:00:00.400000000, flags=0x01, time=0:00:00.200000000, base=0:00:00.000000000, position=0:00:00.200000000
|
||||
buffer: content-id=0, pts=0:00:00.200000000, dur=0:00:00.033333333, flags=discont
|
||||
buffer: content-id=1, pts=0:00:00.233333333, dur=0:00:00.033333333
|
||||
buffer: content-id=2, pts=0:00:00.266666666, dur=0:00:00.033333334
|
||||
buffer: content-id=3, pts=0:00:00.300000000, dur=0:00:00.033333333
|
||||
buffer: content-id=4, pts=0:00:00.333333333, dur=0:00:00.033333333
|
||||
buffer: content-id=5, pts=0:00:00.366666666, dur=0:00:00.033333334
|
||||
event eos: (no structure)
|
|
@ -0,0 +1,16 @@
|
|||
event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE;
|
||||
event caps: video/x-raw, format=(string)YUY2, framerate=(fraction)30/1, height=(int)240, interlace-mode=(string)progressive, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, width=(int)320;
|
||||
event caps: video/x-raw, format=(string)YUY2, framerate=(fraction)30/1, height=(int)240, interlace-mode=(string)progressive, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, width=(int)320;
|
||||
event flush-start: (no structure)
|
||||
event flush-stop: GstEventFlushStop, reset-time=(boolean)true;
|
||||
event caps: video/x-raw, format=(string)YUY2, framerate=(fraction)30/1, height=(int)240, interlace-mode=(string)progressive, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, width=(int)320;
|
||||
event segment: format=TIME, start=0:00:00.200000000, offset=0:00:00.000000000, stop=0:00:00.400000000, flags=0x01, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.200000000
|
||||
buffer: content-id=0, pts=0:00:00.200000000, dur=0:00:00.033333333, flags=discont
|
||||
buffer: content-id=1, pts=0:00:00.233333333, dur=0:00:00.033333333
|
||||
buffer: content-id=2, pts=0:00:00.266666666, dur=0:00:00.033333334
|
||||
buffer: content-id=3, pts=0:00:00.300000000, dur=0:00:00.033333333
|
||||
buffer: content-id=4, pts=0:00:00.333333333, dur=0:00:00.033333333
|
||||
buffer: content-id=5, pts=0:00:00.366666666, dur=0:00:00.033333334
|
||||
event eos: (no structure)
|
||||
event flush-start: (no structure)
|
||||
event flush-stop: GstEventFlushStop, reset-time=(boolean)true;
|
|
@ -0,0 +1,14 @@
|
|||
event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE;
|
||||
event caps: video/x-raw, format=(string)YUY2, framerate=(fraction)30/1, height=(int)240, interlace-mode=(string)progressive, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, width=(int)320;
|
||||
event flush-start: (no structure)
|
||||
event flush-stop: GstEventFlushStop, reset-time=(boolean)true;
|
||||
event segment: format=TIME, start=0:00:00.200000000, offset=0:00:00.000000000, stop=0:00:00.400000000, flags=0x01, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.200000000
|
||||
buffer: content-id=0, pts=0:00:00.200000000, dur=0:00:00.033333333, flags=discont
|
||||
buffer: content-id=1, pts=0:00:00.233333333, dur=0:00:00.033333333
|
||||
buffer: content-id=2, pts=0:00:00.266666666, dur=0:00:00.033333334
|
||||
buffer: content-id=3, pts=0:00:00.300000000, dur=0:00:00.033333333
|
||||
buffer: content-id=4, pts=0:00:00.333333333, dur=0:00:00.033333333
|
||||
buffer: content-id=5, pts=0:00:00.366666666, dur=0:00:00.033333334
|
||||
event eos: (no structure)
|
||||
event flush-start: (no structure)
|
||||
event flush-stop: GstEventFlushStop, reset-time=(boolean)true;
|
|
@ -0,0 +1,14 @@
|
|||
event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE;
|
||||
event caps: video/x-raw, format=(string)YUY2, framerate=(fraction)30/1, height=(int)240, interlace-mode=(string)progressive, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, width=(int)320;
|
||||
event flush-start: (no structure)
|
||||
event flush-stop: GstEventFlushStop, reset-time=(boolean)true;
|
||||
event segment: format=TIME, start=0:00:00.200000000, offset=0:00:00.000000000, stop=0:00:00.400000000, flags=0x01, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.200000000
|
||||
buffer: content-id=0, pts=0:00:00.200000000, dur=0:00:00.033333333, flags=discont
|
||||
buffer: content-id=1, pts=0:00:00.233333333, dur=0:00:00.033333333
|
||||
buffer: content-id=2, pts=0:00:00.266666666, dur=0:00:00.033333334
|
||||
buffer: content-id=3, pts=0:00:00.300000000, dur=0:00:00.033333333
|
||||
buffer: content-id=4, pts=0:00:00.333333333, dur=0:00:00.033333333
|
||||
buffer: content-id=5, pts=0:00:00.366666666, dur=0:00:00.033333334
|
||||
event eos: (no structure)
|
||||
event flush-start: (no structure)
|
||||
event flush-stop: GstEventFlushStop, reset-time=(boolean)true;
|
|
@ -0,0 +1,14 @@
|
|||
event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1;
|
||||
event caps: video/x-raw, format=(string)YUY2, framerate=(fraction)30/1, height=(int)240, interlace-mode=(string)progressive, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, width=(int)320;
|
||||
event flush-start: (no structure)
|
||||
event flush-stop: GstEventFlushStop, reset-time=(boolean)true;
|
||||
event segment: format=TIME, start=0:00:00.200000000, offset=0:00:00.000000000, stop=0:00:00.400000000, flags=0x01, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.200000000
|
||||
buffer: content-id=0, pts=0:00:00.200000000, dur=0:00:00.033333333, flags=discont
|
||||
buffer: content-id=1, pts=0:00:00.233333333, dur=0:00:00.033333333
|
||||
buffer: content-id=2, pts=0:00:00.266666666, dur=0:00:00.033333334
|
||||
buffer: content-id=3, pts=0:00:00.300000000, dur=0:00:00.033333333
|
||||
buffer: content-id=4, pts=0:00:00.333333333, dur=0:00:00.033333333
|
||||
buffer: content-id=5, pts=0:00:00.366666666, dur=0:00:00.033333334
|
||||
event eos: (no structure)
|
||||
event flush-start: (no structure)
|
||||
event flush-stop: GstEventFlushStop, reset-time=(boolean)true;
|
Loading…
Reference in a new issue