From 0230754d778d6864bc5094756728083db324b050 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Thu, 30 Nov 2006 12:50:42 +0000 Subject: [PATCH] tests/check/pipelines/theoraenc.c: It would be very bad if, after a discont buffer, we thought every single following... Original commit message from CVS: * tests/check/pipelines/theoraenc.c: (check_buffer_granulepos), (GST_START_TEST): It would be very bad if, after a discont buffer, we thought every single following buffer was also discont. So, add to the test to ensure that this isn't the case. * ext/theora/theoraenc.c: (theora_enc_is_discontinuous): ... it was the case. So fix it. --- ChangeLog | 11 +++++++++++ ext/theora/theoraenc.c | 5 +++-- tests/check/pipelines/theoraenc.c | 9 +++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 437fc921ac..28636819a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-11-30 Michael Smith + + * tests/check/pipelines/theoraenc.c: (check_buffer_granulepos), + (GST_START_TEST): + It would be very bad if, after a discont buffer, we thought every + single following buffer was also discont. So, add to the test to + ensure that this isn't the case. + + * ext/theora/theoraenc.c: (theora_enc_is_discontinuous): + ... it was the case. So fix it. + 2006-11-28 Wim Taymans * gst/playback/gstplaybasebin.c: (check_queue_event): diff --git a/ext/theora/theoraenc.c b/ext/theora/theoraenc.c index 16c8fafbb4..86d79766cf 100644 --- a/ext/theora/theoraenc.c +++ b/ext/theora/theoraenc.c @@ -574,6 +574,7 @@ theora_enc_is_discontinuous (GstTheoraEnc * enc, GstBuffer * buffer) { GstClockTime ts = GST_BUFFER_TIMESTAMP (buffer); GstClockTimeDiff max_diff; + gboolean ret = FALSE; /* Allow 3/4 a frame off */ max_diff = (enc->info.fps_denominator * GST_SECOND * 3) / @@ -585,7 +586,7 @@ theora_enc_is_discontinuous (GstTheoraEnc * enc, GstBuffer * buffer) " exceeds expected value %" GST_TIME_FORMAT " by too much, marking discontinuity", GST_TIME_ARGS (ts), GST_TIME_ARGS (enc->expected_ts)); - return TRUE; + ret = TRUE; } } @@ -594,7 +595,7 @@ theora_enc_is_discontinuous (GstTheoraEnc * enc, GstBuffer * buffer) else enc->expected_ts = GST_CLOCK_TIME_NONE; - return FALSE; + return ret; } static GstFlowReturn diff --git a/tests/check/pipelines/theoraenc.c b/tests/check/pipelines/theoraenc.c index a6dbb1178e..f585bdbdd9 100644 --- a/tests/check/pipelines/theoraenc.c +++ b/tests/check/pipelines/theoraenc.c @@ -383,6 +383,15 @@ GST_START_TEST (test_discontinuity) fail_unless (GST_BUFFER_IS_DISCONT (buffer), "expected discontinuous buffer yo"); gst_buffer_unref (buffer); + + /* Then the buffer after that should be continuous */ + buffer = gst_buffer_straw_get_buffer (bin, pad); + fail_if (GST_BUFFER_IS_DISCONT (buffer), "expected continuous buffer yo"); + /* plain division because I know the answer is exact */ + check_buffer_duration (buffer, GST_SECOND / 10); + check_buffer_granulepos (buffer, (2 << GRANULEPOS_SHIFT) + 1); + check_buffer_is_header (buffer, FALSE); + gst_buffer_unref (buffer); } gst_buffer_straw_stop_pipeline (bin, pad);