From: Mark Nauwelaerts Date: Sat, 8 Oct 2011 18:17:43 +0000 (+0200) Subject: tests: vorbisenc: adjust discontinuity checking to audioencoder behaviour X-Git-Tag: RELEASE-0.10.36~246 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b56261acf31213b59e9638d0fb5b55a674fbfdf;p=platform%2Fupstream%2Fgst-plugins-base.git tests: vorbisenc: adjust discontinuity checking to audioencoder behaviour ... which still detects gaps and marks DISCONT, depending on configuration, but may come up with somewhat different timestamps when crossing the gap. --- diff --git a/tests/check/pipelines/vorbisenc.c b/tests/check/pipelines/vorbisenc.c index b207dff..4b15a10 100644 --- a/tests/check/pipelines/vorbisenc.c +++ b/tests/check/pipelines/vorbisenc.c @@ -264,7 +264,7 @@ GST_END_TEST; static gboolean drop_second_data_buffer (GstPad * droppad, GstBuffer * buffer, gpointer unused) { - return !(GST_BUFFER_OFFSET (buffer) == 1024); + return !(GST_BUFFER_OFFSET (buffer) == 4096); } GST_START_TEST (test_discontinuity) @@ -276,8 +276,10 @@ GST_START_TEST (test_discontinuity) GError *error = NULL; guint drop_id; + /* make audioencoder act sufficiently pedantic */ pipe_str = g_strdup_printf ("audiotestsrc samplesperbuffer=1024" - " ! audio/x-raw-int,rate=44100" " ! audioconvert ! vorbisenc ! fakesink"); + " ! audio/x-raw-int,rate=44100" " ! audioconvert " + " ! vorbisenc tolerance=10000000 ! fakesink"); bin = gst_parse_launch (pipe_str, &error); fail_unless (bin != NULL, "Error parsing pipeline: %s", @@ -330,38 +332,27 @@ GST_START_TEST (test_discontinuity) check_buffer_granulepos (buffer, 0); gst_buffer_unref (buffer); - /* two phases: continuous granulepos values up to 1024, then a first - discontinuous granulepos whose granulepos corresponds to a gap ending at - 2048. */ { GstClockTime next_timestamp = 0; - gint64 last_granulepos = 0; + gint64 last_granulepos = 0, granulepos; + gint i; - while (last_granulepos < 1024) { + for (i = 0; i < 10; i++) { buffer = gst_buffer_straw_get_buffer (bin, pad); - last_granulepos = GST_BUFFER_OFFSET_END (buffer); + granulepos = GST_BUFFER_OFFSET_END (buffer); + /* discont is either at start, or following gap */ + if (GST_BUFFER_IS_DISCONT (buffer)) { + if (next_timestamp) { + fail_unless (granulepos - last_granulepos > 1024, + "expected discont of at least 1024 samples"); + next_timestamp = GST_BUFFER_TIMESTAMP (buffer); + } + } check_buffer_timestamp (buffer, next_timestamp); - fail_if (GST_BUFFER_IS_DISCONT (buffer), "expected continuous buffer"); next_timestamp += GST_BUFFER_DURATION (buffer); + last_granulepos = granulepos; gst_buffer_unref (buffer); } - - fail_unless (last_granulepos == 1024, - "unexpected granulepos: %" G_GUINT64_FORMAT, last_granulepos); - } - - { - buffer = gst_buffer_straw_get_buffer (bin, pad); - /* The first buffer after the discontinuity will produce zero output - * samples (because of the overlap/add), so it won't increment the - * granulepos, which should be 2048 after the discontinuity. - */ - fail_unless (GST_BUFFER_OFFSET_END (buffer) == 2048, - "expected granulepos after gap: %" G_GUINT64_FORMAT, - GST_BUFFER_OFFSET_END (buffer)); - fail_unless (GST_BUFFER_IS_DISCONT (buffer), - "expected discontinuous buffer"); - gst_buffer_unref (buffer); } gst_buffer_straw_stop_pipeline (bin, pad);