iPod 库返回没有曲目的资源

发布于 2024-11-30 19:01:46 字数 599 浏览 1 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

離殇 2024-12-07 19:01:46

我相信问题是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文