Skip to content

Commit

Permalink
Merge remote-tracking branch 'cus/stable'
Browse files Browse the repository at this point in the history
* cus/stable:
  mpegts: always parse pcr

Merged-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed Aug 16, 2014
2 parents 6928ea7 + 51748b6 commit 3574d34
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions libavformat/mpegts.c
Original file line number Diff line number Diff line change
Expand Up @@ -2073,16 +2073,18 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
}
}

if (!has_payload && tss->type != MPEGTS_PCR)
return 0;
p = packet + 4;
if (has_adaptation) {
int64_t pcr_h;
int pcr_l;
if (parse_pcr(&pcr_h, &pcr_l, packet) == 0)
tss->last_pcr = pcr_h * 300 + pcr_l;
/* skip adaptation field */
p += p[0] + 1;
}
/* if past the end of packet, ignore */
p_end = packet + TS_PACKET_SIZE;
if (p > p_end || (p == p_end && tss->type != MPEGTS_PCR))
if (p >= p_end || !has_payload)
return 0;

pos = avio_tell(ts->stream->pb);
Expand Down Expand Up @@ -2135,10 +2137,6 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)

} else {
int ret;
int64_t pcr_h;
int pcr_l;
if (parse_pcr(&pcr_h, &pcr_l, packet) == 0)
tss->last_pcr = pcr_h * 300 + pcr_l;
// 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,
Expand Down

0 comments on commit 3574d34

Please sign in to comment.