dimitris-c / AudioStreaming

An AudioPlayer/Streaming library for iOS written in Swift using AVAudioEngine.
MIT License
265 stars 56 forks source link

Improve the fixing of un-optimized M4A #97

Open skyline75489 opened 1 month ago

skyline75489 commented 1 month ago

For some songs, the current implementation does not fetch enough data for mdat to show up. This is one of the problematic songs:

Atom ftyp @ 0 of size: 32, ends @ 32
Atom free @ 32 of size: 112547, ends @ 112579
Atom free @ 112579 of size: 483674, ends @ 596253
Atom mdat @ 596253 of size: 6359629, ends @ 6955882
Atom moov @ 6955882 of size: 113172, ends @ 7069054
     Atom mvhd @ 6955890 of size: 108, ends @ 6955998
     Atom trak @ 6955998 of size: 69281, ends @ 7025279

The mdat was at 596253. However the first packet received is only 13667 bytes long. The current logic does not takes this scenario into consideration.

dimitris-c commented 2 weeks ago

Hey, thanks for raising this issue, I'll try and provide a fix for this

dimitris-c commented 2 weeks ago

Could you add a file that's failing to test? thanks

skyline75489 commented 1 day ago

I'm not sure if I should share copyrighted music here. Let me see if I can find something public domain & with smaller size.