gpt4 book ai didi

iphone - iPhone 3GS iOS 4.0.1 下的 MPMoviePlayerController thumbnailImageAtTime EXC_BAD_ACCESS

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:52:38 25 4
gpt4 key购买 nike

最近几天我在运行 iOS 4.0.1 的 iPhone 3GS 下遇到了一个非常奇怪和具体的问题。

我有一个 UIImagePicker,而用户可以选择图片或视频文件。之后,我从该媒体源生成缩略图。对于图片,它工作正常,但是,对于视频,我总是在调用 thumbnailImageAtTime 方法后得到一个 EXC_BAD_ACCESS

这是我正在使用的代码:


NSURL* contentURL = [NSURL URLWithString:_videoFilePath];
_moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:contentURL];
[_moviePlayerController setShouldAutoplay:NO];
[_moviePlayerController setCurrentPlaybackTime:(NSTimeInterval)1];
[_moviePlayerController setInitialPlaybackTime:(NSTimeInterval)1];
[_moviePlayerController setControlStyle:MPMovieControlStyleNone];
[_moviePlayerController setMovieControlMode:MPMovieControlStyleNone];
videoThumb = [[_moviePlayerController thumbnailImageAtTime:(NSTimeInterval)1 timeOption:MPMovieTimeOptionNearestKeyFrame] retain];
[_moviePlayerController setCurrentPlaybackTime:(NSTimeInterval)-1];
[_moviePlayerController stop];
[_moviePlayerController release];

以上代码通过 NSOperationQueue 在单独的线程上运行。我可以让多个缩略图生成请求排队,但在任何给定时间只能运行一个。该队列配置了一个 maxConcurrentOperationCount 为 1

根据我能够进行的测试,这个问题只发生在 iOS 4.0.1 上。运行 iOS 4.0、4.1、4.2 和 4.2.1 不会重现此类错误。我也不能 @try @catch 这个错误。

有人知道或知道这可能是什么吗?或者要寻找什么?我已经为此苦苦挣扎了好几天。


Date/Time: 2011-02-06 11:14:01 -0200
OS Version: iPhone OS 4.0.1 (8A293)
Report Version: 104

Exception Type: SIGBUS
Exception Codes: BUS_ADRALN at 0x2c
Crashed Thread: 0

Thread 0 Crashed:
0 MediaToolbox 0x0003b6b0 FigMediaValidatorCopyByteStream + 4
1 Celestial 0x00014c35 -[AVFileValidator notificationForFileCheckResult:] + 281
2 Celestial 0x000146fb -[AVFileValidator postNotificationForCallback:] + 35
3 CoreFoundation 0x000277ff -[NSObject(NSObject) performSelector:withObject:] + 23
4 Celestial 0x000094a5 -[AVObjectRegistry safeInvokeWithDescription:] + 125
5 CoreFoundation 0x000277ff -[NSObject(NSObject) performSelector:withObject:] + 23
6 Foundation 0x00090bbd __NSThreadPerformPerform + 269
7 CoreFoundation 0x00071a8d __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 13
8 CoreFoundation 0x0007376f __CFRunLoopDoSources0 + 383
9 CoreFoundation 0x0007450b __CFRunLoopRun + 231
10 CoreFoundation 0x0001d8eb CFRunLoopRunSpecific + 231
11 CoreFoundation 0x0001d7f3 CFRunLoopRunInMode + 59
12 GraphicsServices 0x000036ef GSEventRunModal + 115
13 GraphicsServices 0x0000379b GSEventRun + 63
14 UIKit 0x000062a7 -[UIApplication _run] + 403
15 UIKit 0x00004e17 UIApplicationMain + 671
16 App 0x000035ef 0x1000 + 9711

Thread 1:
0 libSystem.B.dylib 0x0002dc4c kevent + 24
1 libSystem.B.dylib 0x000d689c _dispatch_queue_invoke + 104
2 libSystem.B.dylib 0x000d6a3c _dispatch_worker_thread2 + 128
3 libSystem.B.dylib 0x0007ad89 _pthread_wqthread + 265

Thread 2:
0 libSystem.B.dylib 0x00001658 mach_msg_trap + 20
1 CoreFoundation 0x000722cf __CFRunLoopServiceMachPort + 95
2 CoreFoundation 0x00074589 __CFRunLoopRun + 357
3 CoreFoundation 0x0001d8eb CFRunLoopRunSpecific + 231
4 CoreFoundation 0x0001d7f3 CFRunLoopRunInMode + 59
5 WebCore 0x0000305d RunWebThread(void*) + 369
6 libSystem.B.dylib 0x0007a98d _pthread_start + 249

Thread 3:
0 libSystem.B.dylib 0x00001658 mach_msg_trap + 20
1 CoreFoundation 0x000722cf __CFRunLoopServiceMachPort + 95
2 CoreFoundation 0x00074589 __CFRunLoopRun + 357
3 CoreFoundation 0x0001d8eb CFRunLoopRunSpecific + 231
4 CoreFoundation 0x0001d7f3 CFRunLoopRunInMode + 59
5 Foundation 0x0003b725 +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] + 213
6 Foundation 0x0000bc9d -[NSThread main] + 45
7 Foundation 0x000909e1 __NSThread__main__ + 973
8 libSystem.B.dylib 0x0007a98d _pthread_start + 249

Thread 4:
0 libSystem.B.dylib 0x00025a20 select$DARWIN_EXTSN + 20
1 libSystem.B.dylib 0x0007a98d _pthread_start + 249

Thread 5:
0 libSystem.B.dylib 0x000798dc __semwait_signal + 24
1 libSystem.B.dylib 0x0002e639 pthread_cond_wait + 33
2 CoreMedia 0x00002f1b WaitOnCondition + 11
3 CoreMedia 0x00002e61 FigSemaphoreWaitRelative + 73
4 MediaToolbox 0x00003e4b fpa_AsyncMovieControlThread + 55
5 CoreMedia 0x0001e4c3 figThreadMain + 139
6 libSystem.B.dylib 0x0007a98d _pthread_start + 249

Thread 6:
0 libSystem.B.dylib 0x00001658 mach_msg_trap + 20
1 MediaToolbox 0x00008b0b FigExpressNotificationThread + 43
2 CoreMedia 0x0001e4c3 figThreadMain + 139
3 libSystem.B.dylib 0x0007a98d _pthread_start + 249

Thread 7:
0 libSystem.B.dylib 0x000798dc __semwait_signal + 24
1 libSystem.B.dylib 0x0002e639 pthread_cond_wait + 33
2 CoreMedia 0x00002f1b WaitOnCondition + 11
3 CoreMedia 0x00002e61 FigSemaphoreWaitRelative + 73
4 MediaToolbox 0x00003e4b fpa_AsyncMovieControlThread + 55
5 CoreMedia 0x0001e4c3 figThreadMain + 139
6 libSystem.B.dylib 0x0007a98d _pthread_start + 249

Thread 8:
0 libSystem.B.dylib 0x000016cc semaphore_timedwait_signal_trap + 8
1 libSystem.B.dylib 0x0002ea07 _pthread_cond_wait + 679
2 libSystem.B.dylib 0x0002f5b9 pthread_cond_timedwait_relative_np + 17
3 CoreMedia 0x00002e7f FigSemaphoreWaitRelative + 103
4 MediaToolbox 0x000bfb53 FigMediaValidatorValidateAsyncInternal + 399
5 MediaToolbox 0x00038a0d FigMediaValidatorCreate + 53
6 Celestial 0x00015093 -[AVFileValidator validateBlocking:] + 303
7 Celestial 0x0000beb1 -[AVFileValidator validate] + 17
8 MediaPlayer 0x0006ead3 -[MPMovie _determineMediaType] + 335
9 Foundation 0x00086c8d __NSFireDelayedPerform + 369
10 CoreFoundation 0x00071a5b __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 15
11 CoreFoundation 0x00073ee5 __CFRunLoopDoTimer + 861
12 CoreFoundation 0x00074865 __CFRunLoopRun + 1089
13 CoreFoundation 0x0001d8eb CFRunLoopRunSpecific + 231
14 CoreFoundation 0x0001d7f3 CFRunLoopRunInMode + 59
15 Foundation 0x00004d67 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 203
16 Foundation 0x000863bf -[NSRunLoop(NSRunLoop) runUntilDate:] + 63
17 MediaPlayer 0x0000e927 -[MPMoviePlayerControllerNew thumbnailImageAtTime:timeOption:] + 119
18 CoreFoundation 0x0009f074 __invoking___ + 68
19 CoreFoundation 0x0003270d -[NSInvocation invoke] + 109
20 MediaPlayer 0x0000bd7f -[MPMoviePlayerController forwardInvocation:] + 47
21 CoreFoundation 0x0009ef59 ___forwarding___ + 577
22 CoreFoundation 0x00031680 _CF_forwarding_prep_0 + 48
23 App 0x0004f94f 0x1000 + 321871
24 Foundation 0x0000dd1b -[__NSOperationInternal start] + 659
25 Foundation 0x0000da7f -[NSOperation start] + 23
26 Foundation 0x0007e5bb ____startOperations_block_invoke_2 + 47
27 libSystem.B.dylib 0x000d5c5c _dispatch_call_block_and_release + 20
28 libSystem.B.dylib 0x000d6a3c _dispatch_worker_thread2 + 128
29 libSystem.B.dylib 0x0007ad89 _pthread_wqthread + 265

Thread 9:
0 libSystem.B.dylib 0x0007b85c __workq_kernreturn + 8

Thread 0 crashed with ARM (Native) Thread State:
r0: 0x00000000 r1: 0x064386ec r2: 0x06436fa0 r3: 0x00000004
r4: 0x30c178e0 r5: 0x00000000 r6: 0x332d1074 r7: 0x2fffeb20
r8: 0x06434e40 r9: 0x2fffeafc r10: 0x00000000 r11: 0x3e1e1ae0
r12: 0x3e1da394 sp: 0x2fffeb1c lr: 0x30ba0c35 pc: 0x307a86b0

------ 编辑

在另一次执行中,出现了一个不同的堆栈:


Thread 0 Crashed:
0 libobjc.A.dylib 0x0000286c objc_msgSend + 16
1 Celestial 0x0001b025 -[AVPlaybackItem release] + 73
2 Celestial 0x00005d71 -[AVPlaybackQueue queueItemWasAddedNotification:] + 473
3 Foundation 0x00018fb7 _nsnote_callback + 143
4 CoreFoundation 0x00069e73 __CFXNotificationPost_old + 403
5 CoreFoundation 0x0001a37b _CFXNotificationPostNotification + 119
6 Foundation 0x000040c3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 71
7 Celestial 0x00005b67 -[AVQueue itemWasAdded:atIndex:] + 127
8 Celestial 0x00005a01 -[AVQueue insertItem:atIndex:error:] + 157
9 Celestial 0x0000594f -[AVQueue appendItem:error:] + 47
10 Celestial 0x000051bb -[AVController addNextFeederItemToQueue] + 199
11 Celestial 0x000050d7 -[AVController checkQueueSpace] + 111
12 Celestial 0x000024d1 -[AVController setQueue:] + 101
13 Celestial 0x00004cb1 -[AVController setQueueFeeder:withIndex:] + 301
14 MediaPlayer 0x0001f999 -[MPAVController _setAVControllerQueueFeeder:startQueueIndex:] + 97
15 MediaPlayer 0x0001e53d -[MPAVController reloadFeederWithStartQueueIndex:] + 121
16 MediaPlayer 0x0000c511 -[MPMoviePlayerControllerNew _prepareToPlayWithStartIndex:] + 325
17 MediaPlayer 0x0000acad -[MPMoviePlayerControllerNew prepareToPlay] + 29
18 MediaPlayer 0x00009617 -[MPMoviePlayerControllerNew _movieSourceTypeAvailableNotification:] + 191
19 Foundation 0x00018fb7 _nsnote_callback + 143
20 CoreFoundation 0x00069e73 __CFXNotificationPost_old + 403
21 CoreFoundation 0x0001a37b _CFXNotificationPostNotification + 119
22 Foundation 0x000040c3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 71
23 Foundation 0x0000c459 -[NSNotificationCenter postNotificationName:object:] + 25
24 MediaPlayer 0x0006e0a5 -[MPMovie _fileValidationDidFinishNotification:] + 193
25 Foundation 0x00018fb7 _nsnote_callback + 143
26 CoreFoundation 0x00069e73 __CFXNotificationPost_old + 403
27 CoreFoundation 0x0001a37b _CFXNotificationPostNotification + 119
28 Foundation 0x0000ba8f -[NSNotificationCenter postNotification:] + 139
29 Celestial 0x00014719 -[AVFileValidator postNotificationForCallback:] + 65
30 CoreFoundation 0x000277ff -[NSObject(NSObject) performSelector:withObject:] + 23
31 Celestial 0x000094a5 -[AVObjectRegistry safeInvokeWithDescription:] + 125
32 CoreFoundation 0x000277ff -[NSObject(NSObject) performSelector:withObject:] + 23
33 Foundation 0x00090bbd __NSThreadPerformPerform + 269
34 CoreFoundation 0x00071a8d __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 13
35 CoreFoundation 0x0007376f __CFRunLoopDoSources0 + 383
36 CoreFoundation 0x0007450b __CFRunLoopRun + 231
37 CoreFoundation 0x0001d8eb CFRunLoopRunSpecific + 231
38 CoreFoundation 0x0001d7f3 CFRunLoopRunInMode + 59
39 GraphicsServices 0x000036ef GSEventRunModal + 115
40 GraphicsServices 0x0000379b GSEventRun + 63
41 UIKit 0x000062a7 -[UIApplication _run] + 403
42 UIKit 0x00004e17 UIApplicationMain + 671
43 App 0x000031c3 0x1000 + 8643

最佳答案

实际上,这种生成视频缩略图的代码应该在主线程上执行。

这与 iOS 4.0.1 无关。

即使在 NSOperation 下,您也可以通过 performSelectorOnMainThread 执行缩略图生成,应该没问题。

关于iphone - iPhone 3GS iOS 4.0.1 下的 MPMoviePlayerController thumbnailImageAtTime EXC_BAD_ACCESS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4913582/

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