|
From: <tp...@ke...> - 2011-02-01 17:27:09
|
Module: gst-plugins-base Branch: master Commit: b7664eae716a7e0026c3d4d7ca10897a30f6a45e URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=b7664eae716a7e0026c3d4d7ca10897a30f6a45e Author: Vincent Penquerc'h <vin...@co...> Date: Fri Jan 21 10:56:00 2011 +0000 oggmux: do not skip a pageno at start Discontinuities are automatically signalled by oggdemux at the start of a new stream. When oggmux is yet to output actual data pages, do not signal these discontinuities in the ogg stream. This patch may miss some actual discontinuities at the very start of a stream, but avoids the spurious missing pages when encoding happens normally. A better fix might involve finding a way to distinguish between actual data discontinuities and discontinuities merely marking the start of a new stream. Fixes an issue with ogg page numbering (would skip a number for no reason, which then looks like a packet was lost somewhere) when re-muxing an ogg stream, e.g. when re-tagging in rhythmbox. https://bugzilla.gnome.org/show_bug.cgi?id=629196 --- ext/ogg/gstoggmux.c | 17 ++++++++++++----- ext/ogg/gstoggmux.h | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c index 11a6792..c36b4fb 100644 --- a/ext/ogg/gstoggmux.c +++ b/ext/ogg/gstoggmux.c @@ -394,6 +394,7 @@ gst_ogg_mux_request_new_pad (GstElement * element, oggpad->new_page = TRUE; oggpad->first_delta = FALSE; oggpad->prev_delta = FALSE; + oggpad->data_pushed = FALSE; oggpad->pagebuffers = g_queue_new (); oggpad->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (newpad); @@ -1306,11 +1307,15 @@ gst_ogg_mux_process_best_pad (GstOggMux * ogg_mux, GstOggPadData * best) } if (GST_BUFFER_IS_DISCONT (buf)) { - GST_LOG_OBJECT (pad->collect.pad, "got discont"); - packet.packetno++; - /* No public API for this; hack things in */ - pad->stream.pageno++; - force_flush = TRUE; + if (pad->data_pushed) { + GST_LOG_OBJECT (pad->collect.pad, "got discont"); + packet.packetno++; + /* No public API for this; hack things in */ + pad->stream.pageno++; + force_flush = TRUE; + } else { + GST_LOG_OBJECT (pad->collect.pad, "discont at stream start"); + } } /* flush the currently built page if necessary */ @@ -1364,6 +1369,7 @@ gst_ogg_mux_process_best_pad (GstOggMux * ogg_mux, GstOggPadData * best) GST_DEBUG_OBJECT (pad->collect.pad, "swapping in BOS packet"); ogg_stream_packetin (&pad->stream, &packet); + pad->data_pushed = TRUE; gp_time = GST_BUFFER_OFFSET (pad->buffer); granulepos = GST_BUFFER_OFFSET_END (pad->buffer); @@ -1607,6 +1613,7 @@ gst_ogg_mux_init_collectpads (GstCollectPads * collect) oggpad->new_page = TRUE; oggpad->first_delta = FALSE; oggpad->prev_delta = FALSE; + oggpad->data_pushed = FALSE; oggpad->pagebuffers = g_queue_new (); walk = g_slist_next (walk); diff --git a/ext/ogg/gstoggmux.h b/ext/ogg/gstoggmux.h index 6134d5e..37b1fae 100644 --- a/ext/ogg/gstoggmux.h +++ b/ext/ogg/gstoggmux.h @@ -78,6 +78,7 @@ typedef struct gboolean new_page; /* starting a new page */ gboolean first_delta; /* was the first packet in the page a delta */ gboolean prev_delta; /* was the previous buffer a delta frame */ + gboolean data_pushed; /* whether we pushed data already */ GstPadEventFunction collect_event; |