From: Arnaud Vrac Date: Thu, 14 Feb 2013 00:35:45 +0000 (+0100) Subject: subparse: fix off by one offset calculation X-Git-Tag: 1.19.3~511^2~5524 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4816885ce3e99ac6ff430e3bf40db2186b3f53e8;p=platform%2Fupstream%2Fgstreamer.git 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 --- diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index 9ba447e..b7ac148 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -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; diff --git a/gst/subparse/gstsubparse.h b/gst/subparse/gstsubparse.h index 2da2012..5b5fd0d 100644 --- a/gst/subparse/gstsubparse.h +++ b/gst/subparse/gstsubparse.h @@ -91,7 +91,6 @@ struct _GstSubParse { /* seek */ guint64 offset; - guint64 next_offset; /* Segment */ GstSegment segment;