Commit 932d8300 authored by Martin Storsjö's avatar Martin Storsjö

rtpdec_jpeg: Merge two if statements

This makes the code more readable and robust.
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 7ef43234
......@@ -252,9 +252,13 @@ static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
}
/* Parse the quantization table header. */
if (q > 127 && off == 0) {
uint8_t precision;
if (off == 0) {
/* Start of JPEG data packet. */
uint8_t new_qtables[128];
uint8_t hdr[1024];
if (q > 127) {
uint8_t precision;
if (len < 4) {
av_log(ctx, AV_LOG_ERROR, "Too short RTP/JPEG packet.\n");
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
* has been lost somewhere. */
free_frame_if_needed(jpeg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment