mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 19:20:28 +08:00
videoio(ffmpeg): fix handling of AVERROR_EOF
decoder should be properly flushed after that
This commit is contained in:
parent
c6b60e219d
commit
f1dd5e49c5
@ -1215,9 +1215,20 @@ bool CvCapture_FFMPEG::grabFrame()
|
||||
#endif
|
||||
|
||||
int ret = av_read_frame(ic, &packet);
|
||||
if (ret == AVERROR(EAGAIN)) continue;
|
||||
|
||||
/* else if (ret < 0) break; */
|
||||
if (ret == AVERROR(EAGAIN))
|
||||
continue;
|
||||
|
||||
if (ret == AVERROR_EOF)
|
||||
{
|
||||
if (rawMode)
|
||||
break;
|
||||
|
||||
// flush cached frames from video decoder
|
||||
packet.data = NULL;
|
||||
packet.size = 0;
|
||||
packet.stream_index = video_stream;
|
||||
}
|
||||
|
||||
if( packet.stream_index != video_stream )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user