mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
hlsdemux: No need to store position since it's the buffer's timestamp
This also will fix the issue of having the current position different from the actual position of the first buffer in the queue in case the caching caused a resync of the sequence number. Conflicts: gst/hls/gsthlsdemux.c
This commit is contained in:
parent
87d10cf683
commit
3cc3e9ad1b
2 changed files with 6 additions and 10 deletions
|
@ -330,7 +330,7 @@ gst_hls_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
GstSeekType start_type, stop_type;
|
||||
gint64 start, stop;
|
||||
GList *walk;
|
||||
GstClockTime current_pos, target_pos;
|
||||
GstClockTime position, current_pos, target_pos;
|
||||
gint current_sequence;
|
||||
GstM3U8MediaFile *file;
|
||||
|
||||
|
@ -397,8 +397,8 @@ gst_hls_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
GST_M3U8_CLIENT_LOCK (demux->client);
|
||||
GST_DEBUG_OBJECT (demux, "seeking to sequence %d", current_sequence);
|
||||
demux->client->sequence = current_sequence;
|
||||
gst_m3u8_client_get_current_position (demux->client, &demux->position);
|
||||
demux->position_shift = start - demux->position;
|
||||
gst_m3u8_client_get_current_position (demux->client, &position);
|
||||
demux->position_shift = start - position;
|
||||
demux->need_segment = TRUE;
|
||||
GST_M3U8_CLIENT_UNLOCK (demux->client);
|
||||
|
||||
|
@ -663,8 +663,10 @@ gst_hls_demux_stream_loop (GstHLSDemux * demux)
|
|||
g_object_unref (fragment);
|
||||
|
||||
if (demux->need_segment) {
|
||||
GstClockTime start = demux->position + demux->position_shift;
|
||||
GstSegment segment;
|
||||
GstClockTime start = GST_BUFFER_PTS (buf);
|
||||
|
||||
start += demux->position_shift;
|
||||
/* And send a newsegment */
|
||||
GST_DEBUG_OBJECT (demux, "Sending new-segment. segment start:%"
|
||||
GST_TIME_FORMAT, GST_TIME_ARGS (start));
|
||||
|
@ -676,9 +678,6 @@ gst_hls_demux_stream_loop (GstHLSDemux * demux)
|
|||
demux->position_shift = 0;
|
||||
}
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buf)))
|
||||
demux->position += GST_BUFFER_DURATION (buf);
|
||||
|
||||
ret = gst_pad_push (demux->srcpad, buf);
|
||||
if (ret != GST_FLOW_OK)
|
||||
goto error_pushing;
|
||||
|
@ -754,7 +753,6 @@ gst_hls_demux_reset (GstHLSDemux * demux, gboolean dispose)
|
|||
}
|
||||
g_queue_clear (demux->queue);
|
||||
|
||||
demux->position = 0;
|
||||
demux->position_shift = 0;
|
||||
demux->need_segment = TRUE;
|
||||
}
|
||||
|
@ -877,7 +875,6 @@ gst_hls_demux_cache_fragments (GstHLSDemux * demux)
|
|||
demux->client->sequence -= demux->fragments_cache;
|
||||
else
|
||||
demux->client->sequence = 0;
|
||||
gst_m3u8_client_get_current_position (demux->client, &demux->position);
|
||||
GST_M3U8_CLIENT_UNLOCK (demux->client);
|
||||
} else {
|
||||
GstClockTime duration = gst_m3u8_client_get_duration (demux->client);
|
||||
|
|
|
@ -85,7 +85,6 @@ struct _GstHLSDemux
|
|||
gboolean cancelled;
|
||||
|
||||
/* Position in the stream */
|
||||
GstClockTime position;
|
||||
GstClockTime position_shift;
|
||||
gboolean need_segment;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue