dashdemux2: Fix the way we determine current_position after seeks

Without that the current_position was off after seeks, potentially
leading to not properly push a last fragment when a `.stop` time was
set.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3159>
This commit is contained in:
Thibault Saunier 2022-10-04 18:21:15 -03:00 committed by GStreamer Marge Bot
parent 4f991a55af
commit 1c1b0380cb
6 changed files with 79 additions and 5 deletions

@ -1 +1 @@
Subproject commit 96635014c4a9152afe5bd4bb894d459e79225c02
Subproject commit bc766cb9a23c38bfc68dda05349a40edd5d06937

View file

@ -927,6 +927,7 @@ validate.test.aspectcropratio.set_aspect_ratio_in_paused
validate.test.baseparse.single_seek
validate.test.clock_sync.video_1fps
validate.test.clock_sync.video_30fps
validate.test.dash.seek_with_stop_between_fragments
validate.test.decryptor.cenc_audio_esds_property_overrides
validate.test.flow.simple_test
validate.test.flvdemux.audio_only.play_15s

View file

@ -0,0 +1,16 @@
meta,
handles-states=true,
needs-http-server=true,
ignore-eos=true,
args = {
"uridecodebin3 uri=http://127.0.0.1:8079/defaults/dash/webm/output.mpd ! fakevideosink sync=true name=i",
},
configs = {
"$(validateflow), pad=i:sink, ignored-event-types={ tag }, buffers-checksum=as-id",
}
pause
seek, flags=flush+accurate, start=5.70, stop=7.00
play
crank-clock, repeat=33
stop

View file

@ -0,0 +1,41 @@
event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1, stream=(GstStream)"\(GstStream\)\ video-0";
event caps: video/x-raw, colorimetry=(string)2:4:0:0, format=(string)I420, framerate=(fraction)0/1, height=(int)446, interlace-mode=(string)progressive, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, width=(int)928;
event segment: format=TIME, start=0:00:00.014000000, offset=0:00:00.000000000, stop=none, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.000000000
event stream-collection: stream-collection, collection=(GstStreamCollection)"\(GstStreamCollection\)\ streamcollection0";
buffer: content-id=0, pts=0:00:00.014000000, flags=discont, meta=GstVideoMeta
event flush-start: (no structure)
event flush-stop: GstEventFlushStop, reset-time=(boolean)true;
event segment: format=TIME, start=0:00:05.700000000, offset=0:00:00.000000000, stop=0:00:07.000000000, flags=0x01, time=0:00:05.700000000, base=0:00:00.000000000, position=0:00:00.000000000
buffer: content-id=1, pts=0:00:05.700000000, flags=discont, meta=GstVideoMeta
buffer: content-id=2, pts=0:00:05.727000000, meta=GstVideoMeta
buffer: content-id=3, pts=0:00:05.777000000, meta=GstVideoMeta
buffer: content-id=4, pts=0:00:05.811000000, meta=GstVideoMeta
buffer: content-id=5, pts=0:00:05.861000000, meta=GstVideoMeta
buffer: content-id=6, pts=0:00:05.894000000, meta=GstVideoMeta
buffer: content-id=7, pts=0:00:05.944000000, meta=GstVideoMeta
buffer: content-id=8, pts=0:00:05.977000000, meta=GstVideoMeta
buffer: content-id=9, pts=0:00:06.027000000, meta=GstVideoMeta
buffer: content-id=10, pts=0:00:06.061000000, meta=GstVideoMeta
buffer: content-id=11, pts=0:00:06.111000000, meta=GstVideoMeta
buffer: content-id=12, pts=0:00:06.144000000, meta=GstVideoMeta
buffer: content-id=13, pts=0:00:06.194000000, meta=GstVideoMeta
buffer: content-id=14, pts=0:00:06.227000000, meta=GstVideoMeta
buffer: content-id=15, pts=0:00:06.277000000, meta=GstVideoMeta
buffer: content-id=16, pts=0:00:06.311000000, meta=GstVideoMeta
buffer: content-id=17, pts=0:00:06.361000000, meta=GstVideoMeta
buffer: content-id=18, pts=0:00:06.394000000, meta=GstVideoMeta
buffer: content-id=19, pts=0:00:06.444000000, meta=GstVideoMeta
buffer: content-id=20, pts=0:00:06.477000000, meta=GstVideoMeta
buffer: content-id=21, pts=0:00:06.527000000, meta=GstVideoMeta
buffer: content-id=22, pts=0:00:06.561000000, meta=GstVideoMeta
buffer: content-id=23, pts=0:00:06.611000000, meta=GstVideoMeta
buffer: content-id=24, pts=0:00:06.644000000, meta=GstVideoMeta
buffer: content-id=25, pts=0:00:06.694000000, meta=GstVideoMeta
buffer: content-id=26, pts=0:00:06.727000000, meta=GstVideoMeta
buffer: content-id=27, pts=0:00:06.777000000, meta=GstVideoMeta
buffer: content-id=28, pts=0:00:06.811000000, meta=GstVideoMeta
buffer: content-id=29, pts=0:00:06.861000000, meta=GstVideoMeta
buffer: content-id=30, pts=0:00:06.894000000, meta=GstVideoMeta
buffer: content-id=31, pts=0:00:06.944000000, meta=GstVideoMeta
buffer: content-id=32, pts=0:00:06.977000000, meta=GstVideoMeta
event eos: (no structure)

View file

@ -2736,6 +2736,7 @@ static GstFlowReturn
gst_dash_demux_stream_fragment_finished (GstAdaptiveDemux * demux,
GstAdaptiveDemux2Stream * stream)
{
GstClockTime consumed_duration;
GstDashDemux2 *dashdemux = GST_DASH_DEMUX_CAST (demux);
GstDashDemux2Stream *dashstream = (GstDashDemux2Stream *) stream;
@ -2768,8 +2769,19 @@ gst_dash_demux_stream_fragment_finished (GstAdaptiveDemux * demux,
if (G_UNLIKELY (stream->downloading_header || stream->downloading_index))
return GST_FLOW_OK;
if (GST_CLOCK_TIME_IS_VALID (stream->start_position) &&
stream->start_position == stream->current_position) {
consumed_duration =
(stream->fragment.stream_time + stream->fragment.duration) -
stream->current_position;
GST_LOG_OBJECT (demux, "Consumed duration after seeking: %"
GST_TIMEP_FORMAT, &consumed_duration);
} else {
consumed_duration = stream->fragment.duration;
}
return gst_adaptive_demux2_stream_advance_fragment (demux, stream,
stream->fragment.duration);
consumed_duration);
}
static gboolean

View file

@ -3894,9 +3894,13 @@ gst_adaptive_demux2_stream_has_next_fragment (GstAdaptiveDemux * demux,
}
/* must be called from the scheduler */
/* Called from:
* the ::finish_fragment() handlers when an *actual* fragment is done
* */
/* Called from: the ::finish_fragment() handlers when an *actual* fragment is
* done
*
* @duration: Is the duration of the advancement starting from
* stream->current_position which might not be the fragment duration after a
* seek.
*/
GstFlowReturn
gst_adaptive_demux2_stream_advance_fragment (GstAdaptiveDemux * demux,
GstAdaptiveDemux2Stream * stream, GstClockTime duration)