查看所有的函数引用
1)static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, const H2645NAL *nal)

    if (!h->ps.pps_list[sl->pps_id]) {
        av_log(h->avctx, AV_LOG_ERROR,
               "non-existing PPS %u referenced\n",
               sl->pps_id);
        return AVERROR_INVALIDDATA;
    }
2)static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t * const buf, int buf_size)

            if (!p->ps.pps_list[pps_id]) {
                av_log(avctx, AV_LOG_ERROR,
                       "non-existing PPS %u referenced\n", pps_id);
                goto fail;
            }


avcodec_send_packet函数返回-1094995529错误,根据FFmpeg的错误信息,得知为AVERROR_INVALIDDATA,猜测是第一种情况
在调用h264_slice_header_parse函数的时候,出现了错误,无法定位PPS

函数的调用逻辑
static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
    int ff_h264_queue_decode_slice(H264Context *h, const H2645NAL *nal)
        static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, const H2645NAL *nal)

结构体的获取
H264Context* pH264Context = AVCodecContext->priv_data
H264SliceContext *sl = H264Context->slice_ctx + H264Context->nb_slice_ctx_queued;



网上提供了一些方案,暂时没有理解
1)1.确保第一个解码的帧为I帧,确保I帧中有sps和pps信息
2)如果直接从rtsp流中一帧一帧的取,再一帧一帧的转码yuv,对AVpacket,AVframe没有特殊要求,完整就好。
3) 若果现将h264实时流存在共享内存中,再从共享内存中读取一帧的AVpacket,那么AVframe就不要循环清理,最好做成成员变量,否则非关键帧无法解码,会提示如上错误。
解决办法:将AVframe做成成员变量,不能用一次清理一次