2015-11-26 21 views
7

Ho un'app, in cui sto decodificando i fotogrammi video provenienti dalla telecamera IP, ma il metodo avcodec_decode_video2(m_pCodecCtx, m_pFrame, &consumed_bytes, &avpkt); presente in avcodec.h genera bad_access, non riesco a capire cosa c'è di sbagliato.Errore durante la decodifica del fotogramma video della videocamera con FFMpeg iOS

Questa app funzionava bene con le vecchie librerie FFMpeg, ma secondo la politica Apple, per pubblicare app supporta arm64, quindi ho aggiornato le mie librerie per supportare arm64 e dopo che si è verificato questo problema.

Ecco lo screenshot

enter image description here

Mentre bad_access applicazione sta generando il seguente registro:

[h264 @ 0x1071400] sps_id 12 out of range 
[h264 @ 0x1071400] pps_id 417 out of range 
[h264 @ 0x1071400] sps_id 3 out of range 
[h264 @ 0x1071400] sps_id 32 out of range 
[h264 @ 0x1071400] sps_id 6 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 32 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 3 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 32 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 2 out of range 
[h264 @ 0x1071400] sps_id 2 out of range 
[h264 @ 0x1071400] sps_id 2 out of range 
[h264 @ 0x1071400] sps_id 2 out of range 
[h264 @ 0x1071400] sps_id 2 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 32 out of range 
[h264 @ 0x1071400] sps_id 3 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] sps_id 2 out of range 
[h264 @ 0x1071400] sps_id 2 out of range 
[h264 @ 0x1071400] sps_id 2 out of range 
[h264 @ 0x1071400] sps_id 2 out of range 
[h264 @ 0x1071400] sps_id 2 out of range 
[h264 @ 0x1071400] pps_id 418 out of range 
[h264 @ 0x1071400] Partitioned H.264 support is incomplete 
[h264 @ 0x1071400] sps_id 6 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 1 out of range 
[h264 @ 0x1071400] non-existing PPS 3 referenced 
[h264 @ 0x1071400] decode_slice_header error 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] slice type 10 too large at 0 0 
[h264 @ 0x1071400] decode_slice_header error 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] non-existing PPS 2 referenced 
[h264 @ 0x1071400] decode_slice_header error 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] slice type 29 too large at 0 0 
[h264 @ 0x1071400] decode_slice_header error 
[h264 @ 0x1071400] sps_id 2 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] sps_id 0 out of range 
[h264 @ 0x1071400] slice type 32 too large at 0 0 
[h264 @ 0x1071400] decode_slice_header error 
[h264 @ 0x1071400] slice type 32 too large at 0 0 
[h264 @ 0x1071400] decode_slice_header error 
[h264 @ 0x1071400] slice type 32 too large at 0 0 
[h264 @ 0x1071400] decode_slice_header error 
[h264 @ 0x1071400] slice type 32 too large at 0 0 

Completa log degli errori:https://drive.google.com/file/d/0B-Nh7ci6wLX0OVlxaXV4aGpJems/view?usp=sharing

registro dei crash:http://crashes.to/s/6765d63b540

Nota: Se avete bisogno di qualsiasi altra cosa, si prega di commento.

+0

Lo screenshot non sembra corrispondere al registro degli arresti anomali. Il registro degli arresti anomali si presenta come un problema di dereferenziazione NULL. Inoltre sarebbe utile conoscere i valori dei parametri. – trojanfoe

+0

quali parametri si desidera vedere. dimmi solo di cosa hai bisogno –

+0

I parametri passati a questo metodo – trojanfoe

risposta

3

Ho risolto il problema, il problema era con il metodo ammortizzato avcodec_alloc_frame().

stavo usando il seguente codice nel costruttore

m_pCodecCtx = avcodec_alloc_context3(m_pCodec); 
    if(m_pCodecCtx == NULL) 
    { 
     NSLog(@"if(pCodecCtx == NULL)\n"); 
     return ; 
    } 
    [g_Lock lock]; 
    //¥Úø™codec°£»Áπ˚¥Úø™≥…𶵃ª∞£¨∑÷≈‰AVFrame£  
    if(avcodec_open2(m_pCodecCtx, m_pCodec, NULL) >= 0)  
    {  
     m_pFrame = avcodec_alloc_frame(); /* Allocate video frame */ 

    } 
    [g_Lock unlock]; 

Poi alla fine ho aggiornato il mio file header, in seguito mi sono avvertimenti circa deprezzamento del metodo avcodec_alloc_frame() così, ho aggiornato a av_frame_alloc() e ha funzionato senza problemi!