ext/ogg/gstoggmux.c (gst_ogg_mux_dequeue_page): Compare timestamp + duration, not just timestamp -- ogg pages should ...

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

* ext/ogg/gstoggmux.c (gst_ogg_mux_dequeue_page): Compare
timestamp + duration, not just timestamp -- ogg pages should be
ordered by stop time. Necessary fix given the change in vorbis
timestamps.
This commit is contained in:
Andy Wingo 2006-01-30 19:22:22 +00:00
parent f2476d444b
commit 2817c01fdb
2 changed files with 10 additions and 5 deletions

View file

@ -1,5 +1,10 @@
2006-01-30 Andy Wingo <wingo@pobox.com>
* ext/ogg/gstoggmux.c (gst_ogg_mux_dequeue_page): Compare
timestamp + duration, not just timestamp -- ogg pages should be
ordered by stop time. Necessary fix given the change in vorbis
timestamps.
* ext/theora/theoraenc.c (theora_enc_sink_setcaps)
(gst_theora_enc_init): Pull the granule shift out of the encoder.
(granulepos_add): New function, handles the messiness of adjusting

View file

@ -571,12 +571,12 @@ gst_ogg_mux_dequeue_page (GstOggMux * mux, GstFlowReturn * flowret)
if (buf) {
/* if no oldest buffer yet, take this one */
if (oldest == GST_CLOCK_TIME_NONE) {
oldest = GST_BUFFER_TIMESTAMP (buf);
oldest = GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf);
opad = pad;
} else {
/* if we have an oldest, compare with this one */
if (GST_BUFFER_TIMESTAMP (buf) < oldest) {
oldest = GST_BUFFER_TIMESTAMP (buf);
if (GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf) < oldest) {
oldest = GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf);
opad = pad;
}
}
@ -588,9 +588,9 @@ gst_ogg_mux_dequeue_page (GstOggMux * mux, GstFlowReturn * flowret)
g_assert (opad);
buf = g_queue_pop_head (opad->pagebuffers);
GST_LOG_OBJECT (opad,
GST_GP_FORMAT " pushing oldest page (time %" GST_TIME_FORMAT ")",
GST_GP_FORMAT " pushing oldest page (end time %" GST_TIME_FORMAT ")",
GST_BUFFER_OFFSET_END (buf),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf)));
*flowret = gst_ogg_mux_push_buffer (mux, buf);
ret = TRUE;
}