Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make as much code common between AudioFileSourceHTTPStream and AudioFileSourceICYStream as possible #458

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

wojtekka
Copy link
Contributor

@wojtekka wojtekka commented Dec 3, 2021

Most of the AudioFileSourceHTTPStream was repeated in AudioFileSourceICYStream which caused some inconsistencies, e.g. redirects were enabled in ICY unconditionally and in HTTP only on devices other than ESP32.

Now just the ICY-specific parts are implemented in AudioFileSourceICYStream. readInternal() is implemented only in
AudioFileSourceHTTPStream and it delegates actual stream reading and parsing to a new virtual method parseInternal(). This wasy AudioFileSourceHTTPStream can merely read the data into the buffer and AudioFileSourceICYStream can parse metadata at will.

Additionally some HTTP error callback report error code (easier debugging) and reconnection failure is not reported if reconnection was not enabled at all (less confusing).

AudioFileSourceHTTPStream doesn't enable redirects on ESP32 (I'm
guessing this is some legacy things), whereas AudioFileSourceICYStream
does. ESP32 supports redirects now, so let's make things consistent.
…ileSourceICYStream as possible

Most of the AudioFileSourceHTTPStream was repeated in
AudioFileSourceICYStream which caused some inconsistencies, e.g.
redirects were enabled in ICY unconditionally and in HTTP only on
devices other than ESP32.

Now just the ICY-specific parts are implemented in
AudioFileSourceICYStream. readInternal() is implemented only in
AudioFileSourceHTTPStream and it delegates actual stream reading and
parsing to a new virtual method parseInternal(). This wasy
AudioFileSourceHTTPStream can merely read the data into the buffer and
AudioFileSourceICYStream can parse metadata at will.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant