resindvd: Try a different approach to segment filling.
Restore the old segment update behaviour, and instead extend the close segment stop time if the SCR (last_stop) overruns the calculated stop position.
This commit is contained in:
parent
462419f279
commit
59a3abfdf3
@ -495,8 +495,10 @@ gst_flups_demux_send_segment_updates (GstFluPSDemux * demux,
|
|||||||
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 " stop now %"
|
g_print ("Segment update to pad %s time %" GST_TIME_FORMAT " stop now %"
|
||||||
GST_TIME_FORMAT "\n", GST_PAD_NAME (stream->pad),
|
GST_TIME_FORMAT " last_stop %" GST_TIME_FORMAT "\n",
|
||||||
GST_TIME_ARGS (new_time), GST_TIME_ARGS (demux->src_segment.stop));
|
GST_PAD_NAME (stream->pad), GST_TIME_ARGS (new_time),
|
||||||
|
GST_TIME_ARGS (demux->src_segment.stop),
|
||||||
|
GST_TIME_ARGS (demux->src_segment.last_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,
|
||||||
@ -524,6 +526,10 @@ gst_flups_demux_send_segment_close (GstFluPSDemux * demux)
|
|||||||
{
|
{
|
||||||
gint id;
|
gint id;
|
||||||
GstEvent *event = NULL;
|
GstEvent *event = NULL;
|
||||||
|
GstClockTime stop = demux->src_segment.stop;
|
||||||
|
|
||||||
|
if (demux->src_segment.last_stop != -1 && demux->src_segment.last_stop > stop)
|
||||||
|
stop = demux->src_segment.last_stop;
|
||||||
|
|
||||||
for (id = 0; id < GST_FLUPS_DEMUX_MAX_STREAMS; id++) {
|
for (id = 0; id < GST_FLUPS_DEMUX_MAX_STREAMS; id++) {
|
||||||
GstFluPSStream *stream = demux->streams[id];
|
GstFluPSStream *stream = demux->streams[id];
|
||||||
@ -534,23 +540,23 @@ gst_flups_demux_send_segment_close (GstFluPSDemux * demux)
|
|||||||
if (stream->last_seg_start != GST_CLOCK_TIME_NONE &&
|
if (stream->last_seg_start != GST_CLOCK_TIME_NONE &&
|
||||||
stream->last_seg_start > start)
|
stream->last_seg_start > start)
|
||||||
start = stream->last_seg_start;
|
start = stream->last_seg_start;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
g_print ("Segment close 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 (start),
|
GST_PAD_NAME (stream->pad), GST_TIME_ARGS (start),
|
||||||
GST_TIME_ARGS (demux->src_segment.stop));
|
GST_TIME_ARGS (stop));
|
||||||
#endif
|
#endif
|
||||||
if (start > demux->src_segment.stop) {
|
if (start > stop) {
|
||||||
g_print ("Problem on pad %s with start %" GST_TIME_FORMAT " > stop %"
|
g_print ("Problem on pad %s with start %" GST_TIME_FORMAT " > stop %"
|
||||||
GST_TIME_FORMAT "\n",
|
GST_TIME_FORMAT "\n",
|
||||||
gst_object_get_name (GST_OBJECT (stream->pad)),
|
gst_object_get_name (GST_OBJECT (stream->pad)),
|
||||||
GST_TIME_ARGS (start), GST_TIME_ARGS (demux->src_segment.stop));
|
GST_TIME_ARGS (start), GST_TIME_ARGS (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, start,
|
GST_FORMAT_TIME, start,
|
||||||
demux->src_segment.stop,
|
stop, demux->src_segment.time + (start - demux->src_segment.start));
|
||||||
demux->src_segment.time + (start - demux->src_segment.start));
|
|
||||||
if (event)
|
if (event)
|
||||||
gst_pad_push_event (stream->pad, event);
|
gst_pad_push_event (stream->pad, event);
|
||||||
}
|
}
|
||||||
@ -872,8 +878,12 @@ gst_flups_demux_sink_event (GstPad * pad, GstEvent * event)
|
|||||||
else
|
else
|
||||||
demux->scr_adjust = -GSTTIME_TO_MPEGTIME (-adjust);
|
demux->scr_adjust = -GSTTIME_TO_MPEGTIME (-adjust);
|
||||||
|
|
||||||
if (stop != -1)
|
if (stop != -1) {
|
||||||
stop = start + dur;
|
stop = start + dur;
|
||||||
|
if (demux->src_segment.last_stop != -1
|
||||||
|
&& demux->src_segment.last_stop > stop)
|
||||||
|
stop = demux->src_segment.last_stop;
|
||||||
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"sending new segment: update %d rate %g format %d, start: %"
|
"sending new segment: update %d rate %g format %d, start: %"
|
||||||
@ -1362,12 +1372,8 @@ 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)
|
gst_segment_set_last_stop (&demux->src_segment, GST_FORMAT_TIME, new_time);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the bytes_since_scr value to count the data remaining in the
|
/* Reset the bytes_since_scr value to count the data remaining in the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user