Commit Graph

22 Commits

Author SHA1 Message Date
Tiago Medicci Serrano
9a68248f29 system/nxlooper: Initialize audio_caps_s to 0
This avoids unspecified values to be passed to the lower interfaces
of the audio subsystem.
2023-09-01 23:20:51 +08:00
jinxiuxu
df418bea81 system/audio: check if channels are valid
check ac_channels upper four bits which means min channels.

Signed-off-by: jinxiuxu <jinxiuxu@xiaomi.com>
2023-05-26 02:24:28 +08:00
jinxiuxu
ceba53402e nxlooper: set default format for nxlooper
set default format as AUDIO_FMT_PCM for nxlooper.

Signed-off-by: jinxiuxu <jinxiuxu@xiaomi.com>
2023-05-15 17:30:57 +08:00
Gustavo Henrique Nihei
efb4e0bc91 Add another batch of missing headers throughout the repository
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-03-28 14:54:16 -03:00
Xiang Xiao
a29d9ea9da fsutils/examples: Include unistd.h explicitly
to get the prototypes or macros are defined in it

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-05 08:46:59 +02:00
qiaohaijiao1
3648ddce0f nxlooper: add loopback of compressed audio data.
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2023-02-02 14:36:08 +08:00
Gustavo Henrique Nihei
b0da60e498 apps: Use MIN/MAX definitions from "sys/param.h"
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-02 00:35:14 +02:00
liubojun1
928fb2be6d apps/system/nxplayer&nxlooper: fix codechecker warning
nxplayer_main.c:
code checker warning:
level_percent = (uint8_t) atoi(parg);
     'atoi' used to convert a string to an integer value, but function will not report conversion errors; consider using 'strtol' instead.
nxlooper_main.c:
code checker warning:
percent = (uint16_t)(atof(parg) * 10.0);
     'atof' used to convert a string to a floating-point value, but function will not report conversion errors; consider using 'strtod' instead

Signed-off-by: liubojun1 <liubojun1@xiaomi.com>
2023-01-25 23:44:07 +02:00
ligd
0bf87e7893 system/media: fix race condion on pthread id
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-01-20 22:47:26 +08:00
ligd
0e06cfeaec system/media: replace sem lock with pthread_mutex
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-01-20 22:47:26 +08:00
Xiang Xiao
893387b2c5 Fix the minor style issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 19:07:16 +02:00
Xiang Xiao
9291d07a87 Fix the coding style issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-06 12:20:32 +02:00
jihandong
6afc226350 nxlooper nxplayer nxrecorder: fix coverity bug
readline might return EOF.

Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-08-16 14:59:19 +08:00
ligd
8081711e22 nxlooper: nxlooper should wait call buffer returned before close
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-29 19:18:34 +03:00
qiaohaijiao1
442d52e878 system/nxlooper: fix warning
nxlooper.c:615:7: warning: 'playbufs' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2022-03-31 16:59:16 +08:00
ligd
427798f7ee nxlooper: support different period size of player & recorder
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 02:46:07 +08:00
Xiang Xiao
d364d7a810 system: Fix nx[looper|player|recorder] warning
nxlooper.c:879:7: warning: 'strncpy' specified bound 96 equals destination size [-Wstringop-truncation]
  879 |       strncpy(plooper->recorddev, pdevice, sizeof(plooper->playdev));
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nxlooper.c:875:7: warning: 'strncpy' specified bound 96 equals destination size [-Wstringop-truncation]
  875 |       strncpy(plooper->playdev, pdevice, sizeof(plooper->playdev));
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nxlooper.c: In function 'nxlooper_loopraw':
nxlooper.c:165:52: warning: '%s' directive output may be truncated writing up to 96 bytes into a region of size 53 [-Wformat-truncation=]
  165 |           snprintf(path, sizeof(path), "/dev/audio/%s", pdevice->d_name);
      |                                                    ^~
nxlooper.c:165:11: note: 'snprintf' output between 12 and 108 bytes into a destination of size 64
  165 |           snprintf(path, sizeof(path), "/dev/audio/%s", pdevice->d_name);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nxplayer.c: In function 'nxplayer_playinternal':
nxplayer.c:359:53: warning: '%s' directive output may be truncated writing up to 96 bytes into a region of size 53 [-Wformat-truncation=]
  359 |           snprintf(path,  sizeof(path), "/dev/audio/%s", pdevice->d_name);
      |                                                     ^~
nxplayer.c:359:11: note: 'snprintf' output between 12 and 108 bytes into a destination of size 64
  359 |           snprintf(path,  sizeof(path), "/dev/audio/%s", pdevice->d_name);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nxrecorder.c: In function 'nxrecorder_setdevice':
nxrecorder.c:695:3: warning: 'strncpy' specified bound 96 equals destination size [-Wstringop-truncation]
  695 |   strncpy(precorder->device, pdevice, sizeof(precorder->device));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nxplayer.c: In function 'nxplayer_setdevice':
nxplayer.c:1686:3: warning: 'strncpy' specified bound 96 equals destination size [-Wstringop-truncation]
 1686 |   strncpy(pplayer->prefdevice, pdevice, sizeof(pplayer->prefdevice));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CC:  nxrecorder_main.c
nxplayer.c: In function 'nxplayer_setmediadir':
nxplayer.c:2090:3: warning: 'strncpy' specified bound 96 equals destination size [-Wstringop-truncation]
 2090 |   strncpy(pplayer->mediadir, mediadir, sizeof(pplayer->mediadir));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-23 11:05:18 +02:00
Xiang Xiao
ca70e585b1 system/nxlooper: Fix the following compiler warning
nxlooper.c: In function 'nxlooper_opendevice':
Error: nxlooper.c:126:15: error: unused variable 'x' [-Werror=unused-variable]
  126 |       uint8_t x;
      |               ^
Error: nxlooper.c:125:15: error: unused variable 'supported' [-Werror=unused-variable]
  125 |       uint8_t supported = true;
      |               ^~~~~~~~~
In file included from nxlooper.c:40:
nxlooper.c: In function 'nxlooper_loopthread':
Error: nxlooper.c:482:15: error: format '%d' expects argument of type 'int', but argument 3 has type 'ssize_t' {aka 'long int'} [-Werror=format=]
  482 |       audinfo("message received size %d id%d\n", size, msg.msg_id);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~
      |                                                  |
      |                                                  ssize_t {aka long int}
nxlooper.c:482:39: note: format string is defined here
  482 |       audinfo("message received size %d id%d\n", size, msg.msg_id);
      |                                      ~^
      |                                       |
      |                                       int
      |                                      %ld
cc1: all warnings being treated as errors
make[3]: *** [/github/workspace/sources/apps/Application.mk:133: nxlooper.c.github.workspace.sources.apps.system.nxlooper.o] Error 1
nxlooper_main.c: In function 'nxlooper_cmd_loopback':
Error: nxlooper_main.c:209:9: error: implicit declaration of function 'nxlooper_loopraw'; did you mean 'nxlooper_stop'? [-Werror=implicit-function-declaration]
  209 |   ret = nxlooper_loopraw(plooper, channels, bpsamp,
      |         ^~~~~~~~~~~~~~~~
      |         nxlooper_stop

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-10 07:45:42 -03:00
Alin Jerpelea
84e0ca1310 system: update licenses to Apache
Gregory Nutt is has submitted the SGA

Ken Pettit has submitted the ICLA

David S. Alessio has submitted the ICLA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-11 02:42:05 -05:00
Xiang Xiao
213e60232f Include assert.h in necessary place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-31 08:51:22 +02:00
ligd
0e4c29be03 system/nx: update mqueue_open return value
Change-Id: Ic8d7763fa2da01312cb0e02b4aaf73893cad471a
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-03 21:15:00 -06:00
danguanghua
a4f240e0e1 system: nxlooper: add nxlooper for loopback test
N/A

which record and play raw data using audio subsystem
to verify audio record and playback function

Signed-off-by: danguanghua <danguanghua@xiaomi.com>

Change-Id: I2c768b8e8234a31f9622cb9955f785329cf402a5
Signed-off-by: danguanghua <danguanghua@xiaomi.com>
2020-12-25 02:26:52 -06:00