iPod 库返回没有曲目的资源
我正在使用 MediaItem api 从 iPod 库收集资源。应用程序运行一段时间后,我遇到了一个奇怪的错误。我将运行以下代码,AVURLAsset 将没有关联的轨道。
NSURL* url = [iPodSong valueForProperty:MPMediaItemPropertyAssetURL];
mAssetToLoad = [[AVURLAsset alloc] initWithURL:url options:nil];
bool protectedCon = mAssetToLoad.hasProtectedContent;
bool exportable = true;//mAssetToLoad.exportable; //4.3 only
if(!protectedCon && exportable) {
AVAssetTrack* songTrack = [mAssetToLoad.tracks objectAtIndex:0];
//CRASH tracks is of size 0
发生问题的资产似乎发生了变化,如果我重新启动应用程序并再次加载相同的资产,它将正确加载。
有人见过这个吗?知道我可能做错了什么吗?
I am using the MediaItem api to gather assets from the iPod library. There is a strange bug I am running into after the application has been running for a while. I will run the following code and the AVURLAsset will have no associated tracks.
NSURL* url = [iPodSong valueForProperty:MPMediaItemPropertyAssetURL];
mAssetToLoad = [[AVURLAsset alloc] initWithURL:url options:nil];
bool protectedCon = mAssetToLoad.hasProtectedContent;
bool exportable = true;//mAssetToLoad.exportable; //4.3 only
if(!protectedCon && exportable) {
AVAssetTrack* songTrack = [mAssetToLoad.tracks objectAtIndex:0];
//CRASH tracks is of size 0
The asset where the problem occurs seems to change, and if I restart the app and load same asset again, it loads correctly.
Has anyone seen this before? Any idea what I might be doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信问题是 CMSampleBufferRef 没有被释放。一次从 iPod 库中打开的项目太多。同样的行为也发生在其他设备上,只是在内存更大的设备上花费的时间更长。
I believe the problem is the CMSampleBufferRef weren't being released. So too many items were open from the iPod library at one time. The same behavior did happen on other devices, it just took longer on those with more RAM.