mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
tsdemux: forward upstream time segments after flushes
Also reset segment info and drop the segment event when demuxer is flushed. Restore demuxer segment with the info stored in base when demuxer is going to push data again if needed. Drop code to recover the segment info from base in the initial program becauses it's superseded by the new code.
This commit is contained in:
parent
9f7e7d305d
commit
3d012665f0
1 changed files with 22 additions and 7 deletions
|
@ -324,7 +324,7 @@ gst_ts_demux_reset (MpegTSBase * base)
|
|||
demux->program_number = -1;
|
||||
demux->calculate_update_segment = FALSE;
|
||||
|
||||
gst_segment_init (&demux->segment, GST_FORMAT_TIME);
|
||||
gst_segment_init (&demux->segment, GST_FORMAT_UNDEFINED);
|
||||
if (demux->segment_event) {
|
||||
gst_event_unref (demux->segment_event);
|
||||
demux->segment_event = NULL;
|
||||
|
@ -1123,12 +1123,6 @@ gst_ts_demux_program_started (MpegTSBase * base, MpegTSBaseProgram * program)
|
|||
* an update newsegment */
|
||||
demux->calculate_update_segment = !program->initial_program;
|
||||
|
||||
/* If we have an upstream time segment and it's the initial program, just use that */
|
||||
if (program->initial_program && base->segment.format == GST_FORMAT_TIME) {
|
||||
demux->segment = base->segment;
|
||||
demux->segment_event = gst_event_new_segment (&demux->segment);
|
||||
}
|
||||
|
||||
/* FIXME : When do we emit no_more_pads ? */
|
||||
|
||||
/* Inform scanner we have got our program */
|
||||
|
@ -1384,6 +1378,20 @@ calculate_and_push_newsegment (GstTSDemux * demux, TSDemuxStream * stream)
|
|||
|
||||
GST_DEBUG ("Creating new newsegment for stream %p", stream);
|
||||
|
||||
/* 0) If we don't have a time segment yet try to recover segment info from
|
||||
* base when it's in time otherwise just initialize segment with
|
||||
* defaults.
|
||||
* It will happen only if it's first program or after flushes. */
|
||||
if (demux->segment.format == GST_FORMAT_UNDEFINED) {
|
||||
if (base->segment.format == GST_FORMAT_TIME) {
|
||||
demux->segment = base->segment;
|
||||
/* We can shortcut and create the segment event directly */
|
||||
demux->segment_event = gst_event_new_segment (&demux->segment);
|
||||
} else {
|
||||
gst_segment_init (&demux->segment, GST_FORMAT_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
/* 1) If we need to calculate an update newsegment, do it
|
||||
* 2) If we need to calculate a new newsegment, do it
|
||||
* 3) If an update_segment is valid, push it
|
||||
|
@ -1588,6 +1596,13 @@ gst_ts_demux_flush (MpegTSBase * base)
|
|||
GstTSDemux *demux = GST_TS_DEMUX_CAST (base);
|
||||
|
||||
gst_ts_demux_flush_streams (demux);
|
||||
|
||||
if (demux->segment_event) {
|
||||
gst_event_unref (demux->segment_event);
|
||||
demux->segment_event = NULL;
|
||||
}
|
||||
demux->calculate_update_segment = FALSE;
|
||||
gst_segment_init (&demux->segment, GST_FORMAT_UNDEFINED);
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
|
Loading…
Reference in a new issue