使用 MPMoviePlayerViewController iOS 4.2 时,AudioToolbox 导致 iPhone 内存泄漏
我使用以下代码(在选项卡栏应用程序的视图控制器内)在用户选择表行后播放从主包加载的视频。
- (void)loadMoviePlayer:(NSString*)moviePath
{
NSURL* fileURL = [[NSURL alloc] initFileURLWithPath:moviePath];
MPMoviePlayerViewController* player = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
[fileURL release];
[self presentMoviePlayerViewControllerAnimated:player];
[player release];
}
该应用程序在模拟器中构建和运行时没有任何明显问题(我尚未在设备上进行测试),但当我通过 Instruments 运行它时,视频播放期间会发生内存泄漏。 Instruments 将 AudioToolbox 突出显示为“负责任的库”,并且 SimAggregateDevice::SimAggregateDevice(_CFString const*, _CFString const*, long&)
并
APComponent::CreateDispatchTable(AudioComponentPluginInterface*, unsigned long)
作为“责任框架”。
如果您能对此有所了解,我们将不胜感激! 谢谢。
I'm using the following code (inside a view controller in a tab bar application) to play video loaded from the main bundle after a user selects a table row.
- (void)loadMoviePlayer:(NSString*)moviePath
{
NSURL* fileURL = [[NSURL alloc] initFileURLWithPath:moviePath];
MPMoviePlayerViewController* player = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
[fileURL release];
[self presentMoviePlayerViewControllerAnimated:player];
[player release];
}
The app builds and runs without any obvious problems in the simulator (I haven't tested on a device yet) but when I run it through Instruments a memory leak occurs during video playback.
Instruments highlights the AudioToolbox as the 'Responsible Library' and SimAggregateDevice::SimAggregateDevice(_CFString const*, _CFString const*, long&)
and
APComponent::CreateDispatchTable(AudioComponentPluginInterface*, unsigned long)
as the 'Responsible Frame(s)'.
Any light you can shed on this would be much appreciated!
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您还可以为 iPhone 和 iPad 的电影播放器创建自己的自定义控件,您可以在其中创建自定义音量管理,并且可以管理很多事情。
以下方法启动电影播放器。用于管理 mov
You can create you own custom control for the movie player for iPhone and iPad also, where you can create custom volume management and so many things can manage.
Following method to start moview player. for manage the mov
我将 Alex 的评论设置为可接受的答案。 K
I'm setting this comment by Alex as the accepted answer. K