Message ID | 1380406879-6174-10-git-send-email-martin@martin.st |
---|---|
State | Committed |
Commit | 9fc7184d1a9af8d97b3fc5c2ef9d0a647d6617ea |
Headers | show |
On Sun, Sep 29, 2013 at 01:21:12AM +0300, Martin Storsjö wrote: > If a zero-length video packet is to be returned, just return > AVERROR(EAGAIN) and switch back to the audio stream. > > Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind > CC: libav-stable@libav.org > --- > libavformat/bfi.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/libavformat/bfi.c b/libavformat/bfi.c > index e60bbf4..5d7ccb8 100644 > --- a/libavformat/bfi.c > +++ b/libavformat/bfi.c > @@ -140,9 +140,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,6 +152,9 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) > > /* One less frame to read. A cursory decrement. */ > bfi->nframes--; > + } else { > + /* Empty video packet */ > + ret = AVERROR(EAGAIN); > } > > bfi->avflag = !bfi->avflag; > -- might be OK
diff --git a/libavformat/bfi.c b/libavformat/bfi.c index e60bbf4..5d7ccb8 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -140,9 +140,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,6 +152,9 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) /* One less frame to read. A cursory decrement. */ bfi->nframes--; + } else { + /* Empty video packet */ + ret = AVERROR(EAGAIN); } bfi->avflag = !bfi->avflag;