mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-04 22:48:54 +00:00
asfdemux: Don't modify segment values on accurate seeks
When dealing with accurate seeks, we want to return exactly the segment that was requested by the seek event, and not adjust the values. https://bugzilla.gnome.org/show_bug.cgi?id=755469
This commit is contained in:
parent
7d021628cf
commit
dba14178ce
2 changed files with 11 additions and 6 deletions
|
@ -290,6 +290,7 @@ gst_asf_demux_reset (GstASFDemux * demux, gboolean chain_reset)
|
|||
demux->segment_seqnum = 0;
|
||||
demux->segment_running = FALSE;
|
||||
demux->keyunit_sync = FALSE;
|
||||
demux->accurate = FALSE;
|
||||
demux->metadata = gst_caps_new_empty ();
|
||||
demux->global_metadata = gst_structure_new_empty ("metadata");
|
||||
demux->data_size = 0;
|
||||
|
@ -637,7 +638,7 @@ gst_asf_demux_handle_seek_event (GstASFDemux * demux, GstEvent * event)
|
|||
GstSeekType cur_type, stop_type;
|
||||
GstFormat format;
|
||||
gboolean only_need_update;
|
||||
gboolean accurate, after, before, next;
|
||||
gboolean after, before, next;
|
||||
gboolean flush;
|
||||
gdouble rate;
|
||||
gint64 cur, stop;
|
||||
|
@ -682,7 +683,8 @@ gst_asf_demux_handle_seek_event (GstASFDemux * demux, GstEvent * event)
|
|||
|
||||
seqnum = gst_event_get_seqnum (event);
|
||||
flush = ((flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH);
|
||||
accurate = ((flags & GST_SEEK_FLAG_ACCURATE) == GST_SEEK_FLAG_ACCURATE);
|
||||
demux->accurate =
|
||||
((flags & GST_SEEK_FLAG_ACCURATE) == GST_SEEK_FLAG_ACCURATE);
|
||||
demux->keyunit_sync =
|
||||
((flags & GST_SEEK_FLAG_KEY_UNIT) == GST_SEEK_FLAG_KEY_UNIT);
|
||||
after = ((flags & GST_SEEK_FLAG_SNAP_AFTER) == GST_SEEK_FLAG_SNAP_AFTER);
|
||||
|
@ -784,7 +786,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
|
||||
* before the segment start. For audio-only this is unnecessary as every
|
||||
* frame is 'key'. */
|
||||
if (flush && (accurate || (demux->keyunit_sync && !next))
|
||||
if (flush && (demux->accurate || (demux->keyunit_sync && !next))
|
||||
&& demux->num_video_streams > 0) {
|
||||
seek_time -= 5 * GST_SECOND;
|
||||
if (seek_time < 0)
|
||||
|
@ -798,7 +800,7 @@ gst_asf_demux_handle_seek_event (GstASFDemux * demux, GstEvent * event)
|
|||
packet = demux->num_packets;
|
||||
}
|
||||
} else {
|
||||
if (G_LIKELY (demux->keyunit_sync)) {
|
||||
if (G_LIKELY (demux->keyunit_sync && !demux->accurate)) {
|
||||
GST_DEBUG_OBJECT (demux, "key unit seek, adjust seek_time = %"
|
||||
GST_TIME_FORMAT " to index_time = %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (seek_time), GST_TIME_ARGS (idx_time));
|
||||
|
@ -1598,7 +1600,8 @@ gst_asf_demux_find_stream_with_complete_payload (GstASFDemux * demux)
|
|||
|
||||
if (G_UNLIKELY (GST_CLOCK_TIME_IS_VALID (payload->ts) &&
|
||||
(payload->ts < demux->segment.start))) {
|
||||
if (G_UNLIKELY ((!demux->keyunit_sync) && payload->keyframe)) {
|
||||
if (G_UNLIKELY ((!demux->keyunit_sync) && (!demux->accurate)
|
||||
&& payload->keyframe)) {
|
||||
GST_DEBUG_OBJECT (stream->pad,
|
||||
"Found keyframe, updating segment start to %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (payload->ts));
|
||||
|
@ -1681,7 +1684,7 @@ gst_asf_demux_push_complete_payloads (GstASFDemux * demux, gboolean force)
|
|||
}
|
||||
|
||||
/* FIXME : only if ACCURATE ! */
|
||||
if (G_LIKELY (!demux->keyunit_sync
|
||||
if (G_LIKELY (!demux->keyunit_sync && !demux->accurate
|
||||
&& (GST_CLOCK_TIME_IS_VALID (payload->ts)))
|
||||
&& !GST_ASF_DEMUX_IS_REVERSE_PLAYBACK (demux->segment)) {
|
||||
GST_DEBUG ("Adjusting newsegment start to %" GST_TIME_FORMAT,
|
||||
|
@ -4667,6 +4670,7 @@ gst_asf_demux_change_state (GstElement * element, GstStateChange transition)
|
|||
demux->need_newsegment = TRUE;
|
||||
demux->segment_running = FALSE;
|
||||
demux->keyunit_sync = FALSE;
|
||||
demux->accurate = FALSE;
|
||||
demux->adapter = gst_adapter_new ();
|
||||
demux->metadata = gst_caps_new_empty ();
|
||||
demux->global_metadata = gst_structure_new_empty ("metadata");
|
||||
|
|
|
@ -213,6 +213,7 @@ struct _GstASFDemux {
|
|||
|
||||
GstSegment segment; /* configured play segment */
|
||||
gboolean keyunit_sync;
|
||||
gboolean accurate;
|
||||
|
||||
gboolean need_newsegment; /* do we need to send a new-segment event? */
|
||||
guint32 segment_seqnum; /* if the new segment must have this seqnum */
|
||||
|
|
Loading…
Reference in a new issue