diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-02-14 04:47:06 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-02-14 04:51:17 +0400 |
commit | abb6821e43e74bfce1565c4a6ed75cfb666a2e6d (patch) | |
tree | b00a4cb982289f9047dd452bfeacb2c2bdb40abb /libavformat/jvdec.c | |
parent | 84873794ad922cbcbdb5f62deda6c1ed16668bcc (diff) | |
parent | 8a2250344b19a343d830a902dbcf4c0b929ea49b (diff) |
Merge commit '8a2250344b19a343d830a902dbcf4c0b929ea49b'
* commit '8a2250344b19a343d830a902dbcf4c0b929ea49b':
jv: detect partial packets in the demuxer
Conflicts:
libavformat/jvdec.c
See: 9d0c71e5e34dec2c6246bf47da8d9674c92f85c1
See: b948ab8132e24d215072120e210139dc456d4997
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/jvdec.c')
-rw-r--r-- | libavformat/jvdec.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c index e8d44b0fd8..eab450d862 100644 --- a/libavformat/jvdec.c +++ b/libavformat/jvdec.c @@ -184,17 +184,22 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) case JV_VIDEO: jv->state++; if (jvf->video_size || jvf->palette_size) { + int ret; int size = jvf->video_size + jvf->palette_size; if (av_new_packet(pkt, size + JV_PREAMBLE_SIZE)) return AVERROR(ENOMEM); AV_WL32(pkt->data, jvf->video_size); - pkt->data[4] = jvf->video_type; - if ((size = avio_read(pb, pkt->data + JV_PREAMBLE_SIZE, size)) < 0) - return AVERROR(EIO); - memset(pkt->data + JV_PREAMBLE_SIZE + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - - pkt->size = size + JV_PREAMBLE_SIZE; + pkt->data[4] = jvf->video_type; + ret = avio_read(pb, pkt->data + JV_PREAMBLE_SIZE, size); + if (ret < 0) + return ret; + if (ret < size) { + memset(pkt->data + JV_PREAMBLE_SIZE + ret, 0, + FF_INPUT_BUFFER_PADDING_SIZE); + pkt->flags |= AV_PKT_FLAG_CORRUPT; + } + pkt->size = ret + JV_PREAMBLE_SIZE; pkt->stream_index = 1; pkt->pts = jv->pts; if (jvf->video_type != 1) |