X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Flibopenh264dec.c;h=c7aa7fa19ccec252f6fd9ca2b471b9179e90e48b;hb=44085b9951b06df1cab4105dcda004213988d84f;hp=f9b91ce3c05a699cb2180cc6b80287d3b17936a4;hpb=bec3b2041dcc20ab4b06a6b31d09130e1a7166c3;p=ffmpeg diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c index f9b91ce3c05..c7aa7fa19cc 100644 --- a/libavcodec/libopenh264dec.c +++ b/libavcodec/libopenh264dec.c @@ -109,10 +109,18 @@ static int svc_decode_frame(AVCodecContext *avctx, void *data, #endif } else { info.uiInBsTimeStamp = avpkt->pts; +#if OPENH264_VER_AT_LEAST(1, 4) + // Contrary to the name, DecodeFrameNoDelay actually does buffering + // and reordering of frames, and is the recommended decoding entry + // point since 1.4. This is essential for successfully decoding + // B-frames. + state = (*s->decoder)->DecodeFrameNoDelay(s->decoder, avpkt->data, avpkt->size, ptrs, &info); +#else state = (*s->decoder)->DecodeFrame2(s->decoder, avpkt->data, avpkt->size, ptrs, &info); +#endif } if (state != dsErrorFree) { - av_log(avctx, AV_LOG_ERROR, "DecodeFrame2 failed\n"); + av_log(avctx, AV_LOG_ERROR, "DecodeFrame failed\n"); return AVERROR_UNKNOWN; } if (info.iBufferStatus != 1) {