summaryrefslogtreecommitdiff
path: root/libavformat/rtpdec_hevc.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2015-02-23 23:28:34 +0200
committerMartin Storsjö <martin@martin.st>2015-02-24 16:25:28 +0200
commit3567b91e49c6ae101c9a35c90f46b8ad9890ac15 (patch)
tree733470bf41dc595d4b80f670e98539f73eb8b681 /libavformat/rtpdec_hevc.c
parentf3449062a8d100ac4f703647336c32b126aa99f1 (diff)
rtpdec_hevc: Share the implementation of fragmented packets with h264
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtpdec_hevc.c')
-rw-r--r--libavformat/rtpdec_hevc.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/libavformat/rtpdec_hevc.c b/libavformat/rtpdec_hevc.c
index e04725be5d..44cf1d218f 100644
--- a/libavformat/rtpdec_hevc.c
+++ b/libavformat/rtpdec_hevc.c
@@ -331,24 +331,8 @@ static int hevc_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_hevc_ctx
new_nal_header[0] = (rtp_pl[0] & 0x81) | (fu_type << 1);
new_nal_header[1] = rtp_pl[1];
- /* start fragment vs. subsequent fragments */
- if (first_fragment) {
- /* create A/V packet which is big enough */
- if ((res = av_new_packet(pkt, sizeof(start_sequence) + sizeof(new_nal_header) + len)) < 0)
- return res;
- /* A/V packet: copy start sequence */
- memcpy(pkt->data, start_sequence, sizeof(start_sequence));
- /* A/V packet: copy new NAL header */
- memcpy(pkt->data + sizeof(start_sequence), new_nal_header, sizeof(new_nal_header));
- /* A/V packet: copy NAL unit data */
- memcpy(pkt->data + sizeof(start_sequence) + sizeof(new_nal_header), buf, len);
- } else {
- /* create A/V packet */
- if ((res = av_new_packet(pkt, len)) < 0)
- return res;
- /* A/V packet: copy NAL unit data */
- memcpy(pkt->data, buf, len);
- }
+ res = ff_h264_handle_frag_packet(pkt, buf, len, first_fragment,
+ new_nal_header, sizeof(new_nal_header));
break;
/* PACI packet */