diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-11-01 17:03:04 +0400 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-11-02 10:58:37 +0400 |
commit | 179a5c37e070f619f14289bdc0fa66a08219eed9 (patch) | |
tree | 2713046a1df6cefc885e1411a79f8a508c784b84 /libavformat/rtpdec_xiph.c | |
parent | f70381ab9d53132be2d009d6db9649b3cad8288b (diff) |
rtpdec: factorize identical code used in several handlers
Diffstat (limited to 'libavformat/rtpdec_xiph.c')
-rw-r--r-- | libavformat/rtpdec_xiph.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c index 38f12bbc39..40415d8f2f 100644 --- a/libavformat/rtpdec_xiph.c +++ b/libavformat/rtpdec_xiph.c @@ -202,20 +202,13 @@ static int xiph_handle_packet(AVFormatContext * ctx, if (fragmented == 3) { // end of xiph data packet - av_init_packet(pkt); - pkt->size = avio_close_dyn_buf(data->fragment, &pkt->data); - - if (pkt->size < 0) { + int ret = ff_rtp_finalize_packet(pkt, &data->fragment, st->index); + if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Error occurred when getting fragment buffer."); - return pkt->size; + return ret; } - pkt->stream_index = st->index; - pkt->destruct = av_destruct_packet; - - data->fragment = NULL; - return 0; } } |