summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2015-09-27 13:07:19 +1000
committerJan Schmidt <jan@centricular.com>2015-09-27 13:14:41 +1000
commit664e0fb331ce18751ebe96b129fd125d4ae0a69c (patch)
tree044a08e644f529df76e48afa553841b5fea5a5e6
parent213709761767ac6a6fa2b845ad27b046d7b937e4 (diff)
downloadgstreamer-plugins-bad-664e0fb331ce18751ebe96b129fd125d4ae0a69c.tar.gz
resindvd: Send gap updates to the segment stop during stills
Ignore the normal gap threshold for laggy streams and immediately catch all streams up to the end of the segment when processing gap updates for a segment during a still frame sequence. https://bugzilla.gnome.org/show_bug.cgi?id=755680
-rw-r--r--ext/resindvd/gstmpegdemux.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/ext/resindvd/gstmpegdemux.c b/ext/resindvd/gstmpegdemux.c
index 48002ba0f..a35a6a411 100644
--- a/ext/resindvd/gstmpegdemux.c
+++ b/ext/resindvd/gstmpegdemux.c
@@ -127,7 +127,7 @@ static GstStateChangeReturn gst_flups_demux_change_state (GstElement * element,
GstStateChange transition);
static inline void gst_flups_demux_send_gap_updates (GstFluPSDemux * demux,
- GstClockTime new_time);
+ GstClockTime new_time, gboolean no_threshold);
static inline void gst_flups_demux_clear_times (GstFluPSDemux * demux);
static void gst_flups_demux_reset_psm (GstFluPSDemux * demux);
@@ -865,7 +865,8 @@ gst_flups_demux_clear_times (GstFluPSDemux * demux)
}
static inline void
-gst_flups_demux_send_gap_updates (GstFluPSDemux * demux, GstClockTime new_time)
+gst_flups_demux_send_gap_updates (GstFluPSDemux * demux, GstClockTime new_time,
+ gboolean no_threshold)
{
gint i, count = demux->found_count;
GstEvent *event = NULL;
@@ -879,11 +880,12 @@ gst_flups_demux_send_gap_updates (GstFluPSDemux * demux, GstClockTime new_time)
GstFluPSStream *stream = demux->streams_found[i];
if (stream) {
+ GstClockTime gap_threshold = no_threshold ? 0 : stream->segment_thresh;
+
if (stream->last_ts == GST_CLOCK_TIME_NONE ||
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 + gap_threshold < new_time) {
GST_LOG_OBJECT (demux,
"Sending gap update to pad %s time %" GST_TIME_FORMAT " to %"
GST_TIME_FORMAT, GST_PAD_NAME (stream->pad),
@@ -985,15 +987,18 @@ gst_flups_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
GST_TIME_ARGS (MPEGTIME_TO_GSTTIME (demux->scr_adjust)));
#endif
- if (demux->in_still && stop != -1) {
- /* Generate gap buffers, due to closing segment from a still-frame */
- gst_flups_demux_send_gap_updates (demux, stop);
- }
-
gst_event_unref (event);
event = gst_event_new_segment (&demux->src_segment);
gst_flups_demux_send_event (demux, event);
+ if (demux->in_still && stop != -1) {
+ /* Generate gap buffers, due to closing segment from a still-frame.
+ * Do this in the new segment with stop time. */
+ GST_DEBUG_OBJECT (demux, "Advancing all streams to stop time %"
+ GST_TIME_FORMAT, GST_TIME_ARGS (stop));
+ gst_flups_demux_send_gap_updates (demux, stop, TRUE);
+ }
+
break;
}
case GST_EVENT_EOS:
@@ -1503,7 +1508,7 @@ gst_flups_demux_parse_pack_start (GstFluPSDemux * demux)
if (new_time != GST_CLOCK_TIME_NONE) {
// g_print ("SCR now %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (new_time));
gst_segment_set_position (&demux->src_segment, GST_FORMAT_TIME, new_time);
- gst_flups_demux_send_gap_updates (demux, new_time);
+ gst_flups_demux_send_gap_updates (demux, new_time, FALSE);
}
/* Reset the bytes_since_scr value to count the data remaining in the