请教opus编码输出卡顿的问题

lin9100
Posts: 3
Joined: Thu Jul 15, 2021 8:59 am

请教opus编码输出卡顿的问题

Postby lin9100 » Thu Jul 15, 2021 9:14 am

我在使用ADF2.3的opus编码时发现,opus的输出并不流畅,数据输出卡顿。
我的数据流为:
i2s -》opus编码-》raw
opus参数如下:
sample_rate = 16000
ch = 1
bit_rate = 6000
complexity = 0

在raw中的数据并不能实时输出,raw的ringbuf输出部分数据后会有几百个ms的空闲。
感觉是opus编码器内部进行了较大深度的缓存?是否有解决实时性问题的方案?

ESP_HengYC
Posts: 184
Joined: Fri Dec 15, 2017 2:45 am

Re: 请教opus编码输出卡顿的问题

Postby ESP_HengYC » Thu Jul 22, 2021 7:18 am

opus 录音部分的 while 循环参考如下:

Code: Select all

    while (1) {
        audio_event_iface_msg_t msg;
        if (audio_event_iface_listen(evt, &msg, 1000 / portTICK_RATE_MS) != ESP_OK) {
            second_recorded ++;
            ESP_LOGI(TAG, "[ * ] Recording ... %d", second_recorded);
            if (second_recorded >= RECORD_TIME_SECONDS) {
                audio_element_set_ringbuf_done(i2s_stream_reader);
            }
            continue;
        }

        /* Stop when the last pipeline element (fatfs_stream_writer in this case) receives stop event */
        if (msg.source_type == AUDIO_ELEMENT_TYPE_ELEMENT && msg.source == (void *) fatfs_stream_writer
            && msg.cmd == AEL_MSG_CMD_REPORT_STATUS
            && (((int)msg.data == AEL_STATUS_STATE_STOPPED) || ((int)msg.data == AEL_STATUS_STATE_FINISHED)
                || ((int)msg.data == AEL_STATUS_ERROR_OPEN))) {
            ESP_LOGW(TAG, "[ * ] Stop event received");
            break;
        }
    }

Who is online

Users browsing this forum: No registered users and 8 guests