Browse Source

avformat/mpjpegdec: ensure seekback for latest chunk

Not only the first, but each latest chunk must be cached to allow
seekback after finding the mime boundary.

Fixes trac #5023 and #5921.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.3
Moritz Barsnick Michael Niedermayer 6 years ago
parent
commit
f76a899abc
1 changed files with 2 additions and 4 deletions
  1. +2
    -4
      libavformat/mpjpegdec.c

+ 2
- 4
libavformat/mpjpegdec.c View File

@@ -336,10 +336,8 @@ static int mpjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->size = 0;
pkt->pos = avio_tell(s->pb);

/* we may need to return as much as all we've read back to the buffer */
ffio_ensure_seekback(s->pb, read_chunk);

while ((ret = av_append_packet(s->pb, pkt, read_chunk - remaining)) >= 0) {
while ((ret = ffio_ensure_seekback(s->pb, read_chunk - remaining)) >= 0 && /* we may need to return as much as all we've read back to the buffer */
(ret = av_append_packet(s->pb, pkt, read_chunk - remaining)) >= 0) {
/* scan the new data */
char *start;



Loading…
Cancel
Save