Message ID | db7f8bd7db04c7af45b7aef3f3ba8c8609f82fd0.1570398124.git.barsnick@gmx.net |
---|---|
State | New |
Headers | show |
lgtm On 10/7/19, Moritz Barsnick <barsnick@gmx.net> wrote: > 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> > --- > libavformat/mpjpegdec.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c > index 24bf232db2..c79a39c69d 100644 > --- a/libavformat/mpjpegdec.c > +++ b/libavformat/mpjpegdec.c > @@ -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; > > -- > 2.20.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c index 24bf232db2..c79a39c69d 100644 --- a/libavformat/mpjpegdec.c +++ b/libavformat/mpjpegdec.c @@ -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;
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> --- libavformat/mpjpegdec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.20.1