diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-11-01 14:03:04 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-11-02 07:58:37 +0100 |
commit | 179a5c37e070f619f14289bdc0fa66a08219eed9 (patch) | |
tree | 2713046a1df6cefc885e1411a79f8a508c784b84 /libavformat/rtpdec_vp8.c | |
parent | f70381ab9d53132be2d009d6db9649b3cad8288b (diff) | |
download | ffmpeg-179a5c37e070f619f14289bdc0fa66a08219eed9.tar.gz |
rtpdec: factorize identical code used in several handlers
Diffstat (limited to 'libavformat/rtpdec_vp8.c')
-rw-r--r-- | libavformat/rtpdec_vp8.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/libavformat/rtpdec_vp8.c b/libavformat/rtpdec_vp8.c index a52be4b644..541a1bcd96 100644 --- a/libavformat/rtpdec_vp8.c +++ b/libavformat/rtpdec_vp8.c @@ -36,15 +36,6 @@ struct PayloadContext { uint32_t timestamp; }; -static void prepare_packet(AVPacket *pkt, PayloadContext *vp8, int stream) -{ - av_init_packet(pkt); - pkt->stream_index = stream; - pkt->size = avio_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, @@ -133,7 +124,9 @@ static int vp8_handle_packet(AVFormatContext *ctx, avio_write(vp8->data, buf, len); if (end_packet) { - prepare_packet(pkt, vp8, st->index); + int ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index); + if (ret < 0) + return ret; return 0; } |