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
This commit is contained in:
Vincent Penquerc'h 2011-01-21 10:56:00 +00:00 committed by Tim-Philipp Müller
parent 9805bdfcc8
commit b7664eae71
2 changed files with 13 additions and 5 deletions

View file

@ -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);

View file

@ -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;