[FFmpeg-devel] [PATCH 3/3] avformat/mpegts: use av_unlikely for detecting unknown streams
Marton Balint
cus at passwd.hu
Thu Jan 24 22:38:01 EET 2019
Strangely the previous commit caused a slowdown in overall performance and
this fixes it. I used gcc 7.3.1. Does anybody else see this?
time ffprobe -show_packets samples/ffmpeg-bugs/trac/ticket6132/Samsung_HDR_-_Chasing_the_Light.ts > /dev/null
Before:
real 0m2,010s
user 0m1,413s
sys 0m0,596s
After:
real 0m1,948s
user 0m1,355s
sys 0m0,592s
Signed-off-by: Marton Balint <cus at passwd.hu>
---
libavformat/mpegts.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index b04fd7b4f4..3003739b38 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2477,7 +2477,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
pid = AV_RB16(packet + 1) & 0x1fff;
is_start = packet[1] & 0x40;
tss = ts->pids[pid];
- if (ts->auto_guess && !tss && is_start) {
+ if (av_unlikely(ts->auto_guess && !tss && is_start)) {
add_pes_stream(ts, pid, -1);
tss = ts->pids[pid];
}
--
2.16.4
More information about the ffmpeg-devel
mailing list