rtpdec_jpeg: Merge two if statements

This makes the code more readable and robust.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö 2012-09-11 12:07:56 +03:00
parent 7ef4323405
commit 932d8300d3

View File

@ -252,9 +252,13 @@ static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
} }
/* Parse the quantization table header. */ /* Parse the quantization table header. */
if (q > 127 && off == 0) { if (off == 0) {
uint8_t precision; /* Start of JPEG data packet. */
uint8_t new_qtables[128];
uint8_t hdr[1024];
if (q > 127) {
uint8_t precision;
if (len < 4) { if (len < 4) {
av_log(ctx, AV_LOG_ERROR, "Too short RTP/JPEG packet.\n"); av_log(ctx, AV_LOG_ERROR, "Too short RTP/JPEG packet.\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
@ -286,11 +290,6 @@ static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
} }
} }
if (off == 0) {
/* Start of JPEG data packet. */
uint8_t new_qtables[128];
uint8_t hdr[1024];
/* Skip the current frame in case of the end packet /* Skip the current frame in case of the end packet
* has been lost somewhere. */ * has been lost somewhere. */
free_frame_if_needed(jpeg); free_frame_if_needed(jpeg);