summaryrefslogtreecommitdiff
path: root/libavformat/mpegts.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-03-09 15:30:46 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-03-09 15:31:44 +0100
commitf94b4f161151cc95b6d0ffc7671bbc0a1252130b (patch)
tree5cc7ef598e674eeb53ee22eeae1e6f583fefe107 /libavformat/mpegts.c
parent0a84ba26081c890e0726f0ad5ece2b4517bf4ee1 (diff)
avformat/mpegts: Simplify score compare
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r--libavformat/mpegts.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 773b7a0384..8f68639388 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -620,16 +620,16 @@ static int get_packet_size(AVFormatContext* s)
av_log(s, AV_LOG_TRACE, "Probe: %d, score: %d, dvhs_score: %d, fec_score: %d \n",
buf_size, score, dvhs_score, fec_score);
+ margin = mid_pred(score, fec_score, dvhs_score);
+
if (buf_size < PROBE_PACKET_MAX_BUF)
- margin = PROBE_PACKET_MARGIN; /*if buffer not filled */
- else
- margin = 0;
+ margin += PROBE_PACKET_MARGIN; /*if buffer not filled */
- if (score > FFMAX(fec_score, dvhs_score) + margin)
+ if (score > margin)
return TS_PACKET_SIZE;
- else if (dvhs_score > FFMAX(score, fec_score) + margin)
+ else if (dvhs_score > margin)
return TS_DVHS_PACKET_SIZE;
- else if (fec_score > FFMAX(score, dvhs_score) + margin)
+ else if (fec_score > margin)
return TS_FEC_PACKET_SIZE;
}
return AVERROR_INVALIDDATA;