703将媒体流音频同时上传PC_mic录音demo实现
📎 原始文档:https://www.kdocs.cn/l/chLupZQO56Ky 703将媒体流音频同时上传PC_mic录音demo实现
参考实现源码:
JL703N_soundbox_2.0.0(patch_01.07)_媒体数据加mic_effec一并PC上行录音demo(20260416).rar
内部gitlab地址:
文件 · feature_703_media2uac · 自由品牌 / 客户支持 / JLStudio / soundbox / JL703Nsoundbox_2.0.0 · GitLab
demo中的主要修改点如下:
- 修改蓝牙同步时钟为本地时钟



- 修改dac输出为主设备输出

- 使用switch 节点将媒体音频流数据同时输出给到PC_MIC 上传 数据流参考如下:

代码修改switch 的获取状态判断代码
修改USB 插入上线时候,直接启动pc 功能,不需要切换模式
处理第一次拔出USB后无法挂载问题
处理 在 OTG 上传时直接拔掉USB接口,导致媒体或mic_effect 等switch 上传OTG的数据流dac 无声问题,log 异常一直打印fffffffff
int a2dp_file_set_switch(u8 switch_on);
a2dp_file_set_switch(0);
int esco_file_set_switch(u8 switch_on);
esco_file_set_switch(0);
int esco_recoder_set_switch(u8 switch_on);
esco_recoder_set_switch(0);
int music_file_set_switch(u8 switch_on);
music_file_set_switch(0);
int linein_file_set_switch(u8 switch_on);
linein_file_set_switch(0);
int user_mic_set_switch(u8 switch_on);
user_mic_set_switch(0);

int a2dp_file_set_switch(u8 switch_on)
{
struct a2dp_player *player = g_a2dp_player;
if (player) {
printf("%s %d",__func__,__LINE__);
return jlstream_node_ioctl(player->stream, NODE_UUID_SWITCH, NODE_IOC_SET_PARAM, (int)switch_on);
}
return -1;
}

int esco_file_set_switch(u8 switch_on)
{
struct esco_player *player = g_esco_player;
if (player) {
printf("%s %d",__func__,__LINE__);
return jlstream_node_ioctl(player->stream, NODE_UUID_SWITCH, NODE_IOC_SET_PARAM, (int)switch_on);
}
return -1;
}

int esco_recoder_set_switch(u8 switch_on)
{
struct esco_recoder *recoder = g_esco_recoder;
if (recoder) {
printf("%s %d",__func__,__LINE__);
return jlstream_node_ioctl(recoder->stream, NODE_UUID_SWITCH, NODE_IOC_SET_PARAM, (int)switch_on);
}
return -1;
}

int music_file_set_switch(u8 switch_on)
{
if (!app_in_mode(APP_MODE_MUSIC))
{
return -1;
}
struct file_player *player = get_music_file_player();
if (player) {
printf("%s %d",__func__,__LINE__);
return jlstream_node_ioctl(player->stream, NODE_UUID_SWITCH, NODE_IOC_SET_PARAM, (int)switch_on);
}
return -1;
}

int linein_file_set_switch(u8 switch_on)
{
struct linein_player *player = g_linein_player;
if (player) {
printf("%s %d",__func__,__LINE__);
return jlstream_node_ioctl(player->stream, NODE_UUID_SWITCH, NODE_IOC_SET_PARAM, (int)switch_on);
}
return -1;
}

int user_mic_set_switch(u8 switch_on)
{
struct mic_effect_player*player = g_mic_effect_player;
if (player) {
printf("%s %d",__func__,__LINE__);
for (int i = 0; i < MIC_EFFECT_CHANNEL_MAX; i++) {
if (player->stream[i]) {
return jlstream_node_ioctl(player->stream[i], NODE_UUID_SWITCH, NODE_IOC_SET_PARAM, (int)switch_on);
}
}
}
return -1;
}