You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/10/16 07:40:41 UTC

(nuttx) branch master updated (ef827e88a7 -> de2920605d)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


    from ef827e88a7 net: Copy out also can cmsg data into the end of packet
     new 42e416d054 nuttx/audio: increase bits of samplerate in struct audio_info_s.
     new de2920605d sim_offload: add MONO channel encode method and set samplerate before encode.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/sim/src/sim/sim_offload.c | 14 ++++++++++++--
 include/nuttx/audio/audio.h    |  8 ++++----
 2 files changed, 16 insertions(+), 6 deletions(-)


(nuttx) 01/02: nuttx/audio: increase bits of samplerate in struct audio_info_s.

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 42e416d05476f7ea2d5d95ed7a2cfaa75480e6a8
Author: wurui3 <wu...@xiaomi.com>
AuthorDate: Thu Nov 23 11:15:48 2023 +0800

    nuttx/audio: increase bits of samplerate in struct audio_info_s.
    
    Current 8 bits of uint8_t cannot represent sample rate bigger than
    255,change uint8_t to uint32_t to expand sample rate range.
    
    Signed-off-by: wurui3 <wu...@xiaomi.com>
---
 include/nuttx/audio/audio.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/nuttx/audio/audio.h b/include/nuttx/audio/audio.h
index d6783dbb6c..1d1ae1fe3f 100644
--- a/include/nuttx/audio/audio.h
+++ b/include/nuttx/audio/audio.h
@@ -436,10 +436,10 @@ struct audio_caps_desc_s
 
 struct audio_info_s
 {
-  uint8_t samplerate;   /* Sample Rate of the audio data */
-  uint8_t channels;     /* Number of channels (1, 2, 5, 7) */
-  uint8_t format;       /* Audio data format */
-  uint8_t subformat;    /* Audio subformat
+  uint32_t samplerate;   /* Sample Rate of the audio data */
+  uint8_t  channels;     /* Number of channels (1, 2, 5, 7) */
+  uint8_t  format;       /* Audio data format */
+  uint8_t  subformat;    /* Audio subformat
                          * (maybe should be combined with format?
                          */
 };


(nuttx) 02/02: sim_offload: add MONO channel encode method and set samplerate before encode.

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit de2920605dee71f52ab6bd61793dcfefa91e40e8
Author: wurui3 <wu...@xiaomi.com>
AuthorDate: Thu Nov 23 11:28:36 2023 +0800

    sim_offload: add MONO channel encode method and set samplerate before encode.
    
    According to different pcm data format, set real sample rate and encode separately.
    
    Signed-off-by: wurui3 <wu...@xiaomi.com>
---
 arch/sim/src/sim/sim_offload.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/sim/src/sim/sim_offload.c b/arch/sim/src/sim/sim_offload.c
index 77577be724..49b763f9f9 100644
--- a/arch/sim/src/sim/sim_offload.c
+++ b/arch/sim/src/sim/sim_offload.c
@@ -457,6 +457,7 @@ void *sim_audio_lame_init(struct audio_info_s *info)
     {
       lame_set_num_channels(codec->gfp, info->channels);
       lame_set_mode(codec->gfp, info->channels > 1 ? STEREO : MONO);
+      lame_set_in_samplerate(codec->gfp, (int)info->samplerate);
     }
 
   ret = lame_init_params(codec->gfp);
@@ -510,8 +511,17 @@ static int sim_audio_lame_encode(void *handle,
   chs = lame_get_num_channels(codec->gfp);
   samples = insize / (sizeof(short int) * chs);
 
-  ret = lame_encode_buffer_interleaved(codec->gfp, (short int *)in, samples,
-                                       codec->out, codec->max);
+  if (chs > 1)
+    {
+      ret = lame_encode_buffer_interleaved(codec->gfp, (short int *)in,
+                                          samples, codec->out, codec->max);
+    }
+  else
+    {
+      ret = lame_encode_buffer(codec->gfp, (short int *)in, NULL, samples,
+                              codec->out, codec->max);
+    }
+
   if (ret < 0)
     {
       return ret;