]> code.ossystems Code Review - meta-freescale.git/blob
065cab1c95012680518a00ec31cb6d5f98e37bd7
[meta-freescale.git] /
1 From fb5ee30ae43d97665229c646f0441cc6f8270145 Mon Sep 17 00:00:00 2001
2 From: Chen Liangjun <b36089@freescale.com>
3 Date: Thu, 15 Dec 2011 14:20:16 +0800
4 Subject: [PATCH 3/3] ENGR00162747 fix asrc sample rate convert issue
5
6 The original code assume that when input file length reach 0, the output
7 length should reach 0 too. Because of precision of algorithm calculating
8 the output file length, when convert 96k to 88.2k, the output file
9 length does not reach 0 when input length is 0. So the delete queue operation
10 of output buffer is blocked when there is no input buffer setuped and a
11 timeout error happens.
12
13 The new code break out of the "while(info->data_length>=0)" before the delete
14 queue operation of output buffer to make sure every time a delete output
15 queue operation happens, there is a input buffer set already.
16
17 Signed-off-by: Chen Liangjun <b36089@freescale.com>
18
19 diff --git a/test/mxc_asrc_test/mxc_asrc_test.c b/test/mxc_asrc_test/mxc_asrc_test.c
20 index 8e29fd2..e34fe95 100644
21 --- a/test/mxc_asrc_test/mxc_asrc_test.c
22 +++ b/test/mxc_asrc_test/mxc_asrc_test.c
23 @@ -252,6 +252,8 @@ int play_file(int fd_asrc, struct audio_info_s *info)
24  
25                 if ((err = ioctl(fd_asrc, ASRC_STATUS, &flags)) < 0)
26                         goto ERROR;
27 +               if (info->data_len == 0)
28 +                       break;
29  
30                 if ((err = ioctl(fd_asrc, ASRC_DQ_OUTBUF, &outbuf)) < 0)
31                         goto ERROR;
32 @@ -348,6 +350,8 @@ int play_file(int fd_asrc, struct audio_info_s *info)
33                 memcpy(output_p, p, outbuf.length);
34                 output_p = output_p + outbuf.length;
35                 info->output_data_len -= outbuf.length;
36 +               if (info->output_data_len == 0)
37 +                       break;
38                 if ((err = ioctl(fd_asrc, ASRC_Q_OUTBUF, &outbuf)) < 0)
39                         goto ERROR;
40                 if ((err = ioctl(fd_asrc, ASRC_DQ_INBUF, &inbuf)) < 0)
41 @@ -357,6 +361,8 @@ int play_file(int fd_asrc, struct audio_info_s *info)
42  
43                 if ((err = ioctl(fd_asrc, ASRC_Q_INBUF, &inbuf)) < 0)
44                         goto ERROR;
45 +               if ((err = ioctl(fd_asrc, ASRC_START_CONV, &inbuf)) < 0)
46 +                       goto ERROR;
47         }
48         err = ioctl(fd_asrc, ASRC_STOP_CONV, &pair_index);
49  
50 -- 
51 1.7.1
52