summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-21 13:19:29 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-21 13:22:02 +0100
commite3cc93aacfcbb2111e3520355d414b55b48f9426 (patch)
tree311ed7aca4d2d193d703c0396ce480c9bcbdd9c3 /libavformat
parent2b2b6d1e3ceb1bfe77bc8ae9af763ddae9c352a3 (diff)
parentcbdd1806ead8758949f22b4e4f214b035c78e2b9 (diff)
Merge commit 'cbdd1806ead8758949f22b4e4f214b035c78e2b9'
* commit 'cbdd1806ead8758949f22b4e4f214b035c78e2b9': rtpdec_hevc: Implement parsing of aggregated packets Conflicts: libavformat/rtpdec_hevc.c See: b6f577dbb2afde4111a1820435ab2c5afbf78e12 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/rtpdec_hevc.c66
1 files changed, 6 insertions, 60 deletions
diff --git a/libavformat/rtpdec_hevc.c b/libavformat/rtpdec_hevc.c
index 0148b16c79..3b3b260ac4 100644
--- a/libavformat/rtpdec_hevc.c
+++ b/libavformat/rtpdec_hevc.c
@@ -321,66 +321,12 @@ static int hevc_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_hevc_ctx
buf += RTP_HEVC_PAYLOAD_HEADER_SIZE;
len -= RTP_HEVC_PAYLOAD_HEADER_SIZE;
- /* pass the HEVC DONL field */
- if (rtp_hevc_ctx->using_donl_field) {
- buf += RTP_HEVC_DONL_FIELD_SIZE;
- len -= RTP_HEVC_DONL_FIELD_SIZE;
- }
-
- /*
- * pass 0: determine overall size of the A/V packet
- * pass 1: create resulting A/V packet
- */
- {
- int pass = 0;
- int pkt_size = 0;
- uint8_t *pkt_data = 0;
-
- for (pass = 0; pass < 2; pass++) {
- const uint8_t *buf1 = buf;
- int len1 = len;
-
- while (len1 > RTP_HEVC_AP_NALU_LENGTH_FIELD_SIZE) {
- uint16_t nalu_size = AV_RB16(buf1);
-
- /* pass the NALU length field */
- buf1 += RTP_HEVC_AP_NALU_LENGTH_FIELD_SIZE;
- len1 -= RTP_HEVC_AP_NALU_LENGTH_FIELD_SIZE;
-
- if (nalu_size > 0 && nalu_size <= len1) {
- if (pass == 0) {
- pkt_size += sizeof(start_sequence) + nalu_size;
- } else {
- /* A/V packet: copy start sequence */
- memcpy(pkt_data, start_sequence, sizeof(start_sequence));
- /* A/V packet: copy NAL unit data */
- memcpy(pkt_data + sizeof(start_sequence), buf1, nalu_size);
- /* shift pointer beyond the current NAL unit */
- pkt_data += sizeof(start_sequence) + nalu_size;
- }
- }
-
- /* pass the current NAL unit */
- buf1 += nalu_size;
- len1 -= nalu_size;
-
- /* pass the HEVC DOND field */
- if (rtp_hevc_ctx->using_donl_field) {
- buf1 += RTP_HEVC_DOND_FIELD_SIZE;
- len1 -= RTP_HEVC_DOND_FIELD_SIZE;
- }
- }
-
- /* create A/V packet */
- if (pass == 0) {
- if ((res = av_new_packet(pkt, pkt_size)) < 0)
- return res;
-
- pkt_data = pkt->data;
- }
- }
- }
-
+ res = ff_h264_handle_aggregated_packet(ctx, rtp_hevc_ctx, pkt, buf, len,
+ rtp_hevc_ctx->using_donl_field ?
+ RTP_HEVC_DONL_FIELD_SIZE : 0,
+ NULL, 0);
+ if (res < 0)
+ return res;
break;
/* fragmentation unit (FU) */
case 49: