[FFmpeg-soc] vp8 de/packetizers

Martin Storsjö martin at martin.st
Thu Aug 12 16:07:40 CEST 2010


On Wed, 11 Aug 2010, Josh Allmann wrote:

> > The packetizer looks ok to me. Perhaps still adding a warning message at
> > startup that the spec isn't finalized yet and may still change, as Luca A
> > pointed out?
> >
> 
> Done. The best place to print this was in sdp.c. Also added a similar
> note when initializing the depacketizer.

The packetizer looks good to me now, do you agree, Luca A?

> I think I addressed this in a sensible way. I haven't actually tested
> this behavior, though.

It looks quite good to me. One minor nit:

> +static void prepare_packet(AVPacket *pkt, PayloadContext *vp8, int stream)
> +{
> +    av_init_packet(pkt);
> +    pkt->stream_index = stream;
> +    pkt->flags        = vp8->is_keyframe ? AV_PKT_FLAG_KEY : 0;
> +    pkt->size         = url_close_dyn_buf(vp8->data, &pkt->data);
> +    pkt->destruct     = av_destruct_packet;
> +    vp8->data         = NULL;
> +}
> +
> +static int vp8_handle_packet(AVFormatContext *ctx,
> +                             PayloadContext *vp8,
> +                             AVStream *st,
> +                             AVPacket *pkt,
> +                             uint32_t *timestamp,
> +                             const uint8_t *buf,
> +                             int len, int flags)
> +{
> +    int start_packet, end_packet, has_au, ret = AVERROR(EAGAIN);
> +
> +    if (!buf) {
> +        // only called when vp8_handle_packet returns 1
> +        prepare_packet(pkt, vp8, st->index);
> +        *timestamp = vp8->timestamp;
> +        return 0;
> +    }

You need to check vp8->data here, too, otherwise you'd segfault if the
caller called us erroneously.


Except for that, it looks quite ok. I haven't tested the new parts yet, 
I'll see if I can get it tested tomorrow.

// Martin


More information about the FFmpeg-soc mailing list