Commit a295acae authored by Andy Wingo's avatar Andy Wingo
Browse files

theoraparse.c (theora_parse_push_buffer)

Original commit message from CVS:
2006-07-08  Andy Wingo  <wingo@pobox.com>

* theoraparse.c (theora_parse_push_buffer)
(theora_parse_drain_queue_prematurely, theora_parse_drain_queue):
Add some more debugging. Fix granulepos reconstruction in the face
of discontinuities.
parent fa5dacc9
2006-07-08 Andy Wingo <wingo@pobox.com>
* theoraparse.c (theora_parse_push_buffer)
(theora_parse_drain_queue_prematurely, theora_parse_drain_queue):
Add some more debugging. Fix granulepos reconstruction in the face
of discontinuities.
2006-07-06 Wim Taymans <wim@fluendo.com> 2006-07-06 Wim Taymans <wim@fluendo.com>
   
* gst-libs/gst/audio/gstbaseaudiosink.c: * gst-libs/gst/audio/gstbaseaudiosink.c:
......
...@@ -296,6 +296,9 @@ theora_parse_push_buffer (GstTheoraParse * parse, GstBuffer * buf, ...@@ -296,6 +296,9 @@ theora_parse_push_buffer (GstTheoraParse * parse, GstBuffer * buf,
gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad)); gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
GST_DEBUG_OBJECT (parse, "pushing buffer with granulepos %" G_GINT64_FORMAT
"|%" G_GINT64_FORMAT, keyframe, frame - keyframe);
return gst_pad_push (parse->srcpad, buf); return gst_pad_push (parse->srcpad, buf);
} }
...@@ -309,6 +312,8 @@ theora_parse_drain_queue_prematurely (GstTheoraParse * parse) ...@@ -309,6 +312,8 @@ theora_parse_drain_queue_prematurely (GstTheoraParse * parse)
* didn't-get-a-granulepos-on-the-last-packet case. Assuming a continuous * didn't-get-a-granulepos-on-the-last-packet case. Assuming a continuous
* stream. */ * stream. */
GST_DEBUG_OBJECT (parse, "got EOS, draining queue");
while (!g_queue_is_empty (parse->buffer_queue)) { while (!g_queue_is_empty (parse->buffer_queue)) {
GstBuffer *buf; GstBuffer *buf;
...@@ -351,12 +356,27 @@ static GstFlowReturn ...@@ -351,12 +356,27 @@ static GstFlowReturn
theora_parse_drain_queue (GstTheoraParse * parse, gint64 granulepos) theora_parse_drain_queue (GstTheoraParse * parse, gint64 granulepos)
{ {
GstFlowReturn ret = GST_FLOW_OK; GstFlowReturn ret = GST_FLOW_OK;
gint64 keyframe, frame; gint64 keyframe, prev_frame, frame;
parse_granulepos (granulepos, parse->shift, &keyframe, &frame); parse_granulepos (granulepos, parse->shift, &keyframe, &frame);
parse->prev_frame = MAX (parse->prev_frame, prev_frame = frame - g_queue_get_length (parse->buffer_queue);
frame - g_queue_get_length (parse->buffer_queue)); if (prev_frame < parse->prev_frame) {
GST_WARNING ("jumped %" G_GINT64_FORMAT
" frames backwards! not sure what to do here",
parse->prev_frame - prev_frame);
ret = GST_FLOW_ERROR;
goto done;
} else if (prev_frame > parse->prev_frame) {
GST_INFO ("discontinuity detected (%" G_GINT64_FORMAT
" frames)", prev_frame - parse->prev_frame);
if (keyframe <= prev_frame && keyframe > parse->prev_keyframe)
parse->prev_keyframe = keyframe;
parse->prev_frame = prev_frame;
}
GST_DEBUG ("draining queue of length %d",
g_queue_get_length (parse->buffer_queue));
while (!g_queue_is_empty (parse->buffer_queue)) { while (!g_queue_is_empty (parse->buffer_queue)) {
GstBuffer *buf; GstBuffer *buf;
......
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