Comments (6)
@alibukharai how are you able to reproduce this failure condition? Do you have a file that exhibits this behavior? I believe I had some files with some bad data in them and continuing to read got to a point where they worked, and should burn through the data in the file really quickly too, but I can see how several megabytes of bad data could take a long time to read and error through...
from esp-audio-player.
@alibukharai how are you able to reproduce this failure condition? Do you have a file that exhibits this behavior? I believe I had some files with some bad data in them and continuing to read got to a point where they worked, and should burn through the data in the file really quickly too, but I can see how several megabytes of bad data could take a long time to read and error through...
@chmorgan Thank you for your response. The MP3 data is received through an HTTPS Text-to-Speech API. I store this data in a buffer and then pass both the buffer and its length to the audio_player.cpp API to play the MP3. Below is the code snippet that handles the MP3 playback after the HTTPS finish event:
#define MAX_FILE_SIZE (1*1024*1024)
case HTTP_EVENT_ON_HEADER:
ESP_LOGI(TAG, "HTTP_EVENT_ON_HEADER");
file_total_len = 0;
break;
case HTTP_EVENT_ON_DATA:
ESP_LOGI(TAG, "HTTP_EVENT_ON_DATA, len=%d", evt->data_len);
if ((file_total_len + evt->data_len) < MAX_FILE_SIZE) {
memcpy(audio_rx_buffer + file_total_len, (char *)evt->data, evt->data_len);
file_total_len += evt->data_len;
}
break;
case HTTP_EVENT_ON_FINISH:
ESP_LOGI(TAG, "HTTP_EVENT_ON_FINISH:%d, %d K", file_total_len, file_total_len / 1024);
audio_player_play(audio_rx_buffer, file_total_len); // Link: [https://github.com/chmorgan/esp-audio-player/blob/2221e2c848c9f073f9d6ab4fc6a5cd9b46de20c7/audio_player.cpp#L471]
break;
The challenge is that reproducing this error is not straightforward. However, if such an error occurs, is there any way to provide guidance on how to handle it? The logs indicate a status error of -8 in mp3dec.h.
from esp-audio-player.
@alibukharai well -8 looks like an internal data field/format error. Today we don't do a good job of indicating we are skipping due to errors, that could be something you could use to decide to abort playback entirely, vs. continuing for hundreds of ms to try to play the data file.
from esp-audio-player.
I'd be open to suggestions for api/error reporting changes but keep in mind they could break existing users.
from esp-audio-player.
@alibukharai can you retest with the latest changes on main? It looks like this issue may have been addressed.
from esp-audio-player.
Closing as I think the issue was resolved with some fixes that were contributed.
from esp-audio-player.
Related Issues (9)
- esp-audio-player new version HOT 2
- Build warning on idfv5.0.
- lock != NULL && "Uninitialized lock used" HOT 14
- ESP-BOX status error -6 HOT 8
- feature request: How to control playback speed HOT 2
- Audio player mute and reconfig functions for MAX98357A HOT 3
- build new tag based on master HOT 1
- How to play an mp3 file of http? Is it supported? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp-audio-player.