aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkraxel <kraxel>2006-06-14 13:35:50 (GMT)
committerkraxel <kraxel>2006-06-14 13:35:50 (GMT)
commit95d5569823f81057303b82473ac4e4b3cc49599d (patch)
tree1b1b49f39396f55579d9ef44a605a77874345d6c
parente18bf0a323bb5de9321d03554dd6e5ada547f7de (diff)
don't try to resync endlessly
-rw-r--r--libng/parse-mpeg.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libng/parse-mpeg.c b/libng/parse-mpeg.c
index 535619e..d54464f 100644
--- a/libng/parse-mpeg.c
+++ b/libng/parse-mpeg.c
@@ -611,6 +611,7 @@ int mpeg_check_video_fmt(struct mpeg_handle *h, unsigned char *header)
size_t mpeg_find_ps_packet(struct mpeg_handle *h, int packet, int mask, off_t *pos)
{
+ unsigned int retries = 32;
unsigned char *buf, *off;
size_t size;
off_t start = *pos;
@@ -625,6 +626,8 @@ size_t mpeg_find_ps_packet(struct mpeg_handle *h, int packet, int mask, off_t *p
off = memchr(buf+1, 0, FILE_BUF_MIN/2-1);
if (NULL == off)
return 0;
+ if (0 == --retries)
+ return 0;
if (ng_log_bad_stream)
fprintf(stderr,"mpeg ps: warning %d: skipped %d bytes to resync\n",
h->errors, (int)(off-buf));

Privacy Policy