summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-07-31 10:14:03 +1000
committerjacqueline <me@jacqueline.id.au>2023-07-31 10:14:03 +1000
commit0a8d2fd12e0781c32d23b67dd938e3ba8caf782e (patch)
tree5378061295f78ca61e32363f82e5104c3cb2a692
parenta5022ac6cb64ef68210b8204591b1deb84ea70d8 (diff)
downloadtangara-fw-0a8d2fd12e0781c32d23b67dd938e3ba8caf782e.tar.gz
fix flac playback. now it plays nice and smooth :)
-rw-r--r--src/audio/fatfs_audio_input.cpp2
-rw-r--r--src/codecs/foxenflac.cpp8
-rw-r--r--src/tasks/tasks.cpp2
3 files changed, 9 insertions, 3 deletions
diff --git a/src/audio/fatfs_audio_input.cpp b/src/audio/fatfs_audio_input.cpp
index b1d4108a..0c3ef20d 100644
--- a/src/audio/fatfs_audio_input.cpp
+++ b/src/audio/fatfs_audio_input.cpp
@@ -41,7 +41,7 @@ static const char* kTag = "SRC";
namespace audio {
static constexpr UINT kFileBufferSize = 4096 * 2;
-static constexpr UINT kStreamerBufferSize = 1024;
+static constexpr UINT kStreamerBufferSize = 4096;
static StreamBufferHandle_t sForwardDest = nullptr;
diff --git a/src/codecs/foxenflac.cpp b/src/codecs/foxenflac.cpp
index ee21da65..ce18975c 100644
--- a/src/codecs/foxenflac.cpp
+++ b/src/codecs/foxenflac.cpp
@@ -14,6 +14,8 @@
namespace codecs {
+static const char kTag[] = "flac";
+
FoxenFlacDecoder::FoxenFlacDecoder()
: flac_(FX_FLAC_ALLOC(FLAC_MAX_BLOCK_SIZE, 2)) {}
@@ -28,7 +30,11 @@ auto FoxenFlacDecoder::BeginStream(const cpp::span<const std::byte> input)
fx_flac_process(flac_, reinterpret_cast<const uint8_t*>(input.data()),
&bytes_used, NULL, NULL);
if (state != FLAC_END_OF_METADATA) {
- return {bytes_used, cpp::fail(Error::kMalformedData)};
+ if (state == FLAC_ERR) {
+ return {bytes_used, cpp::fail(Error::kMalformedData)};
+ } else {
+ return {bytes_used, cpp::fail(Error::kOutOfInput)};
+ }
}
int64_t channels = fx_flac_get_streaminfo(flac_, FLAC_KEY_N_CHANNELS);
diff --git a/src/tasks/tasks.cpp b/src/tasks/tasks.cpp
index abce0bde..861c7bf0 100644
--- a/src/tasks/tasks.cpp
+++ b/src/tasks/tasks.cpp
@@ -106,7 +106,7 @@ auto Priority() -> UBaseType_t;
// highest priority.
template <>
auto Priority<Type::kAudio>() -> UBaseType_t {
- return 10;
+ return 11;
}
// After audio issues, UI jank is the most noticeable kind of scheduling-induced
// slowness that the user is likely to notice or care about. Therefore we place