gpt4 book ai didi

android - 涉及音池的应用程序的 BpMemoryHeap 问题

转载 作者:行者123 更新时间:2023-11-29 00:31:51 26 4
gpt4 key购买 nike

我创建了一个涉及大约 600 个小 ogg 文件的应用程序。总计约 15MB。每个文件都会有平均。 6秒的声音。这不是游戏应用程序,而是 child 学习应用程序。

我尝试在媒体播放器上加载声音。它工作一次很好,当连续播放时我最终没有声音。它是空白的。

所以我尝试了声音池选项。声音只有在它加载到 soundpool 加载器后才会播放。因此我尝试在应用程序的开头加载声音。所以加载声音大约需要 30 秒,之后会显示主屏幕(我在后台使用 Async 加载声音,进度条显示在前面)。

此设置适用于大约 450 个 ogg 文件,当我添加一个超过 450 个声音时,我在加载几个声音时遇到堆错误,应用程序强制关闭并出现以下错误:

 02-27 07:13:02.614: I/Choreographer(27172): Skipped 35 frames!  The application may be doing too much work on its main thread.
02-27 07:13:11.012: E/IMemory(27172): binder=0x56f0c430 transaction failed fd=-2147483647, size=0, err=-2147483646 (Unknown error 2147483646)
02-27 07:13:11.012: E/IMemory(27172): cannot dup fd=-2147483647, size=0, err=-2147483646 (Bad file number)
02-27 07:13:11.012: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56f0c430), size=0, fd=-1 (Bad file number)
02-27 07:13:11.020: W/dalvikvm(27172): threadid=37: thread exiting with uncaught exception (group=0x40d75930)
02-27 07:13:11.153: E/IMemory(27172): cannot dup fd=818, size=1048576, err=0 (Too many open files)
02-27 07:13:11.153: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56f09e80), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.403: E/IMemory(27172): cannot dup fd=972, size=1048576, err=0 (Too many open files)
02-27 07:13:11.403: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56f09988), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.450: E/IMemory(27172): cannot dup fd=873, size=1048576, err=0 (Too many open files)
02-27 07:13:11.450: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56f0a500), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.520: E/IMemory(27172): cannot dup fd=954, size=1048576, err=0 (Too many open files)
02-27 07:13:11.520: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56efbde8), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.614: W/dalvikvm(27172): threadid=35: thread exiting with uncaught exception (group=0x40d75930)
02-27 07:13:11.677: E/IMemory(27172): cannot dup fd=903, size=1048576, err=0 (Too many open files)
02-27 07:13:11.677: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56f09b30), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.716: E/IMemory(27172): cannot dup fd=978, size=1048576, err=0 (Too many open files)
02-27 07:13:11.716: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x5d99add0), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.747: E/IMemory(27172): cannot dup fd=941, size=1048576, err=0 (Too many open files)
02-27 07:13:11.747: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56efb710), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.809: E/IMemory(27172): cannot dup fd=991, size=1048576, err=0 (Too many open files)
02-27 07:13:11.809: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56efaa90), size=1048576, fd=-1 (Bad file number)

我该如何解决这个问题? Heap 上的大部分问题是关于数据库游标而不是 soundpool。

如果无法解决这个问题,当我有 600 个声音要加载时,使用 soundpool 有什么变通方法?

谢谢!

最佳答案

有了这么多文件,您会想要延迟加载它们并转储一段时间未使用的文件。

有一个 LruCache在 Android 中可以帮助您。

关于android - 涉及音池的应用程序的 BpMemoryHeap 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15102931/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com