Unified · Split
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | /*#define MINIMP3_SEEK_IDX_LINEAR_SEARCH*/ /* define to use linear index search instead of binary search on seek */ |
| 19 | 19 | #define MINIMP3_IO_SIZE (128*1024) /* io buffer size for streaming functions, must be greater than MINIMP3_BUF_SIZE */ |
| 20 | 20 | #define MINIMP3_BUF_SIZE (16*1024) /* buffer which can hold minimum 10 consecutive mp3 frames (~16KB) worst case */ |
| 21 | +/*#define MINIMP3_SCAN_LIMIT (256*1024)*/ /* how many bytes will be scanned to search first valid mp3 frame, to prevent stall on large non-mp3 files */ | |
| 21 | 22 | #define MINIMP3_ENABLE_RING 0 /* WIP enable hardware magic ring buffer if available, to make less input buffer memmove(s) in callback IO mode */ |
| 22 | 23 | |
| 23 | 24 | /* return error codes */ |
| @@ -845,7 +846,11 @@ do_exit: · 821 unmodified lines | ||
| 845 | 846 | size_t mp3dec_ex_read(mp3dec_ex_t *dec, mp3d_sample_t *buf, size_t samples) |
| 846 | 847 | { |
| 847 | 848 | if (!dec || !buf) |
| 848 | − return MP3D_E_PARAM; | |
| 849 | + { | |
| 850 | + if (dec) | |
| 851 | + dec->last_error = MP3D_E_PARAM; | |
| 852 | + return 0; | |
| 853 | + } | |
| 849 | 854 | uint64_t end_offset = dec->end_offset ? dec->end_offset : dec->file.size; |
| 850 | 855 | size_t samples_requested = samples; |
| 851 | 856 | int eof = 0; |
| @@ -531,9 +531,9 @@ static int self_test(const char *input_file_name) · 530 unmodified lines | ||
| 531 | 531 | ASSERT(MP3D_E_PARAM == ret); |
| 532 | 532 | |
| 533 | 533 | ret = mp3dec_ex_read(0, (mp3d_sample_t*)buf, 10); |
| 534 | − ASSERT(MP3D_E_PARAM == ret); | |
| 534 | + ASSERT(0 == ret); /* invalid param case, no decoder structure to report an error */ | |
| 535 | 535 | ret = mp3dec_ex_read(&dec, 0, 10); |
| 536 | − ASSERT(MP3D_E_PARAM == ret); | |
| 536 | + ASSERT(0 == ret && MP3D_E_PARAM == dec.last_error); /* invalid param case */ | |
| 537 | 537 | |
| 538 | 538 | ret = mp3dec_load(0, input_file_name, &finfo, 0, 0); |
| 539 | 539 | ASSERT(MP3D_E_PARAM == ret); |