diff --git a/src/Extension/H264.cpp b/src/Extension/H264.cpp index df113924..fd2d3b91 100644 --- a/src/Extension/H264.cpp +++ b/src/Extension/H264.cpp @@ -148,7 +148,7 @@ bool H264Track::ready() { bool H264Track::inputFrame(const Frame::Ptr &frame) { using H264FrameInternal = FrameInternal; int type = H264_TYPE(frame->data()[frame->prefixSize()]); - if (type == H264Frame::NAL_B_P || type == H264Frame::NAL_IDR) { + if ((type == H264Frame::NAL_B_P || type == H264Frame::NAL_IDR) && ready()) { return inputFrame_l(frame); } diff --git a/src/Extension/H265.cpp b/src/Extension/H265.cpp index 8586c2cc..8877371d 100644 --- a/src/Extension/H265.cpp +++ b/src/Extension/H265.cpp @@ -94,7 +94,7 @@ bool H265Track::ready() { bool H265Track::inputFrame(const Frame::Ptr &frame) { int type = H265_TYPE(frame->data()[frame->prefixSize()]); - if (!frame->configFrame() && type != H265Frame::NAL_SEI_PREFIX) { + if (!frame->configFrame() && type != H265Frame::NAL_SEI_PREFIX && ready()) { return inputFrame_l(frame); } bool ret = false;