diff options
author | Philip Langdale <philipl@overt.org> | 2011-04-13 22:00:18 -0700 |
---|---|---|
committer | Philip Langdale <philipl@overt.org> | 2011-04-16 08:10:44 -0700 |
commit | bd9430db691d519cf0ed3922007faa7c68a7c223 (patch) | |
tree | 3c9ea905a1ff3720a168dbc80f2e1fafc6523d62 | |
parent | 09a1416db78f49fb3a39cdf5a4bd0f5c5f849ce0 (diff) | |
download | ffmpeg-bd9430db691d519cf0ed3922007faa7c68a7c223.tar.gz |
CrystalHD: Fix usage of h264 parser.
I was using the wrong value to track the position of the parser in the
stream. For an error-free stream, the size of the frame and number of
bytes consumed will be the same, but in an error situation they can
diverge.
Signed-off-by: Philip Langdale <philipl@overt.org>
-rw-r--r-- | libavcodec/crystalhd.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index b6e67cb399..9bbb6e8bba 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -796,13 +796,19 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a if (priv->parser) { uint8_t *pout; - int psize = len; + int psize; + const uint8_t *in_data = avpkt->data; + int in_len = len; H264Context *h = priv->parser->priv_data; - while (psize) - ret = av_parser_parse2(priv->parser, avctx, &pout, &psize, - avpkt->data, len, avctx->pkt->pts, - avctx->pkt->dts, len - psize); + while (in_len) { + int index; + index = av_parser_parse2(priv->parser, avctx, &pout, &psize, + in_data, in_len, avctx->pkt->pts, + avctx->pkt->dts, 0); + in_data += index; + in_len -= index; + } av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: parser picture type %d\n", h->s.picture_structure); |