From 813b20a39f27522a9d6f2068d36b9ae40ce458a5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 4 Nov 2011 16:32:31 +0100 Subject: [PATCH] swr-test: test flushing Signed-off-by: Michael Niedermayer --- libswresample/swresample_test.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/libswresample/swresample_test.c b/libswresample/swresample_test.c index 61e1b09367..49723cdeac 100644 --- a/libswresample/swresample_test.c +++ b/libswresample/swresample_test.c @@ -99,7 +99,7 @@ static void setup_array(uint8_t *out[SWR_CH_MAX], uint8_t *in, enum AVSampleForm } int main(int argc, char **argv){ - int in_sample_rate, out_sample_rate, ch ,i, in_ch_layout_index, out_ch_layout_index, osr; + int in_sample_rate, out_sample_rate, ch ,i, in_ch_layout_index, out_ch_layout_index, osr, flush_count; uint64_t in_ch_layout, out_ch_layout; enum AVSampleFormat in_sample_fmt, out_sample_fmt; int sample_rates[]={8000,11025,16000,22050,32000}; @@ -175,6 +175,34 @@ int main(int argc, char **argv){ fprintf(stderr, "[%f %f %f] len:%5d\n", sqrt(sse/out_count), x, maxdiff, out_count); } + + flush_count=swr_convert(backw_ctx,aout, SAMPLES, 0, 0); + if(flush_count){ + for(ch=0; ch