mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-05 06:58:49 +00:00
resindvd: Make segment updates less aggressive.
When updating a pad, send the update to half a second behind the SCR, which avoids ever updating the start time for a pad to beyond the end of the cell. Also, remember the last actual new-segment start time for each pad, and use it when closing the segment.
This commit is contained in:
parent
cae9db0d8c
commit
13694cd654
2 changed files with 26 additions and 13 deletions
|
@ -469,7 +469,7 @@ gst_flups_demux_clear_times (GstFluPSDemux * demux)
|
||||||
GstFluPSStream *stream = demux->streams[id];
|
GstFluPSStream *stream = demux->streams[id];
|
||||||
|
|
||||||
if (stream) {
|
if (stream) {
|
||||||
stream->last_ts = GST_CLOCK_TIME_NONE;
|
stream->last_seg_start = stream->last_ts = GST_CLOCK_TIME_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -494,8 +494,9 @@ gst_flups_demux_send_segment_updates (GstFluPSDemux * demux,
|
||||||
stream->last_ts = demux->src_segment.start;
|
stream->last_ts = demux->src_segment.start;
|
||||||
if (stream->last_ts + stream->segment_thresh < new_time) {
|
if (stream->last_ts + stream->segment_thresh < new_time) {
|
||||||
#if 0
|
#if 0
|
||||||
g_print ("Segment update to pad %s time %" GST_TIME_FORMAT "\n",
|
g_print ("Segment update to pad %s time %" GST_TIME_FORMAT " stop now %"
|
||||||
GST_PAD_NAME (stream->pad), GST_TIME_ARGS (new_time));
|
GST_TIME_FORMAT "\n", GST_PAD_NAME (stream->pad),
|
||||||
|
GST_TIME_ARGS (new_time), GST_TIME_ARGS (demux->src_segment.stop));
|
||||||
#endif
|
#endif
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"Segment update to pad %s time %" GST_TIME_FORMAT,
|
"Segment update to pad %s time %" GST_TIME_FORMAT,
|
||||||
|
@ -509,7 +510,7 @@ gst_flups_demux_send_segment_updates (GstFluPSDemux * demux,
|
||||||
}
|
}
|
||||||
gst_event_ref (event);
|
gst_event_ref (event);
|
||||||
gst_pad_push_event (stream->pad, event);
|
gst_pad_push_event (stream->pad, event);
|
||||||
stream->last_ts = new_time;
|
stream->last_seg_start = stream->last_ts = new_time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -528,22 +529,29 @@ gst_flups_demux_send_segment_close (GstFluPSDemux * demux)
|
||||||
GstFluPSStream *stream = demux->streams[id];
|
GstFluPSStream *stream = demux->streams[id];
|
||||||
|
|
||||||
if (stream) {
|
if (stream) {
|
||||||
if (stream->last_ts == GST_CLOCK_TIME_NONE ||
|
GstClockTime start = demux->src_segment.start;
|
||||||
stream->last_ts < demux->src_segment.start)
|
|
||||||
stream->last_ts = demux->src_segment.start;
|
|
||||||
|
|
||||||
|
if (stream->last_seg_start != GST_CLOCK_TIME_NONE &&
|
||||||
|
stream->last_seg_start > start)
|
||||||
|
start = stream->last_seg_start;
|
||||||
#if 0
|
#if 0
|
||||||
g_print ("Segment update to pad %s start %" GST_TIME_FORMAT
|
g_print ("Segment close to pad %s start %" GST_TIME_FORMAT
|
||||||
" stop %" GST_TIME_FORMAT "\n",
|
" stop %" GST_TIME_FORMAT "\n",
|
||||||
GST_PAD_NAME (stream->pad), GST_TIME_ARGS (stream->last_ts),
|
GST_PAD_NAME (stream->pad), GST_TIME_ARGS (start),
|
||||||
GST_TIME_ARGS (demux->src_segment.stop));
|
GST_TIME_ARGS (demux->src_segment.stop));
|
||||||
#endif
|
#endif
|
||||||
|
if (start > demux->src_segment.stop) {
|
||||||
|
g_print ("Problem on pad %s with start %" GST_TIME_FORMAT " > stop %"
|
||||||
|
GST_TIME_FORMAT "\n",
|
||||||
|
gst_object_get_name (GST_OBJECT (stream->pad)),
|
||||||
|
GST_TIME_ARGS (start), GST_TIME_ARGS (demux->src_segment.stop));
|
||||||
|
}
|
||||||
event = gst_event_new_new_segment_full (TRUE,
|
event = gst_event_new_new_segment_full (TRUE,
|
||||||
demux->src_segment.rate, demux->src_segment.applied_rate,
|
demux->src_segment.rate, demux->src_segment.applied_rate,
|
||||||
GST_FORMAT_TIME, stream->last_ts,
|
GST_FORMAT_TIME, start,
|
||||||
demux->src_segment.stop,
|
demux->src_segment.stop,
|
||||||
demux->src_segment.time +
|
demux->src_segment.time + (start - demux->src_segment.start));
|
||||||
(stream->last_ts - demux->src_segment.start));
|
if (event)
|
||||||
gst_pad_push_event (stream->pad, event);
|
gst_pad_push_event (stream->pad, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1354,6 +1362,10 @@ gst_flups_demux_parse_pack_start (GstFluPSDemux * demux)
|
||||||
new_time = MPEGTIME_TO_GSTTIME (scr_adjusted);
|
new_time = MPEGTIME_TO_GSTTIME (scr_adjusted);
|
||||||
if (new_time != GST_CLOCK_TIME_NONE) {
|
if (new_time != GST_CLOCK_TIME_NONE) {
|
||||||
// g_print ("SCR now %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (new_time));
|
// g_print ("SCR now %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (new_time));
|
||||||
|
if (new_time > GST_SECOND / 2)
|
||||||
|
new_time -= GST_SECOND / 2;
|
||||||
|
else
|
||||||
|
new_time = 0;
|
||||||
gst_flups_demux_send_segment_updates (demux, new_time);
|
gst_flups_demux_send_segment_updates (demux, new_time);
|
||||||
demux->src_segment.last_stop = new_time;
|
demux->src_segment.last_stop = new_time;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ struct _GstFluPSStream {
|
||||||
gboolean notlinked;
|
gboolean notlinked;
|
||||||
gboolean need_segment;
|
gboolean need_segment;
|
||||||
|
|
||||||
|
GstClockTime last_seg_start;
|
||||||
GstClockTime last_ts;
|
GstClockTime last_ts;
|
||||||
GstClockTime segment_thresh;
|
GstClockTime segment_thresh;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue