Commit 4816885c authored by Arnaud Vrac's avatar Arnaud Vrac Committed by Tim-Philipp Müller

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
parent e53f1d3f
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment