diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-01-30 15:52:54 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-01-30 15:52:54 +1100 |
| commit | ef8d404b15e6d32506617a95aa3161fbe59ecdaf (patch) | |
| tree | f05d5f0a81b1477846e85bf44f0154db015b9789 /src/audio/audio_task.cpp | |
| parent | 2cc0a38a1ac7fc54d7333dafa8b99479a7f5dc86 (diff) | |
| download | tangara-fw-ef8d404b15e6d32506617a95aa3161fbe59ecdaf.tar.gz | |
Continue ironing out i2s pipeline
still at least one heap corruption issue, plus the i2s write method
seems to block forever :/
Diffstat (limited to 'src/audio/audio_task.cpp')
| -rw-r--r-- | src/audio/audio_task.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/audio/audio_task.cpp b/src/audio/audio_task.cpp index 538cb201..8af3e7ff 100644 --- a/src/audio/audio_task.cpp +++ b/src/audio/audio_task.cpp @@ -66,9 +66,9 @@ void AudioTaskMain(void* args) { !element->IsOverBuffered(); if (has_work_to_do) { - ESP_LOGI(kTag, "checking for events"); + ESP_LOGD(kTag, "checking for events"); } else { - ESP_LOGI(kTag, "waiting for events"); + ESP_LOGD(kTag, "waiting for events"); } // If we have no new events to process and the element has nothing left to @@ -83,13 +83,13 @@ void AudioTaskMain(void* args) { if (new_event->tag == StreamEvent::UNINITIALISED) { ESP_LOGE(kTag, "discarding invalid event!!"); } else if (new_event->tag == StreamEvent::CHUNK_NOTIFICATION) { - ESP_LOGI(kTag, "marking chunk as used"); + ESP_LOGD(kTag, "marking chunk as used"); element->OnChunkProcessed(); } else { // This isn't an event that needs to be actioned immediately. Add it // to our work queue. pending_events.emplace_back(new_event); - ESP_LOGI(kTag, "deferring event"); + ESP_LOGD(kTag, "deferring event"); } // Loop again, so that we service all incoming events before doing our // possibly expensive processing. @@ -97,7 +97,7 @@ void AudioTaskMain(void* args) { } if (element->HasUnflushedOutput()) { - ESP_LOGI(kTag, "flushing output"); + ESP_LOGD(kTag, "flushing output"); } // We have no new events. Next, see if there's anything that needs to be @@ -112,7 +112,7 @@ void AudioTaskMain(void* args) { } if (element->HasUnprocessedInput()) { - ESP_LOGI(kTag, "processing input events"); + ESP_LOGD(kTag, "processing input events"); auto process_res = element->Process(); if (!process_res.has_error() || process_res.error() != OUT_OF_DATA) { // TODO: log! @@ -123,19 +123,20 @@ void AudioTaskMain(void* args) { // The element ran out of data, so now it's time to let it process more // input. while (!pending_events.empty()) { - auto& event = pending_events.front(); - ESP_LOGI(kTag, "processing event, tag %i", event->tag); + std::unique_ptr<StreamEvent> event; + pending_events.front().swap(event); + pending_events.pop_front(); + ESP_LOGD(kTag, "processing event, tag %i", event->tag); if (event->tag == StreamEvent::STREAM_INFO) { - ESP_LOGI(kTag, "processing stream info"); + ESP_LOGD(kTag, "processing stream info"); auto process_res = element->ProcessStreamInfo(*event->stream_info); - pending_events.pop_front(); if (process_res.has_error()) { // TODO(jacqueline) ESP_LOGE(kTag, "failed to process stream info"); } } else if (event->tag == StreamEvent::CHUNK_DATA) { - ESP_LOGI(kTag, "processing chunk data"); + ESP_LOGD(kTag, "processing chunk data"); auto callback = StreamEvent::CreateChunkNotification(element->InputEventQueue()); if (!xQueueSend(event->source, &callback, 0)) { @@ -145,7 +146,6 @@ void AudioTaskMain(void* args) { auto process_chunk_res = element->ProcessChunk(event->chunk_data.bytes); - pending_events.pop_front(); if (process_chunk_res.has_error()) { // TODO(jacqueline) ESP_LOGE(kTag, "failed to process chunk"); |
