examples\player\pipeline_bt_sink例程可以正常工作,手机连接蓝牙可以放歌。但是偶尔丢包,不过声音是正常的。
Code: Select all
BT_APPL: Pkt dropped
录音pipeline代码如下
Code: Select all
static audio_pipeline_handle_t example_create_rec_pipeline(const char *url, int sample_rates, int channels)
{
audio_pipeline_handle_t pipeline;
audio_pipeline_cfg_t pipeline_cfg = DEFAULT_AUDIO_PIPELINE_CONFIG();
pipeline = audio_pipeline_init(&pipeline_cfg);
mem_assert(pipeline);
ESP_LOGI(TAG, "[ * ] Save record data as %dHz, %dChannels wav file named [%s]", sample_rates, channels, url);
fatfs_stream_cfg_t fatfs_write_cfg = FATFS_STREAM_CFG_DEFAULT();
fatfs_write_cfg.type = AUDIO_STREAM_WRITER;
fatfs_stream_writer = fatfs_stream_init(&fatfs_write_cfg);
i2s_stream_cfg_t i2s_file_cfg = I2S_STREAM_CFG_DEFAULT();
i2s_file_cfg.type = AUDIO_STREAM_READER;
/*
i2s_file_cfg.i2s_config.dma_buf_count = DMA_BUF_COUNT;
i2s_file_cfg.i2s_config.dma_buf_len = DMA_BUF_LEN;
*/
i2s_stream_reader = i2s_stream_init(&i2s_file_cfg);
wav_encoder_cfg_t wav_file_cfg = DEFAULT_WAV_ENCODER_CONFIG();
wav_encoder = wav_encoder_init(&wav_file_cfg);
rsp_filter_cfg_t rsp_file_cfg = DEFAULT_RESAMPLE_FILTER_CONFIG();
rsp_file_cfg.src_rate = 44100;
rsp_file_cfg.src_ch = 1;
rsp_file_cfg.dest_rate = sample_rates;
rsp_file_cfg.dest_ch = channels;
rsp_file_cfg.mode = RESAMPLE_DECODE_MODE;
resample_for_rec = rsp_filter_init(&rsp_file_cfg);
audio_pipeline_register(pipeline, i2s_stream_reader, "i2s");
audio_pipeline_register(pipeline, wav_encoder, "wav");
audio_pipeline_register(pipeline, resample_for_rec, "filter");
audio_pipeline_register(pipeline, fatfs_stream_writer, "file");
audio_pipeline_link(pipeline, (const char *[]) {"i2s", "filter", "wav", "file"}, 4);
audio_element_set_uri(fatfs_stream_writer, url);
return pipeline;
}