]> code.ossystems Code Review - meta-freescale.git/blob
d76c74d44e8a979c331d14e720d6ce760f952313
[meta-freescale.git] /
1 From 9acab46fe307ec71d4a4dbe447e356f90b6a4a09 Mon Sep 17 00:00:00 2001
2 From: Shengjiu Wang <shengjiu.wang@freescale.com>
3 Date: Fri, 12 Dec 2014 14:58:06 +0800
4 Subject: [PATCH] [asrc_pair] update output buffer size
5
6 When input size larger than DMA_MAX_BYTES the output size should be updated.
7 Otherwise the asrc have will not have enough data, then it will be timeout.
8
9 Upstream Status: Inappropriate [platform specific]
10
11 Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
12 ---
13  asrc/asrc_pair.c | 11 ++++++++---
14  1 file changed, 8 insertions(+), 3 deletions(-)
15
16 diff --git a/asrc/asrc_pair.c b/asrc/asrc_pair.c
17 index e3df027..e74e8b1 100644
18 --- a/asrc/asrc_pair.c
19 +++ b/asrc/asrc_pair.c
20 @@ -139,7 +139,7 @@ asrc_pair *asrc_pair_create(unsigned int channels, ssize_t in_period_frames,
21      config.dma_buffer_size = dma_buffer_size;
22      config.input_sample_rate = in_rate;
23      config.output_sample_rate = out_rate;
24 -    config.buffer_num = 1;
25 +    config.buffer_num = buf_num;
26      config.input_word_width = ASRC_WIDTH_16_BIT;
27      config.output_word_width = ASRC_WIDTH_16_BIT;
28      config.inclk = INCLK_NONE;
29 @@ -303,8 +303,13 @@ void asrc_pair_convert_s16(asrc_pair *pair, const int16_t *src, unsigned int src
30
31      while (src_left > 0)
32      {
33 -        in_len = src_left > pair->buf_size ? pair->buf_size : src_left;
34 -        out_len = dst_left;
35 +       if (src_left > pair->buf_size) {
36 +               in_len = pair->buf_size;
37 +               out_len = dst_left * in_len/src_left;
38 +       } else {
39 +               in_len = src_left;
40 +               out_len = dst_left;
41 +       }
42
43          buf_info.input_buffer_vaddr = s;
44          buf_info.input_buffer_length = in_len;
45 --
46 1.9.1
47