mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
asfdemux: Only change segment start to a keyframe for KEYUNIT seeks
Not for accurate seeks, which should accurately start at the requested position. https://bugzilla.gnome.org/show_bug.cgi?id=755469
This commit is contained in:
parent
f501188191
commit
155c8fc6a6
2 changed files with 12 additions and 12 deletions
|
@ -274,7 +274,7 @@ gst_asf_demux_reset (GstASFDemux * demux, gboolean chain_reset)
|
||||||
demux->need_newsegment = TRUE;
|
demux->need_newsegment = TRUE;
|
||||||
demux->segment_seqnum = 0;
|
demux->segment_seqnum = 0;
|
||||||
demux->segment_running = FALSE;
|
demux->segment_running = FALSE;
|
||||||
demux->accurate = FALSE;
|
demux->keyunit_sync = FALSE;
|
||||||
demux->metadata = gst_caps_new_empty ();
|
demux->metadata = gst_caps_new_empty ();
|
||||||
demux->global_metadata = gst_structure_new_empty ("metadata");
|
demux->global_metadata = gst_structure_new_empty ("metadata");
|
||||||
demux->data_size = 0;
|
demux->data_size = 0;
|
||||||
|
@ -622,7 +622,7 @@ gst_asf_demux_handle_seek_event (GstASFDemux * demux, GstEvent * event)
|
||||||
GstSeekType cur_type, stop_type;
|
GstSeekType cur_type, stop_type;
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
gboolean only_need_update;
|
gboolean only_need_update;
|
||||||
gboolean keyunit_sync, after, before, next;
|
gboolean accurate, after, before, next;
|
||||||
gboolean flush;
|
gboolean flush;
|
||||||
gdouble rate;
|
gdouble rate;
|
||||||
gint64 cur, stop;
|
gint64 cur, stop;
|
||||||
|
@ -663,9 +663,9 @@ gst_asf_demux_handle_seek_event (GstASFDemux * demux, GstEvent * event)
|
||||||
|
|
||||||
seqnum = gst_event_get_seqnum (event);
|
seqnum = gst_event_get_seqnum (event);
|
||||||
flush = ((flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH);
|
flush = ((flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH);
|
||||||
demux->accurate =
|
accurate = ((flags & GST_SEEK_FLAG_ACCURATE) == GST_SEEK_FLAG_ACCURATE);
|
||||||
((flags & GST_SEEK_FLAG_ACCURATE) == GST_SEEK_FLAG_ACCURATE);
|
demux->keyunit_sync =
|
||||||
keyunit_sync = ((flags & GST_SEEK_FLAG_KEY_UNIT) == GST_SEEK_FLAG_KEY_UNIT);
|
((flags & GST_SEEK_FLAG_KEY_UNIT) == GST_SEEK_FLAG_KEY_UNIT);
|
||||||
after = ((flags & GST_SEEK_FLAG_SNAP_AFTER) == GST_SEEK_FLAG_SNAP_AFTER);
|
after = ((flags & GST_SEEK_FLAG_SNAP_AFTER) == GST_SEEK_FLAG_SNAP_AFTER);
|
||||||
before = ((flags & GST_SEEK_FLAG_SNAP_BEFORE) == GST_SEEK_FLAG_SNAP_BEFORE);
|
before = ((flags & GST_SEEK_FLAG_SNAP_BEFORE) == GST_SEEK_FLAG_SNAP_BEFORE);
|
||||||
next = after && !before;
|
next = after && !before;
|
||||||
|
@ -765,7 +765,7 @@ gst_asf_demux_handle_seek_event (GstASFDemux * demux, GstEvent * event)
|
||||||
* the hope of hitting a keyframe and let the sinks throw away the stuff
|
* the hope of hitting a keyframe and let the sinks throw away the stuff
|
||||||
* before the segment start. For audio-only this is unnecessary as every
|
* before the segment start. For audio-only this is unnecessary as every
|
||||||
* frame is 'key'. */
|
* frame is 'key'. */
|
||||||
if (flush && (demux->accurate || (keyunit_sync && !next))
|
if (flush && (accurate || (demux->keyunit_sync && !next))
|
||||||
&& demux->num_video_streams > 0) {
|
&& demux->num_video_streams > 0) {
|
||||||
seek_time -= 5 * GST_SECOND;
|
seek_time -= 5 * GST_SECOND;
|
||||||
if (seek_time < 0)
|
if (seek_time < 0)
|
||||||
|
@ -779,7 +779,7 @@ gst_asf_demux_handle_seek_event (GstASFDemux * demux, GstEvent * event)
|
||||||
packet = demux->num_packets;
|
packet = demux->num_packets;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (G_LIKELY (keyunit_sync)) {
|
if (G_LIKELY (demux->keyunit_sync)) {
|
||||||
GST_DEBUG_OBJECT (demux, "key unit seek, adjust seek_time = %"
|
GST_DEBUG_OBJECT (demux, "key unit seek, adjust seek_time = %"
|
||||||
GST_TIME_FORMAT " to index_time = %" GST_TIME_FORMAT,
|
GST_TIME_FORMAT " to index_time = %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (seek_time), GST_TIME_ARGS (idx_time));
|
GST_TIME_ARGS (seek_time), GST_TIME_ARGS (idx_time));
|
||||||
|
@ -1542,7 +1542,7 @@ gst_asf_demux_find_stream_with_complete_payload (GstASFDemux * demux)
|
||||||
|
|
||||||
if (G_UNLIKELY (GST_CLOCK_TIME_IS_VALID (payload->ts) &&
|
if (G_UNLIKELY (GST_CLOCK_TIME_IS_VALID (payload->ts) &&
|
||||||
(payload->ts < demux->segment.start))) {
|
(payload->ts < demux->segment.start))) {
|
||||||
if (G_UNLIKELY ((!demux->accurate) && payload->keyframe)) {
|
if (G_UNLIKELY (demux->keyunit_sync && payload->keyframe)) {
|
||||||
GST_DEBUG_OBJECT (stream->pad,
|
GST_DEBUG_OBJECT (stream->pad,
|
||||||
"Found keyframe, updating segment start to %" GST_TIME_FORMAT,
|
"Found keyframe, updating segment start to %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (payload->ts));
|
GST_TIME_ARGS (payload->ts));
|
||||||
|
@ -1620,8 +1620,8 @@ gst_asf_demux_push_complete_payloads (GstASFDemux * demux, gboolean force)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME : only if ACCURATE ! */
|
/* FIXME : only if ACCURATE ! */
|
||||||
if (G_LIKELY (!demux->accurate
|
if (G_LIKELY (demux->keyunit_sync
|
||||||
&& (GST_CLOCK_TIME_IS_VALID (payload->ts)))) {
|
&& GST_CLOCK_TIME_IS_VALID (payload->ts))) {
|
||||||
GST_DEBUG ("Adjusting newsegment start to %" GST_TIME_FORMAT,
|
GST_DEBUG ("Adjusting newsegment start to %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (payload->ts));
|
GST_TIME_ARGS (payload->ts));
|
||||||
demux->segment.start = payload->ts;
|
demux->segment.start = payload->ts;
|
||||||
|
@ -4541,7 +4541,7 @@ gst_asf_demux_change_state (GstElement * element, GstStateChange transition)
|
||||||
gst_segment_init (&demux->segment, GST_FORMAT_TIME);
|
gst_segment_init (&demux->segment, GST_FORMAT_TIME);
|
||||||
demux->need_newsegment = TRUE;
|
demux->need_newsegment = TRUE;
|
||||||
demux->segment_running = FALSE;
|
demux->segment_running = FALSE;
|
||||||
demux->accurate = FALSE;
|
demux->keyunit_sync = FALSE;
|
||||||
demux->adapter = gst_adapter_new ();
|
demux->adapter = gst_adapter_new ();
|
||||||
demux->metadata = gst_caps_new_empty ();
|
demux->metadata = gst_caps_new_empty ();
|
||||||
demux->global_metadata = gst_structure_new_empty ("metadata");
|
demux->global_metadata = gst_structure_new_empty ("metadata");
|
||||||
|
|
|
@ -205,7 +205,7 @@ struct _GstASFDemux {
|
||||||
gboolean broadcast;
|
gboolean broadcast;
|
||||||
|
|
||||||
GstSegment segment; /* configured play segment */
|
GstSegment segment; /* configured play segment */
|
||||||
gboolean accurate;
|
gboolean keyunit_sync;
|
||||||
|
|
||||||
gboolean need_newsegment; /* do we need to send a new-segment event? */
|
gboolean need_newsegment; /* do we need to send a new-segment event? */
|
||||||
guint32 segment_seqnum; /* if the new segment must have this seqnum */
|
guint32 segment_seqnum; /* if the new segment must have this seqnum */
|
||||||
|
|
Loading…
Reference in a new issue