Потоковое аудио в фоновом режиме приложения - PullRequest
1 голос
/ 18 февраля 2011

Я использую проект AudioStreamer от DigitalDj (https://github.com/DigitalDJ/AudioStreamer) для потоковой передачи аудио в фоновом режиме в моем приложении. Все отлично работает, когда приложение находится на переднем плане, но иногда оно падает на заднем плане. Вот очень странный журнал аварий.

     Incident Identifier: F6F6B97C-1943-460D-8A4E-5608B47E6989
CrashReporter Key:   3a88f20a9e18f468445bddc212b7aa673c6dc89b
Hardware Model:      iPod4,1
Process:         iMixtapes [1075]
Path:            /var/mobile/Applications/7C64D2D8-0C63-4A73-8452-763209481693/iMixtapes.app/iMixtapes
Identifier:      iMixtapes
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2011-02-18 13:24:15.849 +0530
OS Version:      iPhone OS 4.2.1 (8C148)
Report Version:  104

Exception Type:  00000020
Exception Codes: 0x8badf00d
Highlighted Thread:  6

Application Specific Information:
iMixtapes[1075] has active assertions beyond permitted time: 
{(
    <SBProcessAssertion: 0x66ce420> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66f2970> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66c60b0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66b4970> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66c7850> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66e55a0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66c5e40> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66b47d0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66eaba0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66ebfe0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66f1da0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66afb90> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66b18b0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x275940> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66b1820> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x2c88a0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66b7b70> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66b7700> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66c6230> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66793a0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66ad010> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66c7820> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66b7d20> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66b7180> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66f2530> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66f2720> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66b72a0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66f21e0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66f2650> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66b73c0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66b7830> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x6691270> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66c6010> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66b1ac0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x2733f0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep ,
    <SBProcessAssertion: 0x66e74e0> identifier: UIKitBackgroundCompletionTask process: iMixtapes[1075] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1075 preventSuspend  preventIdleSleep 
)}

Elapsed total CPU time (seconds): 86.390 (user 41.340, system 45.050), 14% CPU 
Elapsed application CPU time (seconds): 6.290, 1% CPU

Thread 0:
0   libSystem.B.dylib               0x31093268 mach_msg_trap + 20
1   libSystem.B.dylib               0x31095354 mach_msg + 44
2   CoreFoundation                  0x30416648 __CFRunLoopServiceMachPort + 88
3   CoreFoundation                  0x30415ed2 __CFRunLoopRun + 350
4   CoreFoundation                  0x30415c80 CFRunLoopRunSpecific + 224
5   CoreFoundation                  0x30415b88 CFRunLoopRunInMode + 52
6   GraphicsServices                0x31eec4a4 GSEventRunModal + 108
7   GraphicsServices                0x31eec550 GSEventRun + 56
8   UIKit                           0x313cf322 -[UIApplication _run] + 406
9   UIKit                           0x313cce8c UIApplicationMain + 664
10  iMixtapes                       0x00002348 main (main.m:14)
11  iMixtapes                       0x000022fc start + 32

Thread 1:
0   libSystem.B.dylib               0x310bf974 kevent + 24
1   libSystem.B.dylib               0x31169704 _dispatch_mgr_invoke + 88
2   libSystem.B.dylib               0x31169174 _dispatch_queue_invoke + 96
3   libSystem.B.dylib               0x31168b98 _dispatch_worker_thread2 + 120
4   libSystem.B.dylib               0x3110d24a _pthread_wqthread + 258
5   libSystem.B.dylib               0x31105970 start_wqthread + 0

Thread 2:
0   libSystem.B.dylib               0x31093268 mach_msg_trap + 20
1   libSystem.B.dylib               0x31095354 mach_msg + 44
2   CoreFoundation                  0x30416648 __CFRunLoopServiceMachPort + 88
3   CoreFoundation                  0x30415ed2 __CFRunLoopRun + 350
4   CoreFoundation                  0x30415c80 CFRunLoopRunSpecific + 224
5   CoreFoundation                  0x30415b88 CFRunLoopRunInMode + 52
6   WebCore                         0x35b32124 RunWebThread(void*) + 332
7   libSystem.B.dylib               0x3110c886 _pthread_start + 242
8   libSystem.B.dylib               0x31101a88 thread_start + 0

Thread 3:
0   libSystem.B.dylib               0x31093268 mach_msg_trap + 20
1   libSystem.B.dylib               0x31095354 mach_msg + 44
2   CoreFoundation                  0x30416648 __CFRunLoopServiceMachPort + 88
3   CoreFoundation                  0x30415ed2 __CFRunLoopRun + 350
4   CoreFoundation                  0x30415c80 CFRunLoopRunSpecific + 224
5   CoreFoundation                  0x30415b88 CFRunLoopRunInMode + 52
6   Foundation                      0x302fb5f6 +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] + 206
7   Foundation                      0x302d9192 -[NSThread main] + 38
8   Foundation                      0x302d2242 __NSThread__main__ + 966
9   libSystem.B.dylib               0x3110c886 _pthread_start + 242
10  libSystem.B.dylib               0x31101a88 thread_start + 0

Thread 4:
0   libSystem.B.dylib               0x3110b9f0 __semwait_signal + 24
1   libSystem.B.dylib               0x310c07ec _pthread_cond_wait + 748
2   libSystem.B.dylib               0x310c03d2 pthread_cond_wait + 26
3   CoreMedia                       0x3290cb14 WaitOnCondition + 4
4   CoreMedia                       0x3290ca5a FigSemaphoreWaitRelative + 66
5   MediaToolbox                    0x32a8bc9c fpa_AsyncMovieControlThread + 48
6   CoreMedia                       0x32928f76 figThreadMain + 166
7   libSystem.B.dylib               0x3110c886 _pthread_start + 242
8   libSystem.B.dylib               0x31101a88 thread_start + 0

Thread 5:
0   libSystem.B.dylib               0x310b768c select$DARWIN_EXTSN + 20
1   CoreFoundation                  0x3044d662 __CFSocketManager + 582
2   libSystem.B.dylib               0x3110c886 _pthread_start + 242
3   libSystem.B.dylib               0x31101a88 thread_start + 0

Thread 6:
0   libSystem.B.dylib               0x3110b9f0 __semwait_signal + 24
1   libSystem.B.dylib               0x310c07ec _pthread_cond_wait + 748
2   libSystem.B.dylib               0x310c03d2 pthread_cond_wait + 26
3   iMixtapes                       0x000946d8 -[AudioStreamer enqueueBuffer] (AudioStreamer.m:1885)
4   iMixtapes                       0x00095514 -[AudioStreamer handleAudioPackets:numberBytes:numberPackets:packetDescriptions:] (AudioStreamer.m:2196)
5   iMixtapes                       0x0008f4ce MyPacketsProc (AudioStreamer.m:151)
6   AudioToolbox                    0x3281e376 AudioFileStreamWrapper::CallPacketsProc(unsigned long, unsigned long, void const*, AudioStreamPacketDescription*, bool) + 122
7   AudioToolbox                    0x3283a87a MP3AudioStream::GeneratePackets(AudioFileStreamContinuation&) + 818
8   AudioToolbox                    0x3281e5e4 AudioFileStreamWrapper::ParseBytes(unsigned long, void const*, unsigned long) + 180
9   AudioToolbox                    0x3281de6c AudioFileStreamParseBytes + 132
10  iMixtapes                       0x0009410e -[AudioStreamer handleReadFromStream:eventType:] (AudioStreamer.m:1754)
11  iMixtapes                       0x0008f58e ASReadStreamCallBack (AudioStreamer.m:222)
12  CoreFoundation                  0x3044ef6a _signalEventSync + 70
13  CoreFoundation                  0x3044f842 _cfstream_solo_signalEventSync + 58
14  CoreFoundation                  0x3044c7ee _CFStreamSignalEvent + 326
15  CoreFoundation                  0x3044c6a0 CFReadStreamSignalEvent + 4
16  CFNetwork                       0x32fe2a66 HTTPReadStream::streamEvent(unsigned long) + 94
17  CFNetwork                       0x32fe2adc HTTPReadStream::_streamCB(__CFReadStream*, unsigned long, void*) + 24
18  CoreFoundation                  0x3044ef6a _signalEventSync + 70
19  CoreFoundation                  0x3044eefe _cfstream_shared_signalEventSync + 198
20  CoreFoundation                  0x304447d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
21  CoreFoundation                  0x304165b0 __CFRunLoopDoSources0 + 376
22  CoreFoundation                  0x30415e54 __CFRunLoopRun + 224
23  CoreFoundation                  0x30415c80 CFRunLoopRunSpecific + 224
24  CoreFoundation                  0x30415b88 CFRunLoopRunInMode + 52
25  Foundation                      0x302d28e4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 196
26  iMixtapes                       0x00091000 -[AudioStreamer startInternal] (AudioStreamer.m:843)
27  Foundation                      0x302d9192 -[NSThread main] + 38
28  Foundation                      0x302d2242 __NSThread__main__ + 966
29  libSystem.B.dylib               0x3110c886 _pthread_start + 242
30  libSystem.B.dylib               0x31101a88 thread_start + 0

Thread 7:
0   libSystem.B.dylib               0x31093268 mach_msg_trap + 20
1   libSystem.B.dylib               0x31095354 mach_msg + 44
2   CoreFoundation                  0x30416648 __CFRunLoopServiceMachPort + 88
3   CoreFoundation                  0x30415ed2 __CFRunLoopRun + 350
4   CoreFoundation                  0x30415c80 CFRunLoopRunSpecific + 224
5   CoreFoundation                  0x30415b88 CFRunLoopRunInMode + 52
6   AudioToolbox                    0x327a84ba GenericRunLoopThread::RunLoop() + 30
7   AudioToolbox                    0x327bb306 TRunLoop<AQClient>::Entry(void*) + 90
8   AudioToolbox                    0x327a81d2 CAPThread::Entry(CAPThread*) + 138
9   libSystem.B.dylib               0x3110c886 _pthread_start + 242
10  libSystem.B.dylib               0x31101a88 thread_start + 0

Unknown thread crashed with unknown flavor: 5, state_count: 1

Может кто-нибудь, пожалуйста, помогите мне решить эту проблему.

Спасибо

Ответы [ 2 ]

1 голос
/ 18 февраля 2011

ваше приложение закрывается, а вторичный поток продолжает работать.вы должны очистить и завершить работу по требованию.

примечание: вы можете символизировать ваши сбои, чтобы легче было оценить вызов стека.

0 голосов
/ 03 сентября 2013

Когда вы создаете фоновое задание для воспроизведения звука, если вы используете

- beginBackgroundTaskWithExpirationHandler:

убедитесь, что вы закодировали код для завершения задачи, когда вы получили недопустимое уведомление от ОС.

Если вы не справитесь с этим, это вызовет сбой, о котором вы упоминали выше.

...