From: Benjamin H. <be...@ke...> - 2004-04-21 00:23:35
|
On Wed, 2004-04-21 at 07:36, Matthew J. Sahagian wrote: > Forgive me if I'm mistaken about what you're trying to do, but would it ure > be possible simply to get the songs chosen for play, and attempt to allocate > memory per song, and just retain a list of where these songs are in memory > and then point to those for playing? It seems sort of strange that you're > trying to re-implement something that's technically built into the memory > manager. If there is no contiguous block large enough to hold the mp3 then > you could attempt to split, and store half in one part half in another, > and continue to split until it does fit... just an idea. It's a lot more easier imho to just have a ring buffer of MP3 data chunks. One chunk can be a complete song, or a partial chunk (buffer too full to store a complete chunk). The iPod can typically "wakeup" when it's at about 20 seconds of buffer exhaustion to refill with the next songs in the list (Provided the refilling can be done without interrupting the playback, dunno if the dual CPU architecture allow you that, I doubt your IDE can do DMA, can it ?) > > On Tue, 20 Apr 2004 09:46:11 +0200 > "Jonathan C. Ross" <jon...@ba...> wrote: > > > Hi Bernard et. al., > > > > As mentioned before on the mailing list, I am working on a play > > queue/multi song buffer, and incorporating mp3 playback into podzilla. > > In the process, I have run into a problem with memory management. After > > coding and testing on the host (works great with libmad!) I > > cross-compiled and installed the app on my iPod. Upon initialisation I > > allocate 16M for the buffer, but this fails on the iPod. (Okay, I > > probably need to allocate several blocks instead of one chunk, because > > there is definately more than 20 M free, albeit not contiguous.) I then > > wrote a simple-minded programme to probe the maximum amount of > > contiguous memory: > > > > int main() > > { > > int bytes = 1; > > char* buffer; > > > > while (buffer = (char*) malloc(bytes * sizeof(char))) { > > free(buffer); > > printf ("success with %d bytes\n", bytes); > > bytes <<=1; > > } > > > > return 1; > > } > > > > The app hangs after 64-512 bytes, with endless errors scrolling by on > > the lcd display, too fast to read. I am invoking the app via telnet > > with the 2.4.24-ipod0 kernel. I have not tried it standalone. As there > > are examples of malloc in existing code, I can only presume that there > > is a problem with free(), or that I am missing the point entirely... (I > > haven't coded plain c in a couple of years). > > > > Anbody else seen this behaviour? If not, any pointers as to how I can > > debug it? (Slowing down the console messages would be a start!) > > > > A quick update on my progress: I have built a standalone libmad app with > > console input (play/pause/quit) and with a modest (1 song) buffer (using > > mmap). This works fine on the iPod, except of course that it is not > > 100% real time... (a couple of tweaks in the configuration of libmad did > > improve matters drastically though! I still have hope...). Otherwise, > > I have built a circular buffer for multiple-track caching into > > Podzilla. Playback is incorporated into the main loop by decoding a > > single frame in between each successive poll of the event loop. > > > > As soon as I have sorted out the allocation problems and tidied up the > > code a little, I will post my patches. > > > > Thanks, > > Jonathan. > > > > P.S. since I upgraded to the ipod0 kernel, I have not been able to ftp > > -p 192.10.1.1 anymore. Anyone know what's going on there? > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: IBM Linux Tutorials > > Free Linux tutorial presented by Daniel Robbins, President and CEO of > > GenToo technologies. Learn everything from fundamentals to system > > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > > _______________________________________________ > > iPodlinux-devel mailing list > > iPo...@li... > > https://lists.sourceforge.net/lists/listinfo/ipodlinux-devel > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > iPodlinux-devel mailing list > iPo...@li... > https://lists.sourceforge.net/lists/listinfo/ipodlinux-devel -- Benjamin Herrenschmidt <be...@ke...> |