summaryrefslogtreecommitdiff
path: root/libavformat/mpegts.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-06 16:14:33 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-06 16:23:32 +0200
commit0df55e1ba88600a14ed2bd5921fdf8279d63ae08 (patch)
tree3ae5c6e44af564a24e924c938fb41eddb193300d /libavformat/mpegts.c
parent91062ddef18e94d54e4b37b288c77c11947d8756 (diff)
parenta22ae9f0c579793f411e2bd7a8db557091a3a4ae (diff)
Merge commit 'a22ae9f0c579793f411e2bd7a8db557091a3a4ae'
* commit 'a22ae9f0c579793f411e2bd7a8db557091a3a4ae': mpegts: Remove one 64-bit integer modulus operation per packet Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r--libavformat/mpegts.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 896c96b6e8..b22ed8f13d 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -29,6 +29,7 @@
#include "libavutil/avassert.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/get_bits.h"
+#include "libavcodec/mathops.h"
#include "avformat.h"
#include "mpegts.h"
#include "internal.h"
@@ -99,6 +100,8 @@ struct MpegTSContext {
int raw_packet_size;
int pos47;
+ /** position corresponding to pos47, or 0 if pos47 invalid */
+ int64_t pos;
/** if true, all pids are analyzed to find streams */
int auto_guess;
@@ -1857,7 +1860,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
return 0;
pos = avio_tell(ts->stream->pb);
- ts->pos47= pos % ts->raw_packet_size;
+ MOD_UNLIKELY(ts->pos47, pos, ts->raw_packet_size, ts->pos);
if (tss->type == MPEGTS_SECTION) {
if (is_start) {