diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 081ead1..94e4d37 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -218,12 +218,14 @@ jobs: ~/.platformio examples/${{ matrix.example }}/.pio examples/${{ matrix.example }}/managed_components - key: pio-${{ matrix.example }}-${{ hashFiles(format('examples/{0}/platformio.ini', matrix.example), format('examples/{0}/dependencies.lock', matrix.example)) }} + key: pio-core-6.1.19-${{ matrix.example }}-${{ hashFiles(format('examples/{0}/platformio.ini', matrix.example), format('examples/{0}/dependencies.lock', matrix.example)) }} restore-keys: | - pio-${{ matrix.example }}- + pio-core-6.1.19-${{ matrix.example }}- - name: Install PlatformIO - run: pip install platformio + # The pinned pioarduino platform requires SCons 4.8.1, as used by Core 6.1.19. + # Core 6.2 replaces it with 4.11.1 during the build (pioarduino/platform-espressif32#529). + run: pip install "platformio==6.1.19" # This is the only build that compiles the component's ESP-only code paths, so it is # where their warnings have to be errors. The example's platformio.ini turns ENABLE_WERROR diff --git a/src/types.cpp b/src/types.cpp index e785233..f4d2077 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -113,7 +113,8 @@ static AudioFileType type_from_content_type(const char* content_type) { #endif } #ifdef MICRO_DECODER_CODEC_WAV - if (contains("audio/wav") || contains("audio/x-wav") || contains("audio/wave")) { + if (contains("audio/wav") || contains("audio/x-wav") || contains("audio/wave") || + contains("audio/vnd.wave")) { return AudioFileType::WAV; } #endif diff --git a/tests/test_micro_decoder.cpp b/tests/test_micro_decoder.cpp index 3bd8bde..0f9da25 100644 --- a/tests/test_micro_decoder.cpp +++ b/tests/test_micro_decoder.cpp @@ -492,6 +492,9 @@ static bool test_detect_content_type() { {"audio/wav", nullptr, AudioFileType::WAV}, {"audio/x-wav", nullptr, AudioFileType::WAV}, {"audio/wave", nullptr, AudioFileType::WAV}, + {"audio/vnd.wave", nullptr, AudioFileType::WAV}, + {"audio/vnd.wave; codec=1", "http://x.example/chime", AudioFileType::WAV}, + {"Audio/Vnd.Wave; codec=1", "http://x.example/chime?token=1", AudioFileType::WAV}, // Parameters and case-insensitivity {"audio/mpeg; charset=UTF-8", nullptr, AudioFileType::MP3}, @@ -519,6 +522,7 @@ static bool test_detect_content_type() { // Unknown types with no usable URL {"text/html", nullptr, AudioFileType::NONE}, {"application/octet-stream", nullptr, AudioFileType::NONE}, + {"application/vnd.wave", nullptr, AudioFileType::NONE}, {"", nullptr, AudioFileType::NONE}, {nullptr, nullptr, AudioFileType::NONE}, @@ -1086,7 +1090,7 @@ static bool test_destructor_while_playing() { // DecoderSource: play_url() path // ============================================================================ -static bool test_play_url_stream() { +static bool check_play_url_stream(const char* content_type) { // Full HTTP pipeline with the file type coming from Content-Type alone // (the URL path has no extension): PCM must arrive bit-exact and the // stream must end in IDLE. @@ -1094,7 +1098,7 @@ static bool test_play_url_stream() { std::vector wav = make_wav(2, 44100, 8192, &payload); TestHttpServer::Response resp; - resp.content_type = "audio/wav"; + resp.content_type = content_type; resp.body = wav; resp.chunk_size = 4096; // stream in pieces so the ring buffer matters TestHttpServer server; @@ -1120,6 +1124,11 @@ static bool test_play_url_stream() { return true; } +static bool test_play_url_stream() { + return check_play_url_stream("audio/wav") && + check_play_url_stream("audio/vnd.wave; codec=1"); +} + static bool test_play_url_extension_fallback() { // No Content-Type header at all: the file type must come from the URL // extension.