Merge commit 'f3449062a8d100ac4f703647336c32b126aa99f1'
* commit 'f3449062a8d100ac4f703647336c32b126aa99f1': rtpdec_hevc: Reduce indentation level by returning early on errors Conflicts: libavformat/rtpdec_hevc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		
						commit
						0f8de2b5f1
					
				@ -320,13 +320,27 @@ static int hevc_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_hevc_ctx
 | 
				
			|||||||
        av_dlog(ctx, " FU type %d with %d bytes\n", fu_type, len);
 | 
					        av_dlog(ctx, " FU type %d with %d bytes\n", fu_type, len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* sanity check for size of input packet: 1 byte payload at least */
 | 
					        /* sanity check for size of input packet: 1 byte payload at least */
 | 
				
			||||||
        if (len > 0) {
 | 
					        if (len <= 0) {
 | 
				
			||||||
 | 
					            if (len < 0) {
 | 
				
			||||||
 | 
					                av_log(ctx, AV_LOG_ERROR,
 | 
				
			||||||
 | 
					                       "Too short RTP/HEVC packet, got %d bytes of NAL unit type %d\n",
 | 
				
			||||||
 | 
					                       len, nal_type);
 | 
				
			||||||
 | 
					                return AVERROR_INVALIDDATA;
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                return AVERROR(EAGAIN);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (first_fragment && last_fragment) {
 | 
				
			||||||
 | 
					            av_log(ctx, AV_LOG_ERROR, "Illegal combination of S and E bit in RTP/HEVC packet\n");
 | 
				
			||||||
 | 
					            return AVERROR_INVALIDDATA;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        new_nal_header[0] = (rtp_pl[0] & 0x81) | (fu_type << 1);
 | 
					        new_nal_header[0] = (rtp_pl[0] & 0x81) | (fu_type << 1);
 | 
				
			||||||
        new_nal_header[1] = rtp_pl[1];
 | 
					        new_nal_header[1] = rtp_pl[1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* start fragment vs. subsequent fragments */
 | 
					        /* start fragment vs. subsequent fragments */
 | 
				
			||||||
        if (first_fragment) {
 | 
					        if (first_fragment) {
 | 
				
			||||||
                if (!last_fragment) {
 | 
					 | 
				
			||||||
            /* create A/V packet which is big enough */
 | 
					            /* create A/V packet which is big enough */
 | 
				
			||||||
            if ((res = av_new_packet(pkt, sizeof(start_sequence) + sizeof(new_nal_header) + len)) < 0)
 | 
					            if ((res = av_new_packet(pkt, sizeof(start_sequence) + sizeof(new_nal_header) + len)) < 0)
 | 
				
			||||||
                return res;
 | 
					                return res;
 | 
				
			||||||
@ -336,10 +350,6 @@ static int hevc_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_hevc_ctx
 | 
				
			|||||||
            memcpy(pkt->data + sizeof(start_sequence), new_nal_header, sizeof(new_nal_header));
 | 
					            memcpy(pkt->data + sizeof(start_sequence), new_nal_header, sizeof(new_nal_header));
 | 
				
			||||||
            /* A/V packet: copy NAL unit data */
 | 
					            /* A/V packet: copy NAL unit data */
 | 
				
			||||||
            memcpy(pkt->data + sizeof(start_sequence) + sizeof(new_nal_header), buf, len);
 | 
					            memcpy(pkt->data + sizeof(start_sequence) + sizeof(new_nal_header), buf, len);
 | 
				
			||||||
                } else {
 | 
					 | 
				
			||||||
                    av_log(ctx, AV_LOG_ERROR, "Illegal combination of S and E bit in RTP/HEVC packet\n");
 | 
					 | 
				
			||||||
                    res = AVERROR_INVALIDDATA;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            /* create A/V packet */
 | 
					            /* create A/V packet */
 | 
				
			||||||
            if ((res = av_new_packet(pkt, len)) < 0)
 | 
					            if ((res = av_new_packet(pkt, len)) < 0)
 | 
				
			||||||
@ -347,16 +357,6 @@ static int hevc_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_hevc_ctx
 | 
				
			|||||||
            /* A/V packet: copy NAL unit data */
 | 
					            /* A/V packet: copy NAL unit data */
 | 
				
			||||||
            memcpy(pkt->data, buf, len);
 | 
					            memcpy(pkt->data, buf, len);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            if (len < 0) {
 | 
					 | 
				
			||||||
                av_log(ctx, AV_LOG_ERROR,
 | 
					 | 
				
			||||||
                       "Too short RTP/HEVC packet, got %d bytes of NAL unit type %d\n",
 | 
					 | 
				
			||||||
                       len, nal_type);
 | 
					 | 
				
			||||||
                res = AVERROR_INVALIDDATA;
 | 
					 | 
				
			||||||
            } else {
 | 
					 | 
				
			||||||
                res = AVERROR(EAGAIN);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    /* PACI packet */
 | 
					    /* PACI packet */
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user