1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit 'cbdd1806ead8758949f22b4e4f214b035c78e2b9'

* commit 'cbdd1806ead8758949f22b4e4f214b035c78e2b9':
  rtpdec_hevc: Implement parsing of aggregated packets

Conflicts:
	libavformat/rtpdec_hevc.c

See: b6f577dbb2
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-02-21 13:19:29 +01:00
commit e3cc93aacf

View File

@ -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: