+2006-08-14 Wim Taymans <wim@fluendo.com>
+
+ * ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
+ (gst_ogg_demux_get_next_page), (gst_ogg_demux_perform_seek),
+ (gst_ogg_demux_read_chain), (gst_ogg_demux_loop):
+ Add some more debug info.
+ Don't crash when a seek failed.
+ Actually return the result of the seek instead of TRUE.
+ Ignore multiple BOS pages with the same serial so that we don't create
+ the same stream multiple times.
+ Post an error when we fail to do the initial seek.
+
2006-08-13 Wim Taymans <wim@fluendo.com>
* ext/alsa/gstalsa.c: (gst_alsa_detect_rates),
size = GST_BUFFER_SIZE (buffer);
data = GST_BUFFER_DATA (buffer);
+ GST_DEBUG_OBJECT (ogg, "submitting %u bytes", size);
+
oggbuffer = ogg_sync_buffer (&ogg->sync, size);
memcpy (oggbuffer, data, size);
ogg_sync_wrote (&ogg->sync, size);
more = ogg_sync_pageseek (&ogg->sync, og);
+ GST_LOG_OBJECT (ogg, "pageseek gave %ld", more);
+
if (more < 0) {
GST_LOG_OBJECT (ogg, "skipped %ld bytes", more);
/* skipped n bytes */
res = gst_ogg_demux_do_seek (ogg, ogg->segment.last_stop, accurate, &chain);
+ /* seek failed, make sure we continue the current chain */
+ if (!res) {
+ chain = ogg->current_chain;
+ }
+
/* now we have a new position, prepare for streaming again */
{
GstEvent *event;
/* streaming can continue now */
GST_PAD_STREAM_UNLOCK (ogg->sinkpad);
- return TRUE;
+ return res;
error:
{
}
serial = ogg_page_serialno (&op);
+ if (gst_ogg_chain_get_stream (chain, serial) != NULL) {
+ GST_WARNING_OBJECT (ogg, "found serial %08x BOS page twice, ignoring",
+ serial);
+ continue;
+ }
+
pad = gst_ogg_chain_new_stream (chain, serial);
gst_ogg_pad_submit_page (pad, &op);
}
if (ogg->need_chains) {
gboolean got_chains;
+ gboolean res;
- /* this is the only place where we write chains */
+ /* this is the only place where we write chains and thus need to lock. */
GST_CHAIN_LOCK (ogg);
ogg->chain_error = GST_FLOW_OK;
got_chains = gst_ogg_demux_find_chains (ogg);
GST_OBJECT_UNLOCK (ogg);
/* and seek to configured positions without FLUSH */
- gst_ogg_demux_perform_seek (ogg, event);
+ res = gst_ogg_demux_perform_seek (ogg, event);
if (event)
gst_event_unref (event);
+
+ if (!res)
+ goto seek_failed;
}
if (ogg->offset == ogg->length) {
ret = ogg->chain_error;
goto pause;
}
+seek_failed:
+ {
+ GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL),
+ ("failed to start demuxing ogg"));
+ ret = GST_FLOW_ERROR;
+ goto pause;
+ }
eos:
{
ret = GST_FLOW_UNEXPECTED;