Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mpegts input: mini-optimization in ts_sync_count()
  • Loading branch information
perexg committed Mar 22, 2015
1 parent a7445b1 commit 023563f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/input/mpegts/mpegts_input.c
Expand Up @@ -821,26 +821,24 @@ mpegts_input_tuning_error ( mpegts_input_t *mi, mpegts_mux_t *mm )
static int inline
ts_sync_count ( const uint8_t *tsb, int len )
{
int r = 0;
const uint8_t *start = tsb;
while (len >= 188) {
if (len >= 1880 &&
tsb[0*188] == 0x47 && tsb[1*188] == 0x47 &&
tsb[2*188] == 0x47 && tsb[3*188] == 0x47 &&
tsb[4*188] == 0x47 && tsb[5*188] == 0x47 &&
tsb[6*188] == 0x47 && tsb[7*188] == 0x47 &&
tsb[8*188] == 0x47 && tsb[9*188] == 0x47) {
r += 1880;
len -= 1880;
tsb += 1880;
} else if (*tsb == 0x47) {
r += 188;
len -= 188;
tsb += 188;
} else {
break;
}
}
return r;
return tsb - start;
}

void
Expand Down

0 comments on commit 023563f

Please sign in to comment.