change priorities and force spdif_convert in IRAM

This commit is contained in:
Philippe G
2022-01-11 14:44:06 -08:00
parent 8fa3906b52
commit 04919f7b6e
7 changed files with 8 additions and 9 deletions

View File

@@ -193,7 +193,7 @@ struct cspot_s* cspot_create(const char *name, cspot_cmd_cb_t cmd_cb, cspot_data
cspot.cHandler = cmd_cb; cspot.cHandler = cmd_cb;
cspot.dHandler = data_cb; cspot.dHandler = data_cb;
strncpy(cspot.name, name, sizeof(cspot.name) - 1); strncpy(cspot.name, name, sizeof(cspot.name) - 1);
cspot.TaskHandle = xTaskCreateStatic(&cspotTask, "cspot", CSPOT_STACK_SIZE, NULL, CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT, xStack, &xTaskBuffer); cspot.TaskHandle = xTaskCreateStatic(&cspotTask, "cspot", CSPOT_STACK_SIZE, NULL, CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT - 2, xStack, &xTaskBuffer);
return &cspot; return &cspot;
} }

View File

@@ -29,7 +29,7 @@ namespace bell
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM
this->xStack = NULL; this->xStack = NULL;
this->priority = CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT + priority; this->priority = CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT + priority;
if (this->priority < 0) this->priority = ESP_TASK_PRIO_MIN; if (this->priority <= ESP_TASK_PRIO_MIN) this->priority = ESP_TASK_PRIO_MIN + 1;
if (runOnPSRAM) { if (runOnPSRAM) {
this->xStack = (StackType_t*) heap_caps_malloc(this->stackSize, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); this->xStack = (StackType_t*) heap_caps_malloc(this->stackSize, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
} }

View File

@@ -3,7 +3,7 @@
#include "Logger.h" #include "Logger.h"
AudioChunkManager::AudioChunkManager() AudioChunkManager::AudioChunkManager()
: bell::Task("AudioChunkManager", 4 * 1024, 2, 0) { : bell::Task("AudioChunkManager", 4 * 1024, -1, 0) {
this->chunks = std::vector<std::shared_ptr<AudioChunk>>(); this->chunks = std::vector<std::shared_ptr<AudioChunk>>();
startTask(); startTask();
} }

View File

@@ -9,7 +9,7 @@ std::map<MercuryType, std::string> MercuryTypeMap({
{MercuryType::UNSUB, "UNSUB"}, {MercuryType::UNSUB, "UNSUB"},
}); });
MercuryManager::MercuryManager(std::unique_ptr<Session> session): bell::Task("mercuryManager", 6 * 1024, 2, 1) MercuryManager::MercuryManager(std::unique_ptr<Session> session): bell::Task("mercuryManager", 6 * 1024, -2, 1)
{ {
tempMercuryHeader = {}; tempMercuryHeader = {};
this->timeProvider = std::make_shared<TimeProvider>(); this->timeProvider = std::make_shared<TimeProvider>();

View File

@@ -3,7 +3,7 @@
// #include <valgrind/memcheck.h> // #include <valgrind/memcheck.h>
Player::Player(std::shared_ptr<MercuryManager> manager, std::shared_ptr<AudioSink> audioSink): bell::Task("player", 10 * 1024, +0, 1) Player::Player(std::shared_ptr<MercuryManager> manager, std::shared_ptr<AudioSink> audioSink): bell::Task("player", 10 * 1024, -2, 1)
{ {
this->audioSink = audioSink; this->audioSink = audioSink;
this->manager = manager; this->manager = manager;

View File

@@ -672,7 +672,7 @@ static const u16_t spdif_bmclookup[256] = { //biphase mark encoded values (least
audio is transmitted first (not the MSB) and that ESP32 libray sends R then L, audio is transmitted first (not the MSB) and that ESP32 libray sends R then L,
contrary to what seems to be usually done, so (dst) order had to be changed contrary to what seems to be usually done, so (dst) order had to be changed
*/ */
void spdif_convert(ISAMPLE_T *src, size_t frames, u32_t *dst, size_t *count) { static void IRAM_ATTR spdif_convert(ISAMPLE_T *src, size_t frames, u32_t *dst, size_t *count) {
register u16_t hi, lo, aux; register u16_t hi, lo, aux;
size_t cnt = *count; size_t cnt = *count;

View File

@@ -13,11 +13,12 @@
#include <ctype.h> #include <ctype.h>
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "tools.h" #include "esp_task.h"
#include "esp_tls.h" #include "esp_tls.h"
#include "esp_http_client.h" #include "esp_http_client.h"
#include "esp_heap_caps.h" #include "esp_heap_caps.h"
#include "esp_log.h" #include "esp_log.h"
#include "tools.h"
const static char TAG[] = "tools"; const static char TAG[] = "tools";
@@ -199,8 +200,6 @@ void http_download(char *url, size_t max, http_download_cb_t callback, void *con
.url = url, .url = url,
.event_handler = http_event_handler, .event_handler = http_event_handler,
.user_data = http_context, .user_data = http_context,
//.cert_pem = howsmyssl_com_root_cert_pem_start,
//.skip_cert_common_name_check = true,
}; };
http_context->callback = callback; http_context->callback = callback;