Simplify recieve frame logic.

This commit is contained in:
Ziemas 2021-04-13 02:07:45 +02:00 committed by seedhartha
parent 8b6c5d138f
commit 6e0cf0e802

View file

@ -246,21 +246,12 @@ private:
}
if (packet.stream_index != _videoStreamIdx) continue;
bool gotFrame = false;
int retVal = avcodec_receive_frame(_videoCodecCtx, _frame);
if (retVal == 0) {
gotFrame = true;
}
if (retVal == AVERROR(EAGAIN)) {
retVal = 0;
}
if (retVal == 0) {
if (retVal == 0 || retVal == AVERROR(EAGAIN)) {
avcodec_send_packet(_videoCodecCtx, &packet);
if (retVal == AVERROR(EAGAIN)) continue;
}
if (gotFrame == false) continue;
--count;
if (ignore) continue;