[FFmpeg-devel] [PATCH] lavf/mpegtsdec: fix AVPacket.pos when FEC/DVHS/BDAV data is present

Rodger Combs rodger.combs at gmail.com
Fri Aug 31 08:20:30 EEST 2018


We previously set pos to several bytes before the actual packet sync byte,
which meant that seeking to pos relied on resync working, which can fail
if there are 0x47 bytes in the additional data.

The resync issue should probably also be fixed separately.
---
 libavformat/mpegts.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index a5cb17ac16..881708b42d 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2581,10 +2581,9 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
 
     } else {
         int ret;
-        // Note: The position here points actually behind the current packet.
         if (tss->type == MPEGTS_PES) {
             if ((ret = tss->u.pes_filter.pes_cb(tss, p, p_end - p, is_start,
-                                                pos - ts->raw_packet_size)) < 0)
+                                                pos - TS_PACKET_SIZE)) < 0)
                 return ret;
         }
     }
-- 
2.18.0



More information about the ffmpeg-devel mailing list