diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-09-29 23:59:16 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-30 00:12:33 +0200 |
commit | a6b79bb2b12ba5f7370ee5fbbdddfe86f1eeb12b (patch) | |
tree | 777272ac3d352973f4b38cdc0ec83cc9dc7333ec | |
parent | 7057cc861d108b2a2e776303949feb5337e24a08 (diff) | |
parent | 9fc7184d1a9af8d97b3fc5c2ef9d0a647d6617ea (diff) | |
download | ffmpeg-a6b79bb2b12ba5f7370ee5fbbdddfe86f1eeb12b.tar.gz |
Merge commit '9fc7184d1a9af8d97b3fc5c2ef9d0a647d6617ea'
* commit '9fc7184d1a9af8d97b3fc5c2ef9d0a647d6617ea':
bfi: Avoid divisions by zero
See: 99a8552dae54fd464f19a00d9e5b92596c5c058a
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/bfi.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavformat/bfi.c b/libavformat/bfi.c index 7a4f436bf3..6f4d8cd8cd 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -144,9 +144,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) pkt->pts = bfi->audio_frame; bfi->audio_frame += ret; - } - - else { + } else if (bfi->video_size > 0) { //Tossing a video packet at the video decoder. ret = av_get_packet(pb, pkt, bfi->video_size); @@ -154,10 +152,13 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) return ret; pkt->pts = bfi->video_frame; - bfi->video_frame += bfi->video_size ? ret / bfi->video_size : 1; + bfi->video_frame += ret / bfi->video_size; /* One less frame to read. A cursory decrement. */ bfi->nframes--; + } else { + /* Empty video packet */ + ret = AVERROR(EAGAIN); } bfi->avflag = !bfi->avflag; |