mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-29 20:35:40 +00:00
tests/check/pipelines/oggmux.c: Add a test that ensures we set DELTA_UNIT on all non-header, non-video buffers, if we...
Original commit message from CVS: * tests/check/pipelines/oggmux.c: (validate_ogg_page), (is_video), (eos_buffer_probe): Add a test that ensures we set DELTA_UNIT on all non-header, non-video buffers, if we have a video stream. * ext/ogg/gstoggmux.c: (gst_ogg_mux_queue_pads), (gst_ogg_mux_process_best_pad): Move setting delta_pad to earlier, where we inspect all pads, so that leading audio pages don't get DELTA_UNIT unset if they come before the first DELTA_UNIT from video pages. Fixes the newly-added test. Fixes #385527.
This commit is contained in:
parent
67131eaadb
commit
e1cc846edc
3 changed files with 45 additions and 7 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2007-06-15 Michael Smith <msmith@fluendo.com>
|
||||
|
||||
* tests/check/pipelines/oggmux.c: (validate_ogg_page), (is_video),
|
||||
(eos_buffer_probe):
|
||||
Add a test that ensures we set DELTA_UNIT on all non-header,
|
||||
non-video buffers, if we have a video stream.
|
||||
* ext/ogg/gstoggmux.c: (gst_ogg_mux_queue_pads),
|
||||
(gst_ogg_mux_process_best_pad):
|
||||
Move setting delta_pad to earlier, where we inspect all pads, so
|
||||
that leading audio pages don't get DELTA_UNIT unset if they come
|
||||
before the first DELTA_UNIT from video pages. Fixes the newly-added
|
||||
test. Fixes #385527.
|
||||
|
||||
2007-06-14 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* tests/check/pipelines/streamheader.c: (streamheader_suite):
|
||||
|
|
|
@ -795,6 +795,10 @@ gst_ogg_mux_queue_pads (GstOggMux * ogg_mux)
|
|||
|
||||
/* On EOS we get a NULL buffer */
|
||||
if (buf != NULL) {
|
||||
if (ogg_mux->delta_pad == NULL &&
|
||||
GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT))
|
||||
ogg_mux->delta_pad = pad;
|
||||
|
||||
incaps = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
|
||||
/* if we need headers */
|
||||
if (pad->state == GST_OGG_PAD_STATE_CONTROL) {
|
||||
|
@ -1365,11 +1369,6 @@ gst_ogg_mux_process_best_pad (GstOggMux * ogg_mux, GstOggPad * best)
|
|||
/* if this is the first packet of a new page figure out the delta flag */
|
||||
if (pad->new_page) {
|
||||
if (delta_unit) {
|
||||
/* This page is a delta frame */
|
||||
if (ogg_mux->delta_pad == NULL) {
|
||||
/* we got a delta unit on this pad */
|
||||
ogg_mux->delta_pad = pad;
|
||||
}
|
||||
/* mark the page as delta */
|
||||
pad->first_delta = TRUE;
|
||||
} else {
|
||||
|
|
|
@ -94,7 +94,7 @@ fail_if_audio (gpointer key, ChainState * state, gpointer data)
|
|||
fail_if (state->codec == CODEC_SPEEX, "speex BOS occurred before theora BOS");
|
||||
}
|
||||
|
||||
static void
|
||||
static ChainState *
|
||||
validate_ogg_page (ogg_page * page)
|
||||
{
|
||||
gulong serialno;
|
||||
|
@ -146,8 +146,18 @@ validate_ogg_page (ogg_page * page)
|
|||
G_GINT64_FORMAT, serialno, state->last_granule, granule);
|
||||
state->last_granule = granule;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
static void
|
||||
is_video (gpointer key, ChainState * state, gpointer data)
|
||||
{
|
||||
if (state->codec == CODEC_THEORA)
|
||||
*((gboolean *) data) = TRUE;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
eos_buffer_probe (GstPad * pad, GstBuffer * buffer, gpointer unused)
|
||||
{
|
||||
|
@ -155,6 +165,8 @@ eos_buffer_probe (GstPad * pad, GstBuffer * buffer, gpointer unused)
|
|||
gint size;
|
||||
guint8 *data;
|
||||
gchar *oggbuffer;
|
||||
ChainState *state = NULL;
|
||||
gboolean has_video = FALSE;
|
||||
|
||||
size = GST_BUFFER_SIZE (buffer);
|
||||
data = GST_BUFFER_DATA (buffer);
|
||||
|
@ -168,10 +180,24 @@ eos_buffer_probe (GstPad * pad, GstBuffer * buffer, gpointer unused)
|
|||
|
||||
ret = ogg_sync_pageout (&oggsync, &page);
|
||||
if (ret > 0)
|
||||
validate_ogg_page (&page);
|
||||
state = validate_ogg_page (&page);
|
||||
}
|
||||
while (ret != 0);
|
||||
|
||||
if (state) {
|
||||
/* Now, we can do buffer-level checks...
|
||||
* If we have video somewhere, then we should have DELTA_UNIT set on all
|
||||
* non-header (not IN_CAPS), non-video buffers
|
||||
*/
|
||||
g_hash_table_foreach (eos_chain_states, (GHFunc) is_video, &has_video);
|
||||
if (has_video && state->codec != CODEC_THEORA) {
|
||||
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_IN_CAPS))
|
||||
fail_unless (GST_BUFFER_FLAG_IS_SET (buffer,
|
||||
GST_BUFFER_FLAG_DELTA_UNIT),
|
||||
"Non-video buffer doesn't have DELTA_UNIT in stream with video");
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue