rtpdec: factorize identical code used in several handlers

This commit is contained in:
Anton Khirnov
2012-11-01 14:03:04 +01:00
parent f70381ab9d
commit 179a5c37e0
7 changed files with 34 additions and 42 deletions

View File

@@ -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;
}
}