summaryrefslogtreecommitdiff
path: root/libavformat/rtpdec_xiph.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-11-01 14:03:04 +0100
committerAnton Khirnov <anton@khirnov.net>2012-11-02 07:58:37 +0100
commit179a5c37e070f619f14289bdc0fa66a08219eed9 (patch)
tree2713046a1df6cefc885e1411a79f8a508c784b84 /libavformat/rtpdec_xiph.c
parentf70381ab9d53132be2d009d6db9649b3cad8288b (diff)
rtpdec: factorize identical code used in several handlers
Diffstat (limited to 'libavformat/rtpdec_xiph.c')
-rw-r--r--libavformat/rtpdec_xiph.c13
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;
}
}