Commit a6b79bb2 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '9fc7184d'

* commit '9fc7184d':
  bfi: Avoid divisions by zero

See: 99a8552dMerged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 7057cc86 9fc7184d
...@@ -144,9 +144,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) ...@@ -144,9 +144,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
pkt->pts = bfi->audio_frame; pkt->pts = bfi->audio_frame;
bfi->audio_frame += ret; bfi->audio_frame += ret;
} } else if (bfi->video_size > 0) {
else {
//Tossing a video packet at the video decoder. //Tossing a video packet at the video decoder.
ret = av_get_packet(pb, pkt, bfi->video_size); ret = av_get_packet(pb, pkt, bfi->video_size);
...@@ -154,10 +152,13 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) ...@@ -154,10 +152,13 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
return ret; return ret;
pkt->pts = bfi->video_frame; 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. */ /* One less frame to read. A cursory decrement. */
bfi->nframes--; bfi->nframes--;
} else {
/* Empty video packet */
ret = AVERROR(EAGAIN);
} }
bfi->avflag = !bfi->avflag; bfi->avflag = !bfi->avflag;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment