[FFmpeg-devel] [PATCH] CrystalHD: Fix usage of h264 parser.
Michael Niedermayer
michaelni at gmx.at
Fri Apr 15 05:09:23 CEST 2011
On Wed, Apr 13, 2011 at 10:19:18PM -0700, Philip Langdale wrote:
> 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 at overt.org>
> ---
> libavcodec/crystalhd.c | 14 +++++++++-----
> 1 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c
> index b6e67cb..dc232fa 100644
> --- a/libavcodec/crystalhd.c
> +++ b/libavcodec/crystalhd.c
> @@ -796,13 +796,17 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a
>
> if (priv->parser) {
> uint8_t *pout;
> - int psize = len;
> + int psize;
> + int consumed = 0;
> 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 (consumed < len) {
> + int offset;
> + offset = av_parser_parse2(priv->parser, avctx, &pout, &psize,
> + avpkt->data, len, avctx->pkt->pts,
> + avctx->pkt->dts, consumed);
> + consumed += offset;
> + }
Theres a code example above the
av_parser_parse2() function in libavcodec/avcodec.h
your code does not seem correct if iam not too tired
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110415/728badaa/attachment.asc>
More information about the ffmpeg-devel
mailing list