Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions tests/test_micro_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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},

Expand Down Expand Up @@ -1086,15 +1090,15 @@ 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.
std::vector<uint8_t> payload;
std::vector<uint8_t> 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;
Expand All @@ -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.
Expand Down
Loading