mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-29 03:30:35 +00:00
subparse: fix off by one offset calculation
Do not use the buffer start offset when it is invalid, otherwise a discontinuity is detected on the next buffer, and the subtitle parser reset and some subtitle lines are not shown. Also remove unused next_offset field. https://bugzilla.gnome.org/show_bug.cgi?id=693981
This commit is contained in:
parent
e53f1d3f40
commit
4816885ce3
2 changed files with 1 additions and 6 deletions
|
@ -302,8 +302,6 @@ gst_sub_parse_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
GST_DEBUG_OBJECT (self, "segment after seek: %" GST_SEGMENT_FORMAT,
|
||||
&self->segment);
|
||||
|
||||
self->next_offset = 0;
|
||||
|
||||
self->need_segment = TRUE;
|
||||
} else {
|
||||
GST_WARNING_OBJECT (self, "seek to 0 bytes failed");
|
||||
|
@ -1420,8 +1418,7 @@ feed_textbuf (GstSubParse * self, GstBuffer * buf)
|
|||
* subtitles which are discontinuous by nature. */
|
||||
}
|
||||
|
||||
self->offset = GST_BUFFER_OFFSET (buf) + gst_buffer_get_size (buf);
|
||||
self->next_offset = self->offset;
|
||||
self->offset += gst_buffer_get_size (buf);
|
||||
|
||||
gst_adapter_push (self->adapter, buf);
|
||||
|
||||
|
@ -1644,7 +1641,6 @@ gst_sub_parse_change_state (GstElement * element, GstStateChange transition)
|
|||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||
/* format detection will init the parser state */
|
||||
self->offset = 0;
|
||||
self->next_offset = 0;
|
||||
self->parser_type = GST_SUB_PARSE_FORMAT_UNKNOWN;
|
||||
self->valid_utf8 = TRUE;
|
||||
self->first_buffer = TRUE;
|
||||
|
|
|
@ -91,7 +91,6 @@ struct _GstSubParse {
|
|||
|
||||
/* seek */
|
||||
guint64 offset;
|
||||
guint64 next_offset;
|
||||
|
||||
/* Segment */
|
||||
GstSegment segment;
|
||||
|
|
Loading…
Reference in a new issue